vendredi 16 août 2019

unresolved std::__cxx11::basic_string::~basic_string and std::allocator

I am trying to compile QtWebApp with Qt5.5.1 onto the latest RPI4-Raspbian Buster and I am encountering inexplicable GLIBCXX unresolved symbols

What Works : QtWebApp cross compiled from windows to armhf using qt5.5.1 binaries natively compiled on Raspbian Buster works fine with the following components

  1. Toolchain : raspberry-gcc8.3.0.exe installed on Windows 10.

  2. Qt Binary Libs : Native compiled on RPI4 Raspbian Buster OS and copied over to Windows 10.

  3. Command line : c:/SysGCC/raspberry/bin/arm-linux-gnueabihf-g++.exe -std=c++11 -fPIC -I. {ALL QT INCLUDE DIRS} -IC:/SysGCC/raspberry/arm-linux-gnueabihf/sysroot/opt/vc/include -g -rdynamic -funwind-tables -Woverflow {ALL QTWEB SOURCE FILES} -LC:/SysGCC/pi4/pi4qt551/lib -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Multimedia -lQt5MultimediaWidgets -lQt5Network -lm -lpthread -o qtweb

This produces an arm executable that worksfine on RPI-4.

What fails

When compiling natively (which is what I want as the development env) on RPI4 the compilation strangely fails with the following error :

/usr/bin/ld: /tmp/ccnnsRCD.o: undefined reference to symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@@GLIBCXX_3.4.21'

What I have tried (didnt work)

1) Following suggestions from Converting std::__cxx11::string to std::string and passing -D_GLIBCXX_USE_CXX11_ABI=0 it fails with the following error :

/usr/bin/ld: /tmp/ccZfI5co.o: undefined reference to symbol '_ZNSaIcED1Ev@@GLIBCXX_3.4'

where those symbol demangles to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string() and std::allocator<char>::~allocator() respectively.

2) I also ran all the combinations WITH/WITHOUT -std=c++11 and D_GLIBCXX_USE_CXX11_ABI=0 and these are the errors

WITH  -std=c++11, WITHOUT -D_GLIBCXX_USE_CXX11_ABI=0 
/usr/bin/ld: /tmp/ccnnsRCD.o: undefined reference to symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@@GLIBCXX_3.4.21'

 WITH -std=c++11, WITH -D_GLIBCXX_USE_CXX11_ABI=0 
/usr/bin/ld: /tmp/ccZfI5co.o: undefined reference to symbol '_ZNSaIcED1Ev@@GLIBCXX_3.4'

 WITHOUT -std=c++11, WITH -D_GLIBCXX_USE_CXX11_ABI=0 
/usr/bin/ld: /tmp/cctFncwz.o: undefined reference to symbol '_ZNSaIcED1Ev@@GLIBCXX_3.4'

 WITHOUT -std=c++11, WITHOUT -D_GLIBCXX_USE_CXX11_ABI=0 
/usr/bin/ld: /tmp/cchkJYdO.o: undefined reference to symbol '_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev@@GLIBCXX_3.4.21'

3) I also copied the sysroot from the raspberry-gcc8.3.0.exe install on Win10 over to RPi-4 and passed that to gcc as its --sysroot location.

This also fails with the ~basic_string() unresolver error. ( I dont know how to verify if the --sysroot had any effect though I checked with gcc -v output as suggested in a GCC ignores --sysroot post )

INFO: The command line is exactly the same but for using gcc and not passing -IC:/SysGCC/raspberry/arm-linux-gnueabihf/sysroot/opt/vc/include

Question : How is it that (assuming no glaring compile option mismatch ;) cross compiling with a gcc8.3 toolchain from windows to arm-linux works but the same code base when compiled natively on raspbian buster fails with what looks like GLIBCXX version mismatch in the Raspbian Buster OS binaries ?

I am stuck on this for 2 days now. Please suggest any other steps I can try here.

Aucun commentaire:

Enregistrer un commentaire