Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined symbol: essentia::init() Android #1342

Open
faiziakbr opened this issue Jun 19, 2023 · 4 comments
Open

undefined symbol: essentia::init() Android #1342

faiziakbr opened this issue Jun 19, 2023 · 4 comments
Labels

Comments

@faiziakbr
Copy link

I have compiled Essentia library successfully from the docs but when I use the shared library I get error.

`
: && /Users/faizan/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android24 --sysroot=/Users/faizan/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fno-limit-debug-info -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libtesting_esstia.so -o /Volumes/Internal_HD/Documents/Raphael/Testing_esstia/app/build/intermediates/cxx/Debug/25225k4s/obj/arm64-v8a/libtesting_esstia.so CMakeFiles/testing_esstia.dir/native-lib.cpp.o /Users/faizan/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/24/liblog.so -latomic -lm && :

ld: error: undefined symbol: essentia::init()
`

I have placed the *.so files in their respective architectures after generating them one by one in Android project
app -> src -> main -> jniLibs -> ${Android_ABI} -> libessentia.so

I have placed the include header files under cpp folder.

I load the library and it loads successfully:
System.loadLibrary("essentia")

When I call "essentia::init();" It gives me error "ld: error: undefined symbol: essentia::init()".

I have been stuck in this problem for a week now. Really appreciate the help on this one. Thanks!.

@faiziakbr faiziakbr changed the title undefined symbol: essentia::init() undefined symbol: essentia::init() Android Jun 19, 2023
@rodgomesc
Copy link

@faiziakbr unfortunately the docs for android building are outdated i spent almost 2 weeks to compile it successfully so you are on the right path 😅, i was only able to build it using --build-static did you try static lib instead of shared?

@faiziakbr
Copy link
Author

I was successful in compiling the library with shared lib. Figured out the issue of undefined symbol. I was able to solve it with using CMake. Docs are depricated which is frustrating.

@rodgomesc
Copy link

@faiziakbr can you kindly give a brief explanation about how did you solved it and mark this issue as solved?

@faiziakbr
Copy link
Author

Ofcourse!!

  1. I changed wscript for android to generate all the architectures of android.
  2. I confirmed them using file libessentia.so command
  3. I created a C++ project on Android.
  4. Created distribution folder at root of project.
  5. Add all the architectures in their respective folders.
  6. Put the header files in the include folder
  7. Added these dependencies in CMake
  8. Loaded the library.
  9. All successful

Also I used ndkVersion '21.3.6528147'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants