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

Can't build using Android NDK android-ndk-r26b-linux #1274

Open
fatduckling opened this issue Nov 26, 2023 · 3 comments
Open

Can't build using Android NDK android-ndk-r26b-linux #1274

fatduckling opened this issue Nov 26, 2023 · 3 comments

Comments

@fatduckling
Copy link

fatduckling commented Nov 26, 2023

Hi,

When I'm trying to compile for Android using android-ndk-r26b-linux, it fails with the error:

$ cmake  -DCMAKE_BUILD_TYPE=Release -DTBB_STRICT=OFF -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=$ANDROID_SDK_MINIMUM -DTBB_TEST=OFF -DCMAKE_INSTALL_PREFIX=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr -DCMAKE_INSTALL_LIBDIR=lib/aarch64-linux-android /tmp/tbb -B /tmp/tbb/build 

$ make -j$(nproc) -C /tmp/tbb/build install

-- The CXX compiler identification is Clang 17.0.2
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Looking for getcontext
-- Looking for getcontext - not found
-- The C compiler identification is Clang 17.0.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- HWLOC target HWLOC::hwloc_1_11 doesn't exist. The tbbbind target cannot be created
-- HWLOC target HWLOC::hwloc_2 doesn't exist. The tbbbind_2_0 target cannot be created
-- HWLOC target HWLOC::hwloc_2_5 doesn't exist. The tbbbind_2_5 target cannot be created
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/tbb/build

...
ld.lld: error: version script assignment of 'local' to symbol 'ITT_DoOneTimeInitialization' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'TBB_runtime_interface_version' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'get_memcpy_largest_cachelinesize' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'get_memcpy_largest_cache_size' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'get_mem_ops_method' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'init_mem_ops_method' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'irc__get_msg' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'irc__print' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'override_mem_ops_method' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'set_memcpy_largest_cachelinesize' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'set_memcpy_largest_cache_size' failed: symbol not defined

It works for android-ndk-r25c however. Any ideas? Seems already reported here https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274337 but that patch they've done seems to cause the same issue here.

@isaevil
Copy link
Contributor

isaevil commented Nov 27, 2023

Have you tried to disable IPO/LTO with -DTBB_ENABLE_IPO=OFF CMake option?

@fatduckling
Copy link
Author

Hi @isaevil

I'm getting the same error even after disabling IPO. This is using the latest commit version 58653a3.

saleem@saleem-Z790:/tmp/tbb/builder$ cmake -DTBB_ENABLE_IPO=OFF -DCMAKE_BUILD_TYPE=Release -DTBB_STRICT=OFF -DCMAKE_TOOLCHAIN_FILE=/tmp/android-ndk-r26b/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=24 -DTBB_TEST=OFF -DCMAKE_INSTALL_PREFIX=/tmp/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr -DCMAKE_INSTALL_LIBDIR=lib/aarch64-linux-android /tmp/tbb -B /tmp/tbb/builder 
-- The CXX compiler identification is Clang 17.0.2
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /tmp/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Looking for getcontext
-- Looking for getcontext - not found
-- The C compiler identification is Clang 17.0.2
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /tmp/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- HWLOC target HWLOC::hwloc_1_11 doesn't exist. The tbbbind target cannot be created
-- HWLOC target HWLOC::hwloc_2 doesn't exist. The tbbbind_2_0 target cannot be created
-- HWLOC target HWLOC::hwloc_2_5 doesn't exist. The tbbbind_2_5 target cannot be created
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/tbb/builder
saleem@saleem-Z790:/tmp/tbb/builder$ ls
clang_17.0_cxx11_64_release  CMakeFiles           CPackSourceConfig.cmake  TBBConfig.cmake
cmake                        cmake_install.cmake  Makefile                 TBBConfigVersion.cmake
CMakeCache.txt               CPackConfig.cmake    src
saleem@saleem-Z790:/tmp/tbb/builder$ make -j23
[  2%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/backend.cpp.o
[  4%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/backref.cpp.o
[  6%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/frontend.cpp.o
[  9%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/large_objects.cpp.o
[ 11%] Building CXX object src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.o
[ 16%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/tbbmalloc.cpp.o
[ 16%] Building CXX object src/tbb/CMakeFiles/tbb.dir/allocator.cpp.o
[ 18%] Building CXX object src/tbb/CMakeFiles/tbb.dir/arena.cpp.o
[ 20%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/__/tbb/itt_notify.cpp.o
[ 23%] Building CXX object src/tbb/CMakeFiles/tbb.dir/arena_slot.cpp.o
[ 25%] Building CXX object src/tbb/CMakeFiles/tbb.dir/concurrent_bounded_queue.cpp.o
[ 27%] Building CXX object src/tbb/CMakeFiles/tbb.dir/dynamic_link.cpp.o
[ 30%] Building CXX object src/tbb/CMakeFiles/tbb.dir/governor.cpp.o
[ 32%] Building CXX object src/tbb/CMakeFiles/tbb.dir/exception.cpp.o
[ 34%] Building CXX object src/tbb/CMakeFiles/tbb.dir/global_control.cpp.o
[ 37%] Building CXX object src/tbb/CMakeFiles/tbb.dir/itt_notify.cpp.o
[ 39%] Building CXX object src/tbb/CMakeFiles/tbb.dir/main.cpp.o
[ 41%] Building CXX object src/tbb/CMakeFiles/tbb.dir/market.cpp.o
[ 46%] Building CXX object src/tbb/CMakeFiles/tbb.dir/tcm_adaptor.cpp.o
[ 46%] Building CXX object src/tbb/CMakeFiles/tbb.dir/misc.cpp.o
[ 48%] Building CXX object src/tbb/CMakeFiles/tbb.dir/misc_ex.cpp.o
[ 51%] Building CXX object src/tbb/CMakeFiles/tbb.dir/observer_proxy.cpp.o
[ 53%] Building CXX object src/tbb/CMakeFiles/tbb.dir/parallel_pipeline.cpp.o
[ 58%] Building CXX object src/tbb/CMakeFiles/tbb.dir/profiling.cpp.o
[ 58%] Building CXX object src/tbb/CMakeFiles/tbb.dir/private_server.cpp.o
[ 60%] Building CXX object src/tbb/CMakeFiles/tbb.dir/rml_tbb.cpp.o
[ 62%] Building CXX object src/tbb/CMakeFiles/tbb.dir/rtm_mutex.cpp.o
[ 65%] Building CXX object src/tbb/CMakeFiles/tbb.dir/rtm_rw_mutex.cpp.o
[ 67%] Building CXX object src/tbb/CMakeFiles/tbb.dir/semaphore.cpp.o
[ 69%] Building CXX object src/tbb/CMakeFiles/tbb.dir/small_object_pool.cpp.o
[ 72%] Building CXX object src/tbb/CMakeFiles/tbb.dir/task.cpp.o
[ 74%] Building CXX object src/tbb/CMakeFiles/tbb.dir/task_dispatcher.cpp.o
[ 76%] Building CXX object src/tbb/CMakeFiles/tbb.dir/task_group_context.cpp.o
[ 79%] Building CXX object src/tbb/CMakeFiles/tbb.dir/thread_dispatcher.cpp.o
[ 81%] Building CXX object src/tbb/CMakeFiles/tbb.dir/thread_request_serializer.cpp.o
[ 83%] Building CXX object src/tbb/CMakeFiles/tbb.dir/threading_control.cpp.o
[ 86%] Building CXX object src/tbb/CMakeFiles/tbb.dir/version.cpp.o
[ 88%] Building CXX object src/tbb/CMakeFiles/tbb.dir/queuing_rw_mutex.cpp.o
[ 90%] Linking C shared library ../../clang_17.0_cxx11_64_release/libtbbmalloc.so
ld.lld: error: version script assignment of 'local' to symbol 'ITT_DoOneTimeInitialization' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'TBB_runtime_interface_version' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'get_memcpy_largest_cachelinesize' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'get_memcpy_largest_cache_size' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'get_mem_ops_method' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'init_mem_ops_method' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'irc__get_msg' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'irc__print' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'override_mem_ops_method' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'set_memcpy_largest_cachelinesize' failed: symbol not defined
ld.lld: error: version script assignment of 'local' to symbol 'set_memcpy_largest_cache_size' failed: symbol not defined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/tbbmalloc/CMakeFiles/tbbmalloc.dir/build.make:178: clang_17.0_cxx11_64_release/libtbbmalloc.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:223: src/tbbmalloc/CMakeFiles/tbbmalloc.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 93%] Linking CXX shared library ../../clang_17.0_cxx11_64_release/libtbb.so
[ 93%] Built target tbb
make: *** [Makefile:156: all] Error 2
saleem@saleem-Z790:/tmp/tbb/builder$ 

Thanks

@licy183
Copy link

licy183 commented Dec 25, 2023

A workaround for this issue is passing -Wl,--undefined-version to LDFLAGS.

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

No branches or pull requests

3 participants