ftylitak/qzxing

ZXing with Qt Android can't compile and issues with many errors of kind undefined reference to std::logic_error::logic_error, std::__ndk1::__shared_weak_count,

anischali opened this issue · 3 comments

/bin/arm-linux-androideabi-g++ --sysroot=/opt/sdk-old/android-ndk/platforms/android-16/arch-arm/ -Wl,-soname,libfoody.so -Wl,-rpath=/opt/Qt5.9.9/5.9.9/android_armv7/lib -Wl,--no-undefined -Wl,-z,noexecstack -shared -o libfoody.so main.o qcontent.o qrcode.o qrc_qml.o moc_qcontent.o moc_qrcode.o -L/opt/sdk-old/android-ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -L/opt/sdk-old/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x -L/opt/zxing/libs/ -lzxing_core -L/opt/sdk/ndk/platforms/android-16/arch-arm/usr/lib/ -L/opt/sdk/ndk/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -lgnustl_static -lgnustl_shared -L/opt/Qt5.9.9/5.9.9/android_armv7/lib -lQt5Quick -L/opt/android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a -L/opt/android/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9 -lQt5Multimedia -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lGLESv2 -lgnustl_shared -lgcc -llog -lz -lm -ldl -lc
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/stdexcept:167: error: undefined reference to 'std::logic_error::logic_error(char const*)'
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/stdexcept:142: error: undefined reference to 'std::logic_error::logic_error(char const*)'
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/stdexcept:142: error: undefined reference to 'std::logic_error::logic_error(char const*)'
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/stdexcept:142: error: undefined reference to 'std::logic_error::logic_error(char const*)'
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/memory:3481: error: undefined reference to 'std::__ndk1::__shared_weak_count::__release_weak()'
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/memory:3481: error: undefined reference to 'std::__ndk1::__shared_weak_count::__release_weak()'
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/memory:3481: error: undefined reference to 'std::__ndk1::__shared_weak_count::__release_weak()'
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/memory:3481: error: undefined reference to 'std::__ndk1::__shared_weak_count::__release_weak()'
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/memory:3552: error: undefined reference to 'std::__ndk1::__shared_weak_count::__shared_weak_count()'
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/memory:3552: error: undefined reference to 'std::__ndk1::__shared_weak_count::
__shared_weak_count()'
../../../core/src/ResultMetadata.cpp:51: error: undefined reference to 'std::__ndk1::to_wstring(int)'
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/memory:3567: error: undefined reference to 'std::__ndk1::__shared_weak_count::__shared_weak_count()'
/opt/sdk/ndk/sources/cxx-stl/llvm-libc++/include/memory:3552: error: undefined reference to 'std::__ndk1::__shared_weak_count::
__shared_weak_count()'
/opt/zxing/libs//libzxing_core.a(ResultMetadata.o):ResultMetadata.cpp:vtable for std::__ndk1::__shared_ptr_emplace<ZXing::ResultMetadata::IntegerValue, std::__ndk1::allocatorZXing::ResultMetadata::IntegerValue >: error: undefined reference to 'std::__ndk1::__shared_weak_count::__get_deleter(std::type_info const&) const'
/opt/zxing/libs//libzxing_core.a(ResultMetadata.o):ResultMetadata.cpp:typeinfo for std::__ndk1::__shared_ptr_emplace<ZXing::ResultMetadata::IntegerValue, std::__ndk1::allocatorZXing::ResultMetadata::IntegerValue >: error: undefined reference to 'typeinfo for std::__ndk1::__shared_weak_count'
/opt/zxing/libs//libzxing_core.a(ResultMetadata.o):ResultMetadata.cpp:vtable for std::__ndk1::__shared_ptr_emplace<ZXing::ResultMetadata::StringValue, std::__ndk1::allocatorZXing::ResultMetadata::StringValue >: error: undefined reference to 'std::__ndk1::__shared_weak_count::__get_deleter(std::type_info const&) const'
/opt/zxing/libs//libzxing_core.a(ResultMetadata.o):ResultMetadata.cpp:typeinfo for std::__ndk1::__shared_ptr_emplace<ZXing::ResultMetadata::StringValue, std::__ndk1::allocatorZXing::ResultMetadata::StringValue >: error: undefined reference to 'typeinfo for std::__ndk1::__shared_weak_count'
/opt/zxing/libs//libzxing_core.a(ResultMetadata.o):ResultMetadata.cpp:vtable for std::__ndk1::__shared_ptr_emplace<ZXing::ResultMetadata::ByteArrayListValue, std::__ndk1::allocatorZXing::ResultMetadata::ByteArrayListValue >: error: undefined reference to 'std::__ndk1::__shared_weak_count::__get_deleter(std::type_info const&) const'
/opt/zxing/libs//libzxing_core.a(ResultMetadata.o):ResultMetadata.cpp:typeinfo for std::__ndk1::__shared_ptr_emplace<ZXing::ResultMetadata::ByteArrayListValue, std::__ndk1::allocatorZXing::ResultMetadata::ByteArrayListValue >: error: undefined reference to 'typeinfo for std::__ndk1::__shared_weak_count'
/opt/zxing/libs//libzxing_core.a(ResultMetadata.o):ResultMetadata.cpp:vtable for std::__ndk1::__shared_ptr_emplace<ZXing::ResultMetadata::CustomDataValue, std::__ndk1::allocatorZXing::ResultMetadata::CustomDataValue >: error: undefined reference to 'std::__ndk1::__shared_weak_count::__get_deleter(std::type_info const&) const'
/opt/zxing/libs//libzxing_core.a(ResultMetadata.o):ResultMetadata.cpp:typeinfo for std::__ndk1::__shared_ptr_emplace<ZXing::ResultMetadata::CustomDataValue, std::__ndk1::allocatorZXing::ResultMetadata::CustomDataValue >: error: undefined reference to 'typeinfo for std::__ndk1::__shared_weak_count'
collect2: error: ld returned 1 exit status
make: *** [Makefile:244: libfoody.so] Error 1

i would advise you to use the latest Qt before Qt 6,i have been using QZxing for a while now utilizing Qt 5.15.2 and it's working even for compilation on android, i would also advise you to compile Qt from source if you are using the open source version use NDK 21 + and set the necessary environment variables like ndk root or sdk root, QZXing should compile fine

Please close the issue

Thank you very much for your answers