urho3d/urho3d

MSYS2: undefined references when linking AssetImporter

sikor666 opened this issue · 4 comments

cmake version 3.23.2
gcc version 12.1.0 (Rev2, Built by MSYS2 project)

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../../ThirdParty/Assimp/code/libAssimp.a(IFCReaderGen1.cpp.obj):IFCReaderGen1.:(.text$_ZN6Assimp3IFC21IfcR
epresentationItemC1Ev[_ZN6Assimp3IFC21IfcRepresentationItemC1Ev]+0x2a): undefined reference to `VTT for Assimp::IFC::IfcRepresentationItem'

...

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../../ThirdParty/Assimp/code/libAssimp.a(IFCReaderGen1.cpp.obj):IFCReaderGen1.:(.text$_ZN6Assimp3IFC30IfcG
eometricRepresentationItemC1Ev[_ZN6Assimp3IFC30IfcGeometricRepresentationItemC1Ev]+0x41): undefined reference to `VTT for Assimp::IFC::IfcGeometricRepresentationItem'

...

1vanK commented

How to reproduce the problem? I have tried the following with the latest version of the engine

build.bat

:: MinGW 32
set "PATH=c:\Programs\CMake\bin;c:\Programs\Doxygen\;c:\Programs\Graphviz\bin\;c:\Program Files (x86)\HTML Help Workshop\;c:\msys64\mingw32\bin\"

gcc --version

cmake.exe repo -B build_mingw -G "MinGW Makefiles"^
 -D URHO3D_LIB_TYPE=STATIC -D URHO3D_STATIC_RUNTIME=0 -D URHO3D_HASH_DEBUG=0 -D CMAKE_BUILD_TYPE=Debug^
 -D URHO3D_OPENGL=1 -D URHO3D_D3D9=1 -D URHO3D_D3D11=1^
 -D URHO3D_ANGELSCRIPT=1 -D URHO3D_FORCE_AS_MAX_PORTABILITY=0 -D URHO3D_LUA=0 -D URHO3D_LUAJIT=0 -D URHO3D_GENERATEBINDINGS=0^
 -D URHO3D_SAMPLES=1 -D URHO3D_TOOLS=1 -D URHO3D_DOCS=0^
 -D URHO3D_NETWORK=1 -D URHO3D_DATABASE_SQLITE=1 -D URHO3D_TRACY_PROFILING=0 -D URHO3D_PHYSICS2D=1 -D URHO3D_URHO2D=1

cmake --build build_mingw >logMinGW 2>&1

pause
g:\MyGames\Urho3DCurrent>gcc --version
gcc (Rev2, Built by MSYS2 project) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
c:\Programs\CMake\bin>cmake.exe --version
cmake version 3.23.0-rc5

I followed the instructions according to this manual https://www.msys2.org and then started build on the latest version of the engine.

I reproduce this problem on clean repository using MinGW 64 compiler path C:\msys64\mingw64\bin and script:

cmake.exe . -B build_mingw -G "MinGW Makefiles" \
 -D URHO3D_LIB_TYPE=STATIC \
 -D URHO3D_STATIC_RUNTIME=0 \
 -D URHO3D_HASH_DEBUG=0 \
 -D CMAKE_BUILD_TYPE=Debug \
 -D URHO3D_OPENGL=1 \
 -D URHO3D_D3D9=0 \
 -D URHO3D_D3D11=0 \
 -D URHO3D_ANGELSCRIPT=1 \
 -D URHO3D_FORCE_AS_MAX_PORTABILITY=0 \
 -D URHO3D_LUA=0 \
 -D URHO3D_LUAJIT=0 \
 -D URHO3D_GENERATEBINDINGS=0 \
 -D URHO3D_SAMPLES=1 \
 -D URHO3D_TOOLS=1 \
 -D URHO3D_DOCS=0 \
 -D URHO3D_NETWORK=1 \
 -D URHO3D_DATABASE_SQLITE=1 \
 -D URHO3D_TRACY_PROFILING=0 \
 -D URHO3D_PHYSICS2D=1 \
 -D URHO3D_URHO2D=1

cmake.exe --build build_mingw

pause

Error:

[ 89%] Building C object Source/ThirdParty/Assimp/code/CMakeFiles/Assimp.dir/__/contrib/zlib/zutil.c.obj
[ 89%] Linking CXX static library libAssimp.a
[ 89%] Built target Assimp
[ 89%] Building CXX object Source/Tools/AssetImporter/CMakeFiles/AssetImporter.dir/AssetImporter.cpp.obj
[ 89%] Linking CXX executable ..\..\..\bin\tool\AssetImporter.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../../ThirdParty/Assimp/code/libAssimp.a(IFCReaderGen1.cpp.obj):IFCReaderGen1.:(.text$_ZN6Assimp3IFC21IfcR
epresentationItemC1Ev[_ZN6Assimp3IFC21IfcRepresentationItemC1Ev]+0x2a): undefined reference to `VTT for Assimp::IFC::IfcRepresentationItem'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../../ThirdParty/Assimp/code/libAssimp.a(IFCReaderGen1.cpp.obj):IFCReaderGen1.:(.text$_ZN6Assimp3IFC21IfcR
epresentationItemC1Ev[_ZN6Assimp3IFC21IfcRepresentationItemC1Ev]+0x39): undefined reference to `vtable for Assimp::IFC::IfcRepresentationItem'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../../ThirdParty/Assimp/code/libAssimp.a(IFCReaderGen1.cpp.obj):IFCReaderGen1.:(.text$_ZN6Assimp3IFC21IfcR
epresentationItemC1Ev[_ZN6Assimp3IFC21IfcRepresentationItemC1Ev]+0x4f): undefined reference to `vtable for Assimp::IFC::IfcRepresentationItem'

...

I repeat the same scenario using the MinGW 32 compiler path C:\msys64\mingw32\bin after installing MSYS2 packages:

pacman -Syu
pacman -S mingw-w64-i686-toolchain
pacman -S zlib-devel

Build was successful, problem is only when compiling with MinGW 64.

1vanK commented

Thanks!