JACoders / OpenJK

Community effort to maintain and improve Jedi Academy (SP & MP) + Jedi Outcast (SP only) released by Raven Software
GNU General Public License v2.0
2.01k stars 612 forks source link

Broken build under GCC/MinGW 4.8.1 #289

Closed FaultyRAM closed 10 years ago

FaultyRAM commented 11 years ago

At the moment, GCC/MinGW 4.8.1 won't compile the code base. Once some easily-fixed issues are resolved (not including <string> on Windows, not expecting OpenAL-Soft on Windows, using DirectInput constants - which aren't actually constants - as switch cases), the build hits a show-stopper during the linker phase:

[...]
cd /d J:\msys\home\FaultyRAM\c++\build\OpenJK\code && J:\mingw32\bin\windres.exe  -O coff -IJ:\msys\home\FaultyRAM\c++\OpenJK\lib -IJ:\msys\local\include     J:\msys\home\FaultyRAM\c++\OpenJK\code\win32\winquake.rc CMakeFiles\openjk_sp.x86.dir\win32\winquake.rc.obj
Linking CXX executable ..\openjk_sp.x86.exe
cd /d J:\msys\home\FaultyRAM\c++\build\OpenJK\code && "C:\Program Files\CMake 2.8\bin\cmake.exe" -E cmake_link_script CMakeFiles\openjk_sp.x86.dir\link.txt --verbose=1
"C:\Program Files\CMake 2.8\bin\cmake.exe" -E remove -f CMakeFiles\openjk_sp.x86.dir/objects.a
J:\mingw32\bin\ar.exe cr CMakeFiles\openjk_sp.x86.dir/objects.a @CMakeFiles\openjk_sp.x86.dir\objects1.rsp
J:\mingw32\bin\i686-w64-mingw32-c++.exe      -mwindows -Wl,--whole-archive CMakeFiles\openjk_sp.x86.dir/objects.a -Wl,--no-whole-archive  -o ..\openjk_sp.x86.exe -Wl,--out-implib,libopenjk_sp.x86.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lwinmm -lglu32 -lopengl32 J:\msys\local\lib\libOpenAL32.dll.a J:\msys\local\lib\libz.dll.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 
CMakeFiles\openjk_sp.x86.dir/objects.a(sv_world.cpp.obj):sv_world.cpp:(.text$_ZNK13CGhoul2Info_v9InfoArrayEv[__ZNK13CGhoul2Info_v9InfoArrayEv]+0xa): undefined reference to `TheGameGhoul2InfoArray()'
CMakeFiles\openjk_sp.x86.dir/objects.a(genericparser2.cpp.obj):genericparser2.cpp:(.text+0x2c9): undefined reference to `gi'
CMakeFiles\openjk_sp.x86.dir/objects.a(genericparser2.cpp.obj):genericparser2.cpp:(.text+0x2fc): undefined reference to `gi'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [openjk_sp.x86.exe] Error 1
mingw32-make.exe[1]: *** [code/CMakeFiles/openjk_sp.x86.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
code\CMakeFiles\openjk_sp.x86.dir\build.make:2633: recipe for target 'openjk_sp.x86.exe' failed
mingw32-make.exe[2]: Leaving directory 'J:/msys/home/FaultyRAM/c++/build/OpenJK'
CMakeFiles\Makefile2:85: recipe for target 'code/CMakeFiles/openjk_sp.x86.dir/all' failed
mingw32-make.exe[1]: Leaving directory 'J:/msys/home/FaultyRAM/c++/build/OpenJK'
J:/msys/home/FaultyRAM/c++/build/OpenJK/Makefile:138: recipe for target 'all' failed

Tested with MSYS Makefile, Code::Blocks/MinGW and Code::Blocks/Unix systems, on Windows XP SP3 w/ MinGW-Builds GCC 4.8.1 rev. 1.

xycaleth commented 11 years ago

I have a feeling it has something to do with the CMake script being too general with its if conditions. i.e. if(WIN32) assumes that MSVC is used.

netfab commented 11 years ago

Same error while trying to build on Gentoo Linux :

CMakeFiles/openjk_sp.i386.dir/server/sv_world.cpp.o: In function CGhoul2Info_v::InfoArray() const': sv_world.cpp:(.text._ZNK13CGhoul2Info_v9InfoArrayEv[CGhoul2Info_v::InfoArray() const]+0x7): undefined reference toTheGameGhoul2InfoArray()' CMakeFiles/openjk_sp.i386.dir/game/genericparser2.cpp.o: In function CTextPool::CTextPool(int)': genericparser2.cpp:(.text+0x317): undefined reference togi' CMakeFiles/openjk_sp.i386.dir/game/genericparser2.cpp.o: In function CTextPool::~CTextPool()': genericparser2.cpp:(.text+0x348): undefined reference togi' collect2: ld returned 1 exit status make[2]: *\ [openjk_sp.i386] Error 1