Hi, I'm trying to cross-compile a program to run on arm versatile juno r2 development platform. The system where I'm compilling is:Linux lfpm1993-virtual-machine 4.13.0-43-generic #48~16.04.1-Ubuntu SMP Thu May 17 12:56:46 UTC 2018 x86_64 x86_64 x86_64 GNU/LinuxThe host where the application will be run is:Linux localhost 4.9.51 #1 SMP PREEMPT Tue Feb 13 06:21:18 UTC 2018 aarch64To compile I executed this command:./configure --host=aarch64-linux-gnu --prefix=/data/data/papi --with-ffsll --with-walltimer=cycle --with-tls=__thread --with-virtualtimer=perfctr --with-perf-events --with-arch=aarch64 --with-CPU=armFollowed up, by running:sudo makesudo make installAfter the instalattion, the binary files were place here, /data/data/papi, as expected.Typing ls shows:bin include lib shareI then executed:adb connect 146.193.56.204adb push /data/data/papi /data/data/papiadb shellcd data/data/papi/bin/Typing ls shows:1|juno:/data/data/papi/bin # lspapi_avail papi_decode papi_native_avail papi_clockres papi_error_codes papi_version papi_command_line papi_event_chooser papi_xml_event_info papi_component_avail papi_mem_info papi_cost papi_multiplex_costAnd this part is where I can't make it work, if I try to execute for example, papi_avail:./papi_availThis is the output message:/system/bin/sh: ./papi_avail: No such file or directoryTrying with sh:1|juno:/data/data/papi/bin # sh ./papi_avail ./papi_avail[2]: syntax error: '�1' unexpected./papi_avail[1]: ELF��2@@H�@8: not foundSo, my question is what i did wrong and how can I solve it?Thanks, for your help:Luís Martins
I will expand a little bit further the anwer. I asked PAPI support and Vince was kind enough to give me his input on this, I will copy/paste his reply:
> It mostly just looks like "-lpthread" should be in the LFLAGS for the > utils and it's not there for some reason. > > I will see if I can figure out what's going on. It looks like it's not related to cross-compile, but rather you can make this happen natively if you build statically and also have --with-pthread-mutexes set (which is the default for ARM). Adding -lpthread to the end of (or after) $(PAPILIB) fixes this but have no idea the proper way to get configure to do this for us.
Hi Luís,
I guess if you chose to build static PAPI lib and tools, it will use pthread_lock and link to pthread lib, if you use default dynamic lib, it will use PAPI_lock() and will not link to pthread lib.