essentia icon indicating copy to clipboard operation
essentia copied to clipboard

Won't link on iOS with all_load flag

Open MeijisIrlnd opened this issue 3 years ago • 1 comments

Hey, I'm working on a project that uses both Essentia and libtorch_lite, on iOS. I've had Essentia cross compiled according to the build flags in the FAQ section for ages (lightweight= FFT=Accelerate), and it was working fine, but torch needs the -all_load linker flag to work at runtime (if I leave it out, the program compiles but the torch inference fails at runtime). When I try and compile with all_load I get

ld: in /Users/sylmorrison/JUCE_old/UserModules/kalide_extractors_juce/libs/iOS/arm64/libessentia.a(nnls.c.1.o), building for iOS, but linking in object file built for macOS, file '/Users/sylmorrison/JUCE_old/UserModules/kalide_extractors_juce/libs/iOS/arm64/libessentia.a'

lipo -info libessentia.a gives me arm64 and arm7, so its definitely built correctly. From apple's docs,

-all_load forces the linker to load all object files from every archive it sees, even those without Objective-C code

So I'm wondering if the intermediate object files generated from the cross compile for Essentia are the problem (bearing in mind I'm way out of my depth here)

I also asked this on stack overflow, and the post might have a few more details if needed.

Any ideas?

MeijisIrlnd avatar Aug 09 '22 12:08 MeijisIrlnd

Solved by figuring out what files specifically need compiling for the iOS build, adding them to an Xcode project targeting an iOS static lib and compiling, but would be nice to not have to do that..

MeijisIrlnd avatar Aug 09 '22 16:08 MeijisIrlnd