Bug 211389 - [kdeinit4] ld: fatal: symbol referencing errors
Summary: [kdeinit4] ld: fatal: symbol referencing errors
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 4.3
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-22 00:15 UTC by Thorsten Hirsch
Modified: 2009-12-15 09:23 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thorsten Hirsch 2009-10-22 00:15:54 UTC
Version:            (using Devel)
Compiler:          gcc 3.4.3 SUNWgcc package
OS:                Solaris
Installed from:    Compiled sources

Linking fails due to "symbol referencing errors". I don't know why. The linker is:

$ ld --version
GNU ld (GNU Binutils) 2.19
Copyright 2007 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.


I've searched the whole web for this error. Most people get it, when some header file at compile time doesn't match the shared library at compile time. The header file is /usr/include/sys/socket.h and the corresponding shared lib is /lib/libsocket.so.1. The listed symbols in the error output are all available in the shared library, I checked it with nm. I have absolutely no idea what else could be wrong.

[...]
Scanning dependencies of target kdeinit_klauncher
[ 53%] Building CXX object kinit/CMakeFiles/kdeinit_klauncher.dir/kdeinit_klauncher_automoc.o
[ 53%] Building CXX object kinit/CMakeFiles/kdeinit_klauncher.dir/klauncher.o
[ 53%] Building CXX object kinit/CMakeFiles/kdeinit4.dir/proctitle.o
[ 53%] Building CXX object kinit/CMakeFiles/kdeinit4.dir/klauncher_cmds.o
Linking CXX executable ../bin/kdeinit4
ld: warning: file ../lib/libkdecore.so.5.4.0: attempted multiple inclusion of file
ld: warning: file /export/home/torti/qt/lib/libQtCore.so: attempted multiple inclusion of file
Undefined			first referenced
 symbol  			    in file
__xnet_connect                      CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
__xnet_socket                       CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
accept                              CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
listen                              CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
setsockopt                          CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
__xnet_socketpair                   CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
__xnet_bind                         CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
ld: fatal: symbol referencing errors. No output written to ../bin/kdeinit4
collect2: ld returned 1 exit status
make[2]: *** [bin/kdeinit4] Error 1
make[1]: *** [kinit/CMakeFiles/kdeinit4.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 53%] Building CXX object kinit/CMakeFiles/kdeinit_klauncher.dir/klauncher_main.o
[ 53%] Building CXX object kinit/CMakeFiles/kdeinit_klauncher.dir/klauncher_adaptor.o
[ 53%] Building CXX object kinit/CMakeFiles/kdeinit_klauncher.dir/autostart.o
[ 53%] Building CXX object kinit/CMakeFiles/kdeinit_klauncher.dir/klauncher_cmds.o
Linking CXX shared library ../lib/libkdeinit4_klauncher.so
ld: warning: file ../lib/libkdeui.so.5.4.0: attempted multiple inclusion of file
ld: warning: file ../lib/libkdecore.so.5.4.0: attempted multiple inclusion of file
ld: warning: file /export/home/torti/qt/lib/libQtCore.so: attempted multiple inclusion of file
[ 53%] Built target kdeinit_klauncher
make: *** [all] Error 2
Comment 1 Thorsten Hirsch 2009-10-27 21:28:06 UTC
Here's the output of truss (w/o ENOENT lines) for the c++/ld command that fails:

$ cat /tmp/truss.txt.no_enoent 
execve("/usr/sfw/bin/c++", 0x08047338, 0x080473B4)  argc = 30
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0) = 0xCFFB0000
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0) = 0xCFFA0000
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0) = 0xCFF90000
memcntl(0xCFFBD000, 29892, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
memcntl(0x08050000, 9552, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
resolvepath("/usr/lib/ld.so.1", "/lib/ld.so.1", 1023) = 12
resolvepath("/usr/sfw/bin/c++", "/usr/sfw/bin/c++", 1023) = 16
sysconfig(_CONFIG_PAGESIZE)			= 4096
stat64("/usr/sfw/bin/c++", 0x08046FBC)		= 0
open("/var/ld/ld.config", O_RDONLY)		= 3
fstat64(3, 0x08046B4C)				= 0
mmap(0x00000000, 128, PROT_READ, MAP_SHARED, 3, 0) = 0xCFF80000
close(3)					= 0
stat64("/lib/libc.so.1", 0x080467BC)		= 0
resolvepath("/lib/libc.so.1", "/lib/libc.so.1", 1023) = 14
open("/lib/libc.so.1", O_RDONLY)		= 3
mmapobj(3, MMOBJ_INTERPRET, 0xCFF909E8, 0x08046828, 0x00000000) = 0
close(3)					= 0
memcntl(0xCFE20000, 188836, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0) = 0xCFE10000
mmap(0x00010000, 24576, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xCFE00000
getcontext(0x08046E0C)
getrlimit(RLIMIT_STACK, 0x08046E04)		= 0
getpid()					= 3788 [3787]
lwp_private(0, 1, 0xCFE02A00)			= 0x000001C3
setustack(0xCFE02A60)
sysi86(SI86FPSTART, 0xCFF79034, 0x0000133F, 0x00001F80) = 0x00000001
brk(0x080760D0)					= 0
brk(0x080760D0)					= 0
brk(0x080780D0)					= 0
stat64("/usr/lib/locale/en_US.UTF-8/en_US.UTF-8.so.3", 0x080461E0) = 0
resolvepath("/usr/lib/locale/en_US.UTF-8/en_US.UTF-8.so.3", "/usr/lib/locale/en_US.UTF-8/en_US.UTF-8.so.3", 1023) = 44
open("/usr/lib/locale/en_US.UTF-8/en_US.UTF-8.so.3", O_RDONLY) = 3
mmapobj(3, MMOBJ_INTERPRET, 0xCFE106F0, 0x0804624C, 0x00000000) = 0
close(3)					= 0
memcntl(0xCF640000, 6624, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
stat64("/usr/lib/locale/en_US.UTF-8/methods_unicode.so.3", 0x080460D0) = 0
resolvepath("/usr/lib/locale/en_US.UTF-8/methods_unicode.so.3", "/usr/lib/locale/common/methods_unicode.so.3", 1023) = 43
open("/usr/lib/locale/en_US.UTF-8/methods_unicode.so.3", O_RDONLY) = 3
mmapobj(3, MMOBJ_INTERPRET, 0xCFE10DF0, 0x0804613C, 0x00000000) = 0
close(3)					= 0
mmap(0x00000000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0) = 0xCFDF0000
memcntl(0xCF620000, 3576, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
schedctl()					= 0xCFDE2000
sigaction(SIGINT, 0x080471B0, 0x08047230)	= 0
sigaction(SIGINT, 0x080471B0, 0x08047230)	= 0
sigaction(SIGHUP, 0x080471B0, 0x08047230)	= 0
sigaction(SIGHUP, 0x080471B0, 0x08047230)	= 0
sigaction(SIGTERM, 0x080471B0, 0x08047230)	= 0
sigaction(SIGTERM, 0x080471B0, 0x08047230)	= 0
sigaction(SIGPIPE, 0x080471B0, 0x08047230)	= 0
sigaction(SIGPIPE, 0x080471B0, 0x08047230)	= 0
sigaction(SIGCLD, 0x080471B0, 0x08047230)	= 0
brk(0x080780D0)					= 0
brk(0x0807A0D0)					= 0
brk(0x0807A0D0)					= 0
brk(0x0807C0D0)					= 0
resolvepath("/usr/bin/c++", "/usr/sfw/bin/c++", 1024) = 16
resolvepath("/usr/bin/c++", "/usr/sfw/bin/c++", 1024) = 16
access("/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/", X_OK) = 0
access("/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/", X_OK) = 0
access("CMakeFiles/kdeinit4.dir/kdeinit4_automoc.o", F_OK) = 0
access("CMakeFiles/kdeinit4.dir/kinit.o", F_OK)	= 0
access("CMakeFiles/kdeinit4.dir/proctitle.o", F_OK) = 0
access("CMakeFiles/kdeinit4.dir/klauncher_cmds.o", F_OK) = 0
access("/export/home/torti/qt/lib/libQtCore.so", F_OK) = 0
access("../lib/libkdecore.so.5.4.0", F_OK)	= 0
access("../lib/libkparts.so.4.4.0", F_OK)	= 0
access("../lib/libkio.so.5.4.0", F_OK)		= 0
access("/export/home/torti/qt/lib/libQtNetwork.so", F_OK) = 0
access("/export/home/torti/qt/lib/libQtXml.so", F_OK) = 0
access("../lib/libkdeui.so.5.4.0", F_OK)	= 0
access("../lib/libkdecore.so.5.4.0", F_OK)	= 0
access("/export/home/torti/qt/lib/libQtDBus.so", F_OK) = 0
access("/export/home/torti/qt/lib/libQtCore.so", F_OK) = 0
access("/export/home/torti/qt/lib/libQtSvg.so", F_OK) = 0
access("/export/home/torti/qt/lib/libQtGui.so", F_OK) = 0
access("/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/specs", R_OK) = 0
open("/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/specs", O_RDONLY) = 3
xstat(2, "/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/specs", 0x080471D0) = 0
brk(0x0807C0D0)					= 0
brk(0x0807E0D0)					= 0
read(3, " * a s m :\n - - t r a d".., 5628)	= 5628
close(3)					= 0
brk(0x0807E0D0)					= 0
brk(0x080800D0)					= 0
sysconfig(_CONFIG_PAGESIZE)			= 4096
access("/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/", X_OK) = 0
xstat(2, "/usr/sfw/libexec/gcc/i386-pc-solaris2.11/3.4.3/collect2", 0x08047150) = 0
access("/usr/sfw/libexec/gcc/i386-pc-solaris2.11/3.4.3/collect2", X_OK) = 0
xstat(2, "/usr/sfw/libexec/gcc/i386-pc-solaris2.11/3.4.3/.", 0x08047130) = 0
xstat(2, "/usr/sfw/libexec/gcc/i386-pc-solaris2.11/3.4.3/.", 0x08047130) = 0
xstat(2, "/usr/sfw/libexec/gcc/i386-pc-solaris2.11/.", 0x08047130) = 0
xstat(2, "/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/.", 0x08047130) = 0
xstat(2, "/usr/sfw/lib/gcc/i386-pc-solaris2.11/.", 0x08047130) = 0
xstat(2, "/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/.", 0x08047130) = 0
brk(0x080800D0)					= 0
brk(0x080820D0)					= 0
access("/usr/lib/crt1.o", R_OK)			= 0
access("/usr/lib/crti.o", R_OK)			= 0
access("/usr/lib/values-Xa.o", R_OK)		= 0
access("/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/crtbegin.o", R_OK) = 0
xstat(2, "/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/.", 0x08046230) = 0
xstat(2, "/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/../../../.", 0x08046230) = 0
access("/usr/sfw/lib/gcc/i386-pc-solaris2.11/3.4.3/crtend.o", R_OK) = 0
access("/usr/lib/crtn.o", R_OK)			= 0
xstat(2, "/usr/sfw/libexec/gcc/i386-pc-solaris2.11/3.4.3/collect2", 0x080470A0) = 0
access("/usr/sfw/libexec/gcc/i386-pc-solaris2.11/3.4.3/collect2", X_OK) = 0
forkx(0)					= 3789
lwp_sigmask(SIG_SETMASK, 0x00000000, 0x00000000) = 0xFFBFFEFF [0x0000FFFF]
ld: warning: file ../lib/libkdecore.so.5.4.0: attempted multiple inclusion of file
ld: warning: file /export/home/torti/qt/lib/libQtCore.so: attempted multiple inclusion of file
Undefined			first referenced
 symbol  			    in file
__xnet_connect                      CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
__xnet_socket                       CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
accept                              CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
listen                              CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
setsockopt                          CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
__xnet_socketpair                   CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
__xnet_bind                         CMakeFiles/kdeinit4.dir/kinit.o  (symbol belongs to implicit dependency /lib/libsocket.so.1)
ld: fatal: symbol referencing errors. No output written to ../bin/kdeinit4
collect2: ld returned 1 exit status
    Received signal #18, SIGCLD, in waitid() [default]
      siginfo: SIGCLD CLD_EXITED pid=3789 status=0x0001
waitid(P_PID, 3789, 0x080470D0, WEXITED|WTRAPPED) = 0
_exit(1)
Comment 2 Thorsten Hirsch 2009-12-14 22:46:55 UTC
Okay, now I know why. The file...

kde/build/KDE/kdelibs/kinit/CMakeFiles/kdeinit4.dir/link.txt

...is missing the entry...

-lsocket

...so the linker doesn't link against the socket library and that's why these symbols are finally not being resolved.

So my question is: why is -lsocket missing? Who's responsible for creating link.txt? I guess it's cmake, but I had the same problem with cmake 2.6.x and now I habe it with cmake 2.8.0. Maybe there's also some entry missing in a kde build system file...? Or has it something to do with pkg-config?
Comment 3 Andreas Pakulat 2009-12-14 23:12:23 UTC
Can you test wether it helps to add ${KINIT_SOCKET_LIBRARY} in line 47 of kdelibs/kinit/CMakeLists.txt after the ${kdeinit_LIBS}?

Patch would be:
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt      (revision 1062335)
+++ CMakeLists.txt      (working copy)
@@ -44,7 +44,7 @@
   kde4_add_executable(kdeinit4 NOGUI ${kdeinit_SRCS})
 endif (APPLE OR WIN32)

-target_link_libraries(kdeinit4 ${KDE4_KDECORE_LIBS} ${kdeinit_LIBS} )
+target_link_libraries(kdeinit4 ${KDE4_KDECORE_LIBS} ${kdeinit_LIBS} ${KINIT_SOCKET_LIBRARY} )
 if (Q_WS_X11)
   target_link_libraries(kdeinit4 ${X11_X11_LIB})
 endif(Q_WS_X11)
Comment 4 Thorsten Hirsch 2009-12-14 23:29:04 UTC
Yes, that's it! Thank you very much, Andreas!
Comment 5 Andreas Pakulat 2009-12-15 09:23:47 UTC
SVN commit 1062561 by apaku:

Fix linkage on systems where libsocket.so exists. kdeinit4 uses sockets, so
needs to link against the library.
BUG:211389


 M  +1 -1      CMakeLists.txt  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1062561