Page 1 of 1

Compiling the Client on Windows

Posted: Wed Jun 11, 2014 11:34 pm
by SilverNexus
I know Kevin Zheng has been working on making the Crossfire Client more easily compiled on various platforms. For the most part, things seem to work. I'm not getting any compiler errors or warnings, except the linker infallibly crashes (returning value 5), thus causing the compilation to fail. With a verbose Makefile generated by CMake 2.8.11.2, the last line printed is

Code: Select all

C:\PROGRA~2\Dev-Cpp\MinGW64\bin\gcc.exe  -std=c99    -Wl,--whole-archive CMakeFiles\crossfire-client-gtk2.dir/objects.a -Wl,--no-whole-archive  -o crossfire-client-gtk2.exe -Wl,--out-implib,libcrossfire-client-gtk2.dll.a -Wl,--major-image-version,0,--minor-image-version,0  ..\..\common\libcfclient.a C:\Users\TuxRules\Downloads\curl-7.34.0\bin\libcurl.dll C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libfreetype.dll.a C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libgtk-win32-2.0.dll.a C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libgdk-win32-2.0.dll.a C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libcairo.dll.a C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libpango-1.0.dll.a C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libgdk_pixbuf-2.0.dll.a C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libgio-2.0.dll.a C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libatk-1.0.dll.a C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libgobject-2.0.dll.a C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libglib-2.0.dll.a -lglu32 -lopengl32 C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libpng14.dll.a C:\Users\TuxRules\Downloads\gtk_2.24.10\lib\libz.dll.a C:\Windows\System32\wsock32.dll C:\Windows\System32\winmm.dll -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
This is 1283 characters long, making me wonder if I could be overflowing a buffer. I was also using Orwell Dev-C++ to compile it, and one place it output the message was truncated, which may also have something to do with this.

Does anyone have any ideas or confirmation of what the issue is here, or, more importantly, how to fix this issue?

Posted: Sat Jun 14, 2014 12:59 am
by Partmedia
I haven't used this compiler, so I haven't experienced this problem, either. Is there a way you could obtain the full compiler invocation and error message?

Posted: Mon Jun 16, 2014 5:20 pm
by SilverNexus
Each object built is invoked like this, except not always about.c(.obj):

Code: Select all

C:\PROGRA~2\Dev-Cpp\MinGW64\bin\gcc.exe  -DWIN32 -std=c99 -O3 -DNDEBUG @CMakeFiles/crossfire-client-gtk2.dir/includes_C.rsp   -o CMakeFiles\crossfire-client-gtk2.dir\about.c.obj   -c C:\Users\TuxRules\Documents\crossfire.svn\client.svn\gtk-v2\src\about.c
The linker is invoked with this:

Code: Select all

 C:\PROGRA~2\Dev-Cpp\MinGW64\bin\gcc.exe  -std=c99 -O3 -DNDEBUG   -s -Wl,--whole-archive CMakeFiles\crossfire-client-gtk2.dir/objects.a -Wl,--no-whole-archive  -o crossfire-client-gtk2.exe -Wl,--out-implib,libcrossfire-client-gtk2.dll.a -Wl,--major-image-version,0,--minor-image-version,0  ..\..\common\libcfclient.a C:\Users\TuxRules\Downloads\curl-7.34.0\lib\libcurldll.a C:\Users\TuxRules\gtk2\lib\libfreetype.dll.a C:\Users\TuxRules\gtk2\lib\libgtk-win32-2.0.dll.a C:\Users\TuxRules\gtk2\lib\libgdk-win32-2.0.dll.a C:\Users\TuxRules\gtk2\lib\libcairo.dll.a C:\Users\TuxRules\gtk2\lib\libpango-1.0.dll.a C:\Users\TuxRules\gtk2\lib\libpangocairo-1.0.dll.a C:\Users\TuxRules\gtk2\lib\libpangoft2-1.0.dll.a C:\Users\TuxRules\gtk2\lib\libpangowin32-1.0.dll.a C:\Users\TuxRules\gtk2\lib\libgdk_pixbuf-2.0.dll.a C:\Users\TuxRules\gtk2\lib\libgthread-2.0.dll.a C:\Users\TuxRules\gtk2\lib\libgmodule-2.0.dll.a C:\Users\TuxRules\gtk2\lib\libgio-2.0.dll.a C:\Users\TuxRules\gtk2\lib\libatk-1.0.dll.a C:\Users\TuxRules\gtk2\lib\libgobject-2.0.dll.a C:\Users\TuxRules\gtk2\lib\libglib-2.0.dll.a -lglu32 -lopengl32 C:\Users\TuxRules\gtk2\lib\libpng.lib C:\Users\TuxRules\gtk2\lib\libz.dll.a C:\Windows\System32\wsock32.dll C:\Windows\System32\winmm.dll -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 
After I close the Windows pop-up that informs me ld.exe has stopped working, the compile log informs me:

Code: Select all

collect2.exe: error: ld returned 5 exit status
I guess to be safe, an output of the error dialog windows gives me won't hurt either :wink:

Code: Select all

Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	ld.exe
  Application Version:	0.0.0.0
  Application Timestamp:	52472786
  Fault Module Name:	ld.exe
  Fault Module Version:	0.0.0.0
  Fault Module Timestamp:	52472786
  Exception Code:	c0000005
  Exception Offset:	000282b6
  OS Version:	6.1.7601.2.1.0.256.48
  Locale ID:	1033
  Additional Information 1:	0a9e
  Additional Information 2:	0a9e372d3b4ad19135b953a78882e789
  Additional Information 3:	0a9e
  Additional Information 4:	0a9e372d3b4ad19135b953a78882e789
Exception code c0000005 seems to be an access violation, by what I've found from about two minutes of searching.

To be more specific than saying I was using Orwell Dev-C++, I should say the compiler is TDM-GCC 4.8.1.

I read something about wxWidgets having an issue like this when compiled using TDM-GCC, but I didn't find much more. Somewhere else said error code 5 means something is defined multiple times, but I have no idea what could be redefined.

Note that I updated my CMake to 2.8.12.2, and that did not solve the issue.