Solved External libraries on Raspberry Pi 3 B+
-
@sneubert Ok thanks, something changed. Now I have a lot of compilation error relative to other libraries:
11:28:58: Running steps for project untitled1... 11:28:58: Configuration unchanged, skipping qmake step. 11:28:58: Starting: "/usr/bin/make" /home/cristiano/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -mfloat-abi=hard --sysroot=/home/cristiano/raspi/sysroot -Wl,-rpath-link,/home/cristiano/raspi/sysroot/opt/vc/lib -Wl,-rpath-link,/home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/cristiano/raspi/sysroot/lib/arm-linux-gnueabihf -o untitled1 main.o -lavcodec -lavdevice -lavformat -lpthread /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_create(unsigned int&, unsigned int)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libzmq.so.5: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::rfind(char, unsigned int) const@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopencv_core.so.2.4: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char, unsigned int) const@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libsnappy.so.1: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned int)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libzmq.so.5: undefined reference to `VTT for std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::_M_sync(char*, unsigned int, unsigned int)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_assign(std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/librubberband.so.2: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned int, unsigned int, char const*, unsigned int)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::reserve(unsigned int)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libjack.so.0: undefined reference to `operator delete(void*, unsigned int)@CXXABI_1.3.9' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libsnappy.so.1: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned int, char)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned int)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char const*, unsigned int, unsigned int) const@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::replace(unsigned int, unsigned int, char const*, unsigned int)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libzmq.so.5: undefined reference to `std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_stringstream()@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libjack.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_mutate(unsigned int, unsigned int, wchar_t const*, unsigned int)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopencv_core.so.2.4: undefined reference to `operator delete[](void*, unsigned int)@CXXABI_1.3.9' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_last_not_of(char const*, unsigned int, unsigned int) const@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `vtable for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libjack.so.0: undefined reference to `std::runtime_error::runtime_error(char const*)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `VTT for std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_aux(unsigned int, unsigned int, unsigned int, char)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::random_device::_M_init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::runtime_error::runtime_error(char const*)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libzmq.so.5: undefined reference to `vtable for std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_erase(unsigned int, unsigned int)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::range_error::range_error(char const*)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned int, char)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_istringstream()@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_of(char const*, unsigned int, unsigned int) const@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `VTT for std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `vtable for std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::range_error::range_error(char const*)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream()@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_last_of(char const*, unsigned int, unsigned int) const@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libjack.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned int&, unsigned int)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find_first_not_of(char const*, unsigned int, unsigned int) const@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libjack.so.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned int, unsigned int, char const*, unsigned int)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopencv_core.so.2.4: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::swap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `vtable for std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4.21' /home/cristiano/raspi/sysroot/usr/lib/arm-linux-gnueabihf/libopenmpt.so.0: undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const@GLIBCXX_3.4.21' Makefile:139: recipe for target 'untitled1' failed collect2: error: ld returned 1 exit status make: *** [untitled1] Error 1 11:28:59: The process "/usr/bin/make" exited with code 2. Error while building/deploying project untitled1 (kit: Raspberry kit) When executing step "Make" 11:28:59: Elapsed time: 00:00.
-
sorry you have to repeate Step 9 after rsync
-
@sneubert I just repeated step 9 but the errors remains
-
this seems to be a compiler missmatch between your cross-compiler an the compiler used to create the library, one thing you can try is to put
#define _GLIBCXX_USE_CXX11_ABI 0
before include any standard library in your code
-
@sneubert Unfortunately it doesn't work. I noticed that copying the file on the Raspberry and compiling from there, it works! And this is strange because the compiler should be the same as the toolchain
-
what version of gcc are you using for cross compiling
/home/cristiano/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ -v
what version of gcc is on your rpi
g++ -v
-
@sneubert
1:Using built-in specs. COLLECT_GCC=/home/cristiano/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++ COLLECT_LTO_WRAPPER=/home/cristiano/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../libexec/gcc/arm-linux-gnueabihf/4.8.3/lto-wrapper Target: arm-linux-gnueabihf Configured with: /home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/src/gcc-linaro-4.8-2014.03/configure --build=x86_64-build_unknown-linux-gnu --host=x86_64-build_unknown-linux-gnu --target=arm-linux-gnueabihf --prefix=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install --with-sysroot=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc --enable-languages=c,c++,fortran --disable-multilib --enable-multiarch --with-arch=armv6 --with-tune=arm1176jz-s --with-fpu=vfp --with-float=hard --with-pkgversion='crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --enable-__cxa_atexit --enable-libmudflap --enable-libgomp --enable-libssp --with-gmp=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-mpfr=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-mpc=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-isl=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-cloog=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-libelf=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --enable-threads=posix --disable-libstdcxx-pch --enable-linker-build-id --enable-plugin --enable-gold --with-local-prefix=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc --enable-c99 --enable-long-long --with-float=hard Thread model: posix gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03)
2:
Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/6/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Raspbian 6.3.0-18+rpi1+deb9u1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf Thread model: posix gcc version 6.3.0 20170516 (Raspbian 6.3.0-18+rpi1+deb9u1)
I think I need to update the cross compiler. Can I simply download the same version of the Raspberry and set it as compiler in the Qt Creator kit?
-
I always use the linaro cross-compiler, latest gcc 7.3.1 should do
https://releases.linaro.org/components/toolchain/binaries/latest/arm-linux-gnueabihf/
But I think you have to rebuild qt with this compiler. -
@sneubert Ok I'll try to repeat steps 10 and 11 with the latest version of gcc
-
@sneubert It worked at first try! Thank you so much, you really helped me a lot!!
-
@Crindu Dear, I am facing with problem that same with your. But i dont know how to update gcc in cross compile, can you help me?