SW:Fote 2.1 compilation on Solaris 10(SPARC)

Posted by JanusFarsythe on Sat 05 Jul 2008 03:54 AM — 3 posts, 13,785 views.

Canada #0
After a bit of struggling to correct code for this OS(proper library for DIR is <dirent.h>) it compiles without issue. However, after compilation, the build chokes when linking.

make -s swr
Undefined                       first referenced
 symbol                             in file
bind                                o/comm.o
recv                                o/comm.o
send                                o/comm.o
getservbyname                       o/comm.o
accept                              o/comm.o
listen                              o/comm.o
gethostbyaddr                       o/comm.o
gethostbyname                       o/comm.o
socket                              o/comm.o
setsockopt                          o/comm.o
inet_ntoa                           o/comm.o
ld: fatal: Symbol referencing errors. No output written to swr
collect2: ld returned 1 exit status
make[1]: *** [swr] Error 1
make: *** [all] Error 2


Anyone have any ideas in getting this built on this system?
Australia Forum Administrator #1
These all look like network functions, so it looks like you haven't linked against the network library. The way to find its name is to do "man (function)" asking about one of the missing functions.

eg.



$ man gethostbyaddr


GETHOSTBYNAME(3)         BSD Library Functions Manual         GETHOSTBYNAME(3)

NAME
     endhostent, gethostbyaddr, gethostbyname, gethostbyname2, gethostent, herror,
     hstrerror, sethostent -- get network host entry

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <netdb.h>
...


The line in bold says which library it is in, so you should have -lc in your Makefile on the line that does the linking. Or in your case, whatever library is listed.

I notice inside the Makefile are the following lines:


# Uncomment the two lines below if compiling on a Solaris box
#SOLARIS_FLAG = -Dsun -DSYSV
#SOLARIS_LINK = -lnsl -lsocket


As you are compiling on Solaris, did you uncomment those two lines?

Canada #2
I had to add the compile flags and linker options manually, as for some reason, the 2.1.3 makefile doesn't have the solaris flag options mentioned in your post. After a make purge and a make clean, it builds fine. Thanks for the information on that.