From: Mij <mi...@bi...> - 2007-10-03 02:21:21
|
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: 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 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(). 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 if you get again problems with _exit(), try replacing with "exit ()" (then you will possibly have some segfaults when exiting, but they're harmless) |