clvk icon indicating copy to clipboard operation
clvk copied to clipboard

Android NDK r26b fail to build clvk

Open truboxl opened this issue 2 years ago • 8 comments

Steps:

mkdir -p build install
cmake \
-B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCLVK_ENABLE_ASSERTIONS=ON \
-DCLVK_VULKAN_IMPLEMENTATION=swiftshader \
-DCMAKE_INSTALL_PREFIX=/content/clvk/install \
-DCLVK_COMPILER_AVAILABLE=ON \
-DCLVK_UNIT_TESTING=OFF \
-DCMAKE_TOOLCHAIN_FILE=/content/android-ndk-r26b/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a \
-DVulkan_LIBRARY=/content/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/33/libvulkan.so \
-DANDROID_PLATFORM=33 \
-DCLVK_CLSPV_ONLINE_COMPILER=ON
ninja -C build -j$(nproc) install

Error:

[2376/2404] Linking CXX shared library libOpenCL.so
FAILED: libOpenCL.so 
: && /content/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android33 --sysroot=/content/android-ndk-r26b/toolchains/llvm/prebuilt/linux-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   -fdiagnostics-color -O3 -DNDEBUG  -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-undefined-version -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments  -Wl,--version-script=/content/clvk/src/exports.map -Wl,-Bsymbolic -Wl,--gc-sections -shared -Wl,-soname,libOpenCL.so -o libOpenCL.so src/CMakeFiles/OpenCL-objects.dir/api.cpp.o src/CMakeFiles/OpenCL-objects.dir/config.cpp.o src/CMakeFiles/OpenCL-objects.dir/device.cpp.o src/CMakeFiles/OpenCL-objects.dir/device_properties.cpp.o src/CMakeFiles/OpenCL-objects.dir/event.cpp.o src/CMakeFiles/OpenCL-objects.dir/init.cpp.o src/CMakeFiles/OpenCL-objects.dir/kernel.cpp.o src/CMakeFiles/OpenCL-objects.dir/log.cpp.o src/CMakeFiles/OpenCL-objects.dir/memory.cpp.o src/CMakeFiles/OpenCL-objects.dir/printf.cpp.o src/CMakeFiles/OpenCL-objects.dir/program.cpp.o src/CMakeFiles/OpenCL-objects.dir/queue.cpp.o src/CMakeFiles/OpenCL-objects.dir/semaphore.cpp.o src/CMakeFiles/OpenCL-objects.dir/sha1.cpp.o src/CMakeFiles/OpenCL-objects.dir/tracing.cpp.o src/CMakeFiles/OpenCL-objects.dir/unit.cpp.o src/CMakeFiles/OpenCL-objects.dir/utils.cpp.o  -pthread  external/SPIRV-Tools/source/libSPIRV-Tools.a  /content/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/33/libvulkan.so  external/SPIRV-Tools/source/opt/libSPIRV-Tools-opt.a  external/SPIRV-Tools/source/link/libSPIRV-Tools-link.a  external/clspv/lib/libclspv_core.a  external/SPIRV-LLVM-Translator/lib/SPIRV/libLLVMSPIRVLib.a  external/SPIRV-Tools/source/opt/libSPIRV-Tools-opt.a  external/SPIRV-Tools/source/libSPIRV-Tools.a  -landroid  -llog  external/clspv/third_party/llvm/lib/libclangCodeGen.a  external/clspv/third_party/llvm/lib/libLLVMCoverage.a  external/clspv/third_party/llvm/lib/libLLVMLTO.a  external/clspv/third_party/llvm/lib/libLLVMExtensions.a  external/clspv/third_party/llvm/lib/libclangFrontend.a  external/clspv/third_party/llvm/lib/libclangDriver.a  external/clspv/third_party/llvm/lib/libLLVMWindowsDriver.a  external/clspv/third_party/llvm/lib/libclangParse.a  external/clspv/third_party/llvm/lib/libLLVMOption.a  external/clspv/third_party/llvm/lib/libclangSerialization.a  external/clspv/third_party/llvm/lib/libclangSema.a  external/clspv/third_party/llvm/lib/libclangAnalysis.a  external/clspv/third_party/llvm/lib/libclangASTMatchers.a  external/clspv/third_party/llvm/lib/libLLVMFrontendHLSL.a  external/clspv/third_party/llvm/lib/libclangEdit.a  external/clspv/third_party/llvm/lib/libclangAST.a  external/clspv/third_party/llvm/lib/libclangLex.a  external/clspv/third_party/llvm/lib/libclangBasic.a  external/clspv/third_party/llvm/lib/libclangSupport.a  external/clspv/third_party/llvm/lib/libLLVMPasses.a  external/clspv/third_party/llvm/lib/libLLVMCodeGen.a  external/clspv/third_party/llvm/lib/libLLVMCodeGenTypes.a  external/clspv/third_party/llvm/lib/libLLVMObjCARCOpts.a  external/clspv/third_party/llvm/lib/libLLVMTarget.a  external/clspv/third_party/llvm/lib/libLLVMCoroutines.a  external/clspv/third_party/llvm/lib/libLLVMipo.a  external/clspv/third_party/llvm/lib/libLLVMLinker.a  external/clspv/third_party/llvm/lib/libLLVMInstrumentation.a  external/clspv/third_party/llvm/lib/libLLVMVectorize.a  external/clspv/third_party/llvm/lib/libLLVMFrontendOpenMP.a  external/clspv/third_party/llvm/lib/libLLVMScalarOpts.a  external/clspv/third_party/llvm/lib/libLLVMAggressiveInstCombine.a  external/clspv/third_party/llvm/lib/libLLVMInstCombine.a  external/clspv/third_party/llvm/lib/libLLVMIRPrinter.a  external/clspv/third_party/llvm/lib/libLLVMTransformUtils.a  external/clspv/third_party/llvm/lib/libLLVMBitWriter.a  external/clspv/third_party/llvm/lib/libLLVMAnalysis.a  external/clspv/third_party/llvm/lib/libLLVMProfileData.a  external/clspv/third_party/llvm/lib/libLLVMSymbolize.a  external/clspv/third_party/llvm/lib/libLLVMDebugInfoPDB.a  external/clspv/third_party/llvm/lib/libLLVMDebugInfoMSF.a  external/clspv/third_party/llvm/lib/libLLVMDebugInfoBTF.a  external/clspv/third_party/llvm/lib/libLLVMDebugInfoDWARF.a  external/clspv/third_party/llvm/lib/libLLVMObject.a  external/clspv/third_party/llvm/lib/libLLVMIRReader.a  external/clspv/third_party/llvm/lib/libLLVMAsmParser.a  external/clspv/third_party/llvm/lib/libLLVMBitReader.a  external/clspv/third_party/llvm/lib/libLLVMCore.a  external/clspv/third_party/llvm/lib/libLLVMRemarks.a  external/clspv/third_party/llvm/lib/libLLVMBitstreamReader.a  external/clspv/third_party/llvm/lib/libLLVMMCParser.a  external/clspv/third_party/llvm/lib/libLLVMTextAPI.a  external/clspv/third_party/llvm/lib/libLLVMMC.a  external/clspv/third_party/llvm/lib/libLLVMBinaryFormat.a  external/clspv/third_party/llvm/lib/libLLVMDebugInfoCodeView.a  external/clspv/third_party/llvm/lib/libLLVMTargetParser.a  external/clspv/third_party/llvm/lib/libLLVMSupport.a  external/clspv/third_party/llvm/lib/libLLVMDemangle.a  -ldl  -lm  /content/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/33/libz.so  -latomic -lm && :
ld.lld: error: version script assignment of 'CLVK_UNIT_TESTING_FCT' to symbol 'clvk_override_device_max_compute_work_group_count' failed: symbol not defined
ld.lld: error: version script assignment of 'CLVK_UNIT_TESTING_FCT' to symbol 'clvk_restore_device_properties' failed: symbol not defined
ld.lld: error: version script assignment of 'CLVK_UNIT_TESTING_FCT' to symbol 'clvk_override_printf_buffer_size' failed: symbol not defined
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

