Compiling error 0.3.0

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Compiling error 0.3.0

Post by belenus »

Tried to compile on OpenBSD 4.0-current

last lines before error...

Code: Select all

g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/local/include/libxml2 -I/usr/local/include   -I./tools  -I./network -I. -I.. -O2 -Wno-long-long -I/usr/X11R6/include -c -o libnetwork_a-nServerInfo.o `test -f 'network/nServerInfo.cpp' || echo './'`network/nServerInfo.cpp
g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/local/include/libxml2 -I/usr/local/include   -I./tools  -I./network -I. -I.. -O2 -Wno-long-long -I/usr/X11R6/include -c -o libnetwork_a-nSocket.o `test -f 'network/nSocket.cpp' || echo './'`network/nSocket.cpp
network/nSocket.cpp: In function `const tString& <unnamed>::GetMyHostName()':
network/nSocket.cpp:431: error: `gethostname' undeclared (first use this
   function)
network/nSocket.cpp:431: error: (Each undeclared identifier is reported only
   once for each function it appears in.)
network/nSocket.cpp: In function `int <unnamed>::ANET_CloseSocket(int)':
network/nSocket.cpp:742: error: `close' undeclared (first use this function)
gmake[3]: *** [libnetwork_a-nSocket.o] Error 1
gmake[3]: Leaving directory `/root/armagetronad-0.3.0/src'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/root/armagetronad-0.3.0/src'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/root/armagetronad-0.3.0'
gmake: *** [all] Error 2
- bel
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Those two functions should, according to Linux man, be defined in unistd.h. We only include it if configure detected it. Could you check the configure output for the test result, and if it's negative, try to find out what we need to include instead for open and gethostname?
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

Configure finds gethostbyname...

Since that file exists multiple times, which file does it use?

# find /usr -name unistd.h
/usr/include/sys/unistd.h
/usr/include/unistd.h

See /usr/include/unistd.h attached, remove .xml ;-)
Attachments
unistd.h.xml
(8.57 KiB) Downloaded 210 times
- bel
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

When it reports it has gethostbyname, it is checking whether it is available in a library, not in a header. Please look explicitly for the check for unistd.h. Best to send over config.log.

The header looks fine for our purposes (with both functions present), and yes, it's the right one. .../sys/unistd.h is not directly included by us.
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

config.log

Edit: Hab gerade mal nach BSD durch den Sourcecode gesucht, danke für die vielen Credits *g*
Attachments
config.log.tar.gz
(6.46 KiB) Downloaded 305 times
- bel
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

*bump*

any ideas?
- bel
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Hmm, config.log says unistd.h was found on your system. Can I see config.h resp aa_config.h? This is really strange.
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

config.h

where is aa_config.h located?
Attachments
config.h.tar.gz
(1.55 KiB) Downloaded 285 times
- bel
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Nowhere, I guess. I just remember some talk about config.h being renamed to aa_config.h, but of course, that doesn't affect 0.3.0, only versions from the current trunk.

Whoops. Edit nSocket.cpp, find the line

Code: Select all

// #include <unistd.h>
and uncomment it. SVN blame says that was me fixing some cross compilation issues.
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

Gmake gets past that now but getting new error...

Code: Select all

g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/local/include/libxml2 -I/usr/local/inc                                                                              lude   -I./tools -I. -I.. -O2 -Wno-long-long -I/usr/X11R6/include -c -o libtools                                                                              _a-tArray.o `test -f 'tools/tArray.cpp' || echo './'`tools/tArray.cpp
g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/local/include/libxml2 -I/usr/local/inc                                                                              lude   -I./tools -I. -I.. -O2 -Wno-long-long -I/usr/X11R6/include -c -o libtools                                                                              _a-tCallback.o `test -f 'tools/tCallback.cpp' || echo './'`tools/tCallback.cpp
g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/local/include/libxml2 -I/usr/local/inc                                                                              lude   -I./tools -I. -I.. -O2 -Wno-long-long -I/usr/X11R6/include -c -o libtools                                                                              _a-tConfiguration.o `test -f 'tools/tConfiguration.cpp' || echo './'`tools/tConf                                                                              iguration.cpp
g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/local/include/libxml2 -I/usr/local/inc                                                                              lude   -I./tools -I. -I.. -O2 -Wno-long-long -I/usr/X11R6/include -c -o libtools                                                                              _a-tConsole.o `test -f 'tools/tConsole.cpp' || echo './'`tools/tConsole.cpp
g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/local/include/libxml2 -I/usr/local/inc                                                                              lude   -I./tools -I. -I.. -O2 -Wno-long-long -I/usr/X11R6/include -c -o libtools                                                                              _a-tCrypt.o `test -f 'tools/tCrypt.cpp' || echo './'`tools/tCrypt.cpp
Generating universal_variable_values_sed...
sed -f ../universal_variable_values_sed < tUniversalVariables.h.in > tUniversalV                                                                              ariables.h
g++ -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/local/include/libxml2 -I/usr/local/inc                                                                              lude   -I./tools -I. -I.. -O2 -Wno-long-long -I/usr/X11R6/include -c -o libtools                                                                              _a-tDirectories.o `test -f 'tools/tDirectories.cpp' || echo './'`tools/tDirector                                                                              ies.cpp
tools/tDirectories.cpp: In function `char* eh_getdir(const char*, size_t*)':
tools/tDirectories.cpp:457: error: `getuid' undeclared (first use this
   function)
tools/tDirectories.cpp:457: error: (Each undeclared identifier is reported only
   once for each function it appears in.)
gmake[3]: *** [libtools_a-tDirectories.o] Error 1
gmake[3]: Leaving directory `/opt/source/armagetronad-0.3.0/src'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/opt/source/armagetronad-0.3.0/src'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/opt/source/armagetronad-0.3.0'
gmake: *** [all] Error 2
- bel
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

There's two more removed includes of unistd.h in src/tools/tError.h and src/tools/tSafePTR.h. But before you go and fix them, could you compile with make -k and report all the files with errors? These two headers really shouldn't include unistd.h, it should be done where its contents are needed, and looking for compile errors is the quickest way to idientify where that is :)
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

Ok, I've redirected output of "gmake -k" to stdout into a file and you can see it in the attachmenz, stderr is this:

Code: Select all

tools/tDirectories.cpp: In function `char* eh_getdir(const char*, size_t*)':
tools/tDirectories.cpp:457: error: `getuid' undeclared (first use this
   function)
tools/tDirectories.cpp:457: error: (Each undeclared identifier is reported only
   once for each function it appears in.)
gmake[3]: *** [libtools_a-tDirectories.o] Error 1
tools/tSysTime.cpp: In function `void tDelay(int)':
tools/tSysTime.cpp:227: error: `usleep' undeclared (first use this function)
tools/tSysTime.cpp:227: error: (Each undeclared identifier is reported only
   once for each function it appears in.)
tools/tSysTime.cpp: In function `void tDelayForce(int)':
tools/tSysTime.cpp:236: error: `usleep' undeclared (first use this function)
gmake[3]: *** [libtools_a-tSysTime.o] Error 1
gmake[3]: Target `all-am' not remade because of errors.
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Target `all' not remade because of errors.
gmake[1]: *** [all-recursive] Error 1
gmake: *** [all] Error 2
Attachments
aa_gmake-k.out.tar.gz
(3.93 KiB) Downloaded 266 times
- bel
User avatar
Z-Man
God & Project Admin
Posts: 11710
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Post by Z-Man »

Good, only two files, and the manpages say the missing functions are from unistd.h. This must be included automatically over some other header in Linux.

You can either include

Code: Select all

#include <unistd.h>
in src/tools/tDirectories.cpp and src/tools/tSysTime.cpp, or uncomment the include statement in tError.h and tSafePTR.h. Your choice.
User avatar
belenus
Round Winner
Posts: 269
Joined: Wed Nov 30, 2005 6:22 pm
Location: Cologne
Contact:

Post by belenus »

New error after uncommenting those two lines. Any way to turn this httpd stuff off? Well, in the long run its probably better to find the error even if I am not sure why AA need its own httpd server...

stderr:

Code: Select all

thirdparty/shttpd/libshttpd.a(libshttpd_a-shttpd.o)(.text+0x62f): In function `mystrdup':
/opt/source/armagetronad-0.3.0/src/thirdparty/shttpd/shttpd.c:808: warning: strcpy() is almost always misused, please use strlcpy()
/usr/local/lib/libxml2.so.9.3: warning: strcat() is almost always misused, please use strlcat()
thirdparty/shttpd/libshttpd.a(libshttpd_a-shttpd.o)(.text+0x110): In function `do_thread':
/opt/source/armagetronad-0.3.0/src/thirdparty/shttpd/shttpd.c:510: undefined reference to `pthread_exit'
thirdparty/shttpd/libshttpd.a(libshttpd_a-shttpd.o)(.text+0x18a): In function `do_embedded':
/opt/source/armagetronad-0.3.0/src/thirdparty/shttpd/shttpd.c:589: undefined reference to `pthread_create'
thirdparty/shttpd/libshttpd.a(libshttpd_a-shttpd.o)(.text+0x193):/opt/source/armagetronad-0.3.0/src/thirdparty/shttpd/shttpd.c:590: undefined reference to `pthread_detach'
collect2: ld returned 1 exit status
gmake[3]: *** [armagetronad_main] Error 1
gmake[3]: Target `all-am' not remade because of errors.
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Target `all' not remade because of errors.
gmake[1]: *** [all-recursive] Error 1
gmake: *** [all] Error 2
- bel
User avatar
Lucifer
Project Developer
Posts: 8742
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas

Post by Lucifer »

Those are linker errors now, you need to add something to $LIBS, the library that contains those functions. I thought they were part of the standard c library....

Umm, when we have scripting, I'll be looking at removing the C++ web server and substituting it with a scripted web server instead. It's primarily to give servers their own resource server and an admin interface that doesn't exist yet, and would be better in a script anyway (which is my long term plan).
Check out my YouTube channel: https://youtube.com/@davefancella?si=H--oCK3k_dQ1laDN

Be the devil's own, Lucifer's my name.
- Iron Maiden
Post Reply