Help interpreting a linker error? (c++)

Sepherosa Ziehau sepherosa at gmail.com
Wed Jan 17 17:38:49 PST 2007


On 1/18/07, walt <wa1ter at myrealbox.com> wrote:
I just updated my -CURRENT machine, so lots of things have changed,
and I normally have trouble debugging linker errors anyway :o(
My problem is with pkgsrc/sysutils/fam:

Listener.o(.text+0x80): In function `Listener::Listener(bool, bool, unsigned
long, unsigned long)':
: undefined reference to `socket(int, int, int)'
When I do 'nm Listener.o' I see this line:
 U _Z6socketiii
Is that the symbol the linker is complaining about?  Does the 'iii' stand
for (int, int, int)?
AFAICT, socket() is defined in libc, right?  If socket() is defined in libc,
then why should the linker have trouble finding it?  (Well, libc does *not*
define _Z6socketiii, I'm almost certain.)
Also, can anyone running the latest HEAD reproduce this error?
Sorry, my fault.  Please test the attached patch.

Best Regards,
sephe
--
Live Free or Die
--- socket.h.orig	2007-01-18 09:29:41.842066274 +0800
+++ socket.h	2007-01-18 09:29:32.097235497 +0800
@@ -474,7 +474,13 @@
 #endif /* !_KERNEL */
 
 #if !defined(_KERNEL) || defined(_KERNEL_VIRTUAL)
+#ifndef _SYS_CDEFS_H_
+#include <sys/cdefs.h>
+#endif
+
+__BEGIN_DECLS
 int	socket (int, int, int);
+__END_DECLS
 #endif	/* !_KERNEL || _KERNEL_VIRTUAL */
 
 #endif /* !_SYS_SOCKET_H_ */




More information about the Users mailing list