truboxl avatar Oct 30 '23 06:10 truboxl

Related issue: https://github.com/termux/termux-packages/issues/18375

Additional log (got it 2 hours ago). log.txt for this build recipe (that is the last one which worked).

twaik avatar Oct 30 '23 09:10 twaik

This looks like the issue https://github.com/kpet/clvk/pull/617 was attempting to fix. @rjodinchr Could you share the solution/workaround you've been using here?

kpet avatar Oct 30 '23 09:10 kpet

This looks like the issue #617 was attempting to fix. @rjodinchr Could you share the solution/workaround you've been using here?

I have just been using #617 for my builds

rjodinchr avatar Oct 30 '23 13:10 rjodinchr

#617 only hides the problem, it does not solve it.

twaik avatar Oct 30 '23 13:10 twaik

#617 only hides the problem, it does not solve it.

That's why it has been closed and not merged

rjodinchr avatar Oct 30 '23 13:10 rjodinchr

@kpet, your verdict?

twaik avatar Oct 30 '23 13:10 twaik

@kpet what do you think about #628? It makes symbols available (but no-ops) even without CLVK_UNIT_TESTING_ENABLED defined.

twaik avatar Oct 31 '23 09:10 twaik

@twaik It's not a proper solution but an acceptable temporary workaround. I'll merge the PR and re-open this issue afterwards.

kpet avatar Oct 31 '23 09:10 kpet