ryzom / ryzomcore

Ryzom Core is the open-source project related to the Ryzom game. This community repository is synchronized with the Ryzom Forge repository, based on the Core branch.
https://wiki.ryzom.dev
GNU Affero General Public License v3.0
333 stars 90 forks source link

C++11 support (undefined reference to `non-virtual thunk to NLNET::CModuleBase::getCommandHandlerName[abi:cxx11]() const' when using gcc 5+) #264

Closed ryzom-pipeline closed 4 years ago

ryzom-pipeline commented 8 years ago

Original report by Erwan GEORGET (Bitbucket: Dremor56, ).


When building ryzomecore server using OpenSUSE Tumbleweed, I get the following error :

#!bash
[ 63%] Linking CXX executable ../../../../bin/ryzom_ai_service
../../../../lib/libryzom_adminmodules.a(aes_module.cpp.o):(.data.rel.ro._ZTVN5ADMIN21CAdminExecutorServiceE[_ZTVN5ADMIN21CAdminExecutorServiceE]+0x1d0): undefined reference to `non-virtual thunk to NLNET::CModuleBase::getCommandHandlerName[abi:cxx11]() const'
../../../../lib/libryzom_adminmodules.a(as_module.cpp.o):(.data.rel.ro._ZTVN5ADMIN13CAdminServiceE[_ZTVN5ADMIN13CAdminServiceE]+0x200): undefined reference to `non-virtual thunk to NLNET::CModuleBase::getCommandHandlerName[abi:cxx11]() const'
../../../../lib/libryzom_adminmodules.a(aes_client_module.cpp.o):(.data.rel.ro._ZTVN5ADMIN27CAdminExecutorServiceClientE[_ZTVN5ADMIN27CAdminExecutorServiceClientE]+0x190): undefined reference to `non-virtual thunk to NLNET::CModuleBase::getCommandHandlerName[abi:cxx11]() const'
collect2: error: ld returned 1 exit status
ryzom/server/src/ai_service/CMakeFiles/ryzom_ai_service.dir/build.make:2380: recipe for target 'bin/ryzom_ai_service' failed
make[2]: *** [bin/ryzom_ai_service] Error 1
CMakeFiles/Makefile2:6700: recipe for target 'ryzom/server/src/ai_service/CMakeFiles/ryzom_ai_service.dir/all' failed
make[1]: *** [ryzom/server/src/ai_service/CMakeFiles/ryzom_ai_service.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

Here is the cmake command line :

#!bash
cmake -DCMAKE_BUILD_TYPE=Release -DFINAL_VERSION=ON -DWITH_RYZOM_TOOLS=OFF -DWITH_RYZOM_CLIENT=OFF -DWITH_STATIC=ON -DWITH_QT=OFF ../code

And the output :

#!bash
-- The CXX compiler identification is GNU 5.3.1
-- The C compiler identification is GNU 5.3.1
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Mercurial: /usr/bin/hg  
-- Found revision 7387
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.8") 
-- Found LibXml2: /usr/lib64/libxml2.so (found version "2.9.2") 
-- Found PNG: /usr/lib64/libpng.so (found version "1.6.21") 
-- Found OpenSSL: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so (found version "1.0.2g") 
-- Performing Test GIF_GifFileType_UserData
-- Performing Test GIF_GifFileType_UserData - Success
-- Found GIF: /usr/lib64/libgif.so (found version "4") 
-- Found Jpeg: /usr/lib64/libjpeg.so
-- Looking for lzma_auto_decoder in /usr/lib64/liblzma.so
-- Looking for lzma_auto_decoder in /usr/lib64/liblzma.so - found
-- Looking for lzma_easy_encoder in /usr/lib64/liblzma.so
-- Looking for lzma_easy_encoder in /usr/lib64/liblzma.so - found
-- Looking for lzma_lzma_preset in /usr/lib64/liblzma.so
-- Looking for lzma_lzma_preset in /usr/lib64/liblzma.so - found
-- Found LibLZMA: /usr/include (found version "5.2.2") 
-- Found CppTest: optimized;/usr/lib64/libcpptest.so
-- Boost version: 1.60.0
-- Luabind is using Lua 5.3
-- Found Lua53: /usr/lib64/liblua.so;/usr/lib64/libm.so  
-- Found Luabind: /usr/lib64/libluabind.so
-- Found CURL: /usr/lib64/libcurl.so (found version "7.47.0") 
-- Found FreeType: /usr/lib64/libfreetype.so
-- Found Ogg: /usr/lib64/libogg.so
-- Found Vorbis: /usr/lib64/libvorbis.so
-- Found OpenAL: /usr/lib64/libopenal.so  
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found X11: /usr/lib64/libX11.so
-- Found XF86VidMode: /usr/lib64/libXxf86vm.so
-- Found OpenGL: /usr/lib64/libGL.so  
Debug Squish NOT found, using the release version!
-- Found Squish: optimized;/usr/lib64/libsquish.so;debug;/usr/lib64/libsquish.so
-- Found MySQL: /usr/include/mysql, /usr/lib64/libmysqlclient.so;/usr/lib64/libssl.so;/usr/lib64/libcrypto.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/Dremor/Documents/Workspace/hg/ryzomcore/build
ryzom-pipeline commented 8 years ago

Original comment by Erwan GEORGET (Bitbucket: Dremor56, ).


I've done some investigation, by building it on OpenSUSE Leap 42.1. On Leap, the server buils without error.

Moreover, the "abi:cxx11" in the error make me think this could be a gcc 5.x error, as gcc 5.0 switched the default c++ abi from c++98 to c++11. This may be a problem, as the next Ubuntu LTS (16.04) will use gcc 5 as default compiler. For reference : https://gcc.gnu.org/gcc-5/porting_to.html

Sidenote : gcc 6.0 will switch to the c++15 abi, thus we could see similar error in the future.

ryzom-pipeline commented 6 years ago

Original comment by Meelis Mägi (Bitbucket: [Meelis Mägi](https://bitbucket.org/Meelis Mägi), ).


abi:cxx11 symbols comes from changes to std::string (and some other things)

This seems to be mangling bug in gcc5 as gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406 (ubuntu zesty) compiles fine.

ryzom-pipeline commented 5 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


I confirm everything is working fine with GCC 8 :)