From: Steve O. <oc...@nc...> - 2007-10-03 23:59:54
|
On 3 Oct 2007 at 4:21, Mij wrote: Date sent: Wed, 03 Oct 2007 04:21:07 +0200 From: Mij <mi...@bi...> Subject: Re: [Sshguard-users] help needed building sshguard to use ip filter on solaris 8 To: ssh...@li... Send reply to: ssh...@li... > > On 02/ott/07, at 21:48, Steve Ochani wrote: > > > Hi, > > > > That worked but now I'm getting linker errors. > > > > gcc -I. -O2 -o sshguard sshguard.o sshguard_whitelist.o > > sshguard_log.o > > sshguard_procauth.o simclist.o attack_parser.o attack_scanner.o > > fwalls/libfwall.a -lpthread Undefined first > > referenced > > symbol in file > > _Exit sshguard_procauth.o > > gethostbyname2 attack_parser.o > > unsetenv fwalls/libfwall.a(command.o) > > gethostbyname sshguard_whitelist.o setenv > > fwalls/libfwall.a(command.o) hstrerror > > attack_parser.o inet_pton > > sshguard_whitelist.o inet_ntop > > attack_parser.o h_errno attack_parser.o > > ld: fatal: Symbol referencing errors. No output written to sshguard > > collect2: ld returned 1 exit status make[3]: *** [sshguard] Error 1 > > make[3]: Leaving directory `/export/home/steve/ipf/ > > sshguard-1.1beta3/sshguard-1.1beta3/src' make[2]: *** > > [all-recursive] Error 1 make[2]: Leaving directory > > `/export/home/steve/ipf/ sshguard-1.1beta3/sshguard-1.1beta3/src' > > make[1]: *** [all] Error 2 make[1]: Leaving directory > > `/export/home/steve/ipf/ sshguard-1.1beta3/sshguard-1.1beta3/src' > > make: *** [all-recursive] Error 1 > > > > > > I went into src directory and tried: (added -lnsl -lresolv) > > > > gcc -I. -O2 -o sshguard sshguard.o sshguard_whitelist.o ssh > > uard_log.o sshguard_procauth.o simclist.o attack_parser.o > > attack_scanner.o fwal s/libfwall.a -lpthread -lnsl -lresolv > > > > but still get some linker errors > > > > gcc -I. -O2 -o sshguard sshguard.o sshguard_whitelist.o ssh > > uard_log.o sshguard_procauth.o simclist.o attack_parser.o > > attack_scanner.o fwal s/libfwall.a -lpthread -lnsl -lresolv > > Undefined first referenced > > symbol in file > > _Exit sshguard_procauth.o > > gethostbyname2 attack_parser.o > > unsetenv fwalls/libfwall.a(command.o) > > setenv fwalls/libfwall.a(command.o) ld: > > fatal: Symbol referencing errors. No output written to sshguard > > collect2: ld returned 1 exit status > > > > > > BTW I'm using gcc 3.4.2 > > > I answered this same problem in the past for a guy who contacted me > privately. I will publish this in the FAQ if you confirm this fixes > the problem, as soon as I have a moment. Here is the answer: > I thought someone might have had the same problem and tried looking for a searchable archive of this list but couldn't find one. > > the easiest is bypassing automake and compiling it manually. > > Basically solaris doesn't include anything in default library search > path so you have to specify all manually. Moreover google tells me > solaris has not setenv() but only putenv(), so you have to make a > minor edit to the source file. (I will not move the main tree to this > one has it has been marked deprecated by POSIX) > > edit src/fwall/command.c, search for "setenv(COMMAND_ENVNAME_ADDR, > addr, 1)". Replace this with "putenv(COMMAND_ENVNAME_ADDR, addr)" > (mind the missing 1!). Do this for thrice the setenv() lines, then > remove the "unsetenv" lines near below I got the error: command.c: In function `run_command': command.c:63: error: too many arguments to function `putenv' command.c:64: error: too many arguments to function `putenv' command.c:65: error: too many arguments to function `putenv' Looking up the details on putenv I see that it only takes one arg as a "name=value" pair. from "man putenv" and http://www.opengroup.org/onlinepubs/009695399/functions/putenv.html so i changed the lines to putenv(strcat(COMMAND_ENVNAME_ADDR,strcat("=",addr))); putenv(strcat(COMMAND_ENVNAME_ADDRKIND,strcat("=",addrks))); putenv(strcat(COMMAND_ENVNAME_SERVICE,strcat("=",servs))); > > Save and get back into the "src" directory (cd ..) > if you're using 1.3, edit sshguard_procauth.c and replace both _Exit > () calls with _exit(). done > > > then try compiling: run > > gcc -I. -O2 -o sshguard sshguard.o sshguard_whitelist.o > sshguard_log.o sshguard_procauth.o simclist.o attack_parser.o > attack_scanner.o fwalls/libfwall.a -lpthread -lsocket -lresolv -lnsl Did that and I get 1 linker error gcc -I. -O2 -o sshguard sshguard.o sshguard_whitelist.o sshguard_log.o sshguard_procauth.o simclist.o attack_parser.o attack_scanner.o fwalls/libfwall.a -lpthread - lsocket -lresolv -lnsl Undefined first referenced symbol in file gethostbyname2 attack_parser.o ld: fatal: Symbol referencing errors. No output written to sshguard collect2: ld returned 1 exit status Thanks -Steve O. |