open-mpi / hwloc

Hardware locality (hwloc)
https://www.open-mpi.org/projects/hwloc
Other
578 stars 174 forks source link

Including built hwloc in linker for cross toolchain compilation #672

Open 0xffffa opened 5 months ago

0xffffa commented 5 months ago

I'm currently on ubuntu trying to cross compile for android on golang. I'm able to successfully build the hwloc libraries for each android architecture using https://github.com/XMRig-for-Android/xmrig-for-android/tree/main/xmrig/lib-builder

However when trying to compile this library in a golang project using the same android tool chain I get the error

fatal error: 'hwloc.h' file not found

How can I make the compiler recognize the built hwloc libraries? Sorry if this is a dumb question but I'm not very good with understanding cross compilation or where the libraries are gotten from

bgoglin commented 5 months ago

Hello

(spoiler: I know nothing about golang)

I see that hwloc gets installed in TARGET_DIR=$EXTERNAL_LIBS_ROOT/hwloc/$ANDROID_ABI hence the lib is under "lib" there while hwloc.h is under "include" there. Can you check that hwloc.h is indeed there? It should since you call "make install".

Then I see -DHWLOC_INCLUDE_DIR="$EXTERNAL_LIBS_ROOT/hwloc/$ANDROID_ABI/include " in xmrig-build.sh. But that variable isn't used anywhere else? Or is cmake clever enough to understand where it has be passed to the compiler? In the end, you should run a "verbose" build to see entire compile lines and check whether there's a -I parameter with the hwloc include dir.