GCC 4.1 Build Failure And Patch

Alan Swanson swanson at ukfsn.org
Sat Jul 22 14:52:22 EDT 2006


Recently updated to GCC 4.1.1, which also required GLIBC 2.4, so thought
I'd recompile Freespace but the build fails on src/inetfile/chttpget.cpp
with the following errors;

g++ -c -o src/inetfile/chttpget.o src/inetfile/chttpget.cpp -Wall -g -DPLAT_UNIX -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -Iinclude/  -O2 -march=athlon-xp -fomit-frame-pointer -pipe -fsigned-char -Wno-format-y2k -DRELEASE_REAL
src/inetfile/chttpget.cpp: In member function ‘void ChttpGet::GetFile(char*, char*)’:
src/inetfile/chttpget.cpp:297: error: invalid conversion from ‘void* (*)(void*)’ to ‘void (*)(void*)’
src/inetfile/chttpget.cpp:297: error:   initializing argument 1 of ‘long unsigned int _beginthread(void (*)(void*), unsigned int, void*)’
src/inetfile/chttpget.cpp: In function ‘int http_Asyncgethostbyname(unsigned int*, int, char*)’:
src/inetfile/chttpget.cpp:747: error: invalid conversion from ‘void* (*)(void*)’ to ‘void (*)(void*)’
src/inetfile/chttpget.cpp:747: error:   initializing argument 1 of ‘long unsigned int _beginthread(void (*)(void*), unsigned int, void*)’
src/inetfile/chttpget.cpp: In function ‘void* http_gethostbynameworker(void*)’:
src/inetfile/chttpget.cpp:798: error: ‘df_pthread_self’ was not declared in this scope
src/inetfile/chttpget.cpp:798: error: ‘df_pthread_detach’ was not declared in this scope
make: *** [src/inetfile/chttpget.o] Error 1

The problem seems to be from Volition's own initial Linux port and
trying to use non-blocking threads in chttpget.cpp.

For the last two errors, I've no idea where the "df_" in df_pthread_self
and df_pthread_detach comes from as I've not been able to find any
references anywhere, only pthread_self and pthread_detach actually
exist. Slightly confused as to how it compiled on GCC 3.3.6 without
errors.

The invalid conversions are for functions passed to the _beginthread
function, which is a stub function in src/platform/unix.cpp, which were
altered by Voliton from the Windows definition to return pointers (?)
from the thread.

However the threading in "elif __LINUX__" sections are commented out in
ChttpGet::GetFile() and http_gethostbynameworker() whilst the preceding
"ifdef WIN32" defines are commented out to make it used in Linux with
the stub _beginthread.

Attached is a patch which removes the commented out Linux threading,
changes a couple of __LINUX__ to PLAT_UNIX and also remove a duplicate
declaration for http_gethostbynameworker. I don't think leaving the
__cdecl for the http_gethostbynameworker function should cause any
problems for GCC.

-- 
Alan.

"One must never be purposelessnessnesslessness."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freespace-chttpget.patch
Type: text/x-patch
Size: 3224 bytes
Desc: not available
URL: <http://icculus.org/pipermail/freespace2/attachments/20060722/54660a86/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://icculus.org/pipermail/freespace2/attachments/20060722/54660a86/attachment.pgp>


More information about the freespace2 mailing list