[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Link problems compiling tool with shared=no
From: |
Clayton John |
Subject: |
Link problems compiling tool with shared=no |
Date: |
Wed, 22 Nov 2006 16:04:42 +0100 |
Hello all,
In order to move away from shared-object-hell, I wish to compile my
command line tool against the GNUstep static libs. I'm doing this on
an Ubuntu machine. I have at the end of this email listed two
problems, (a) and (b) - but first to describe the preparation and
steps I'm taking to get there...
Reading the make docs, it says that all I need to do is this:
make shared=no
Just a note here - the code compiles and links OK if I use the
defaults, i.e. shared=yes
When I use 'make shared=no', the linker fails with lots of errors.
Step by step, this is what I'm doing.
1. create a common library (fwCore.a), uses the following command
line as an example:
g++ -c -I.. -I../ACE_wrappers -static -Wextra -D_REENTRANT -
D_GNU_SOURCE -DACE_HAS_AIO_CALLS -DACE_HAS_EXCEPTIONS -
D__ACE_INLINE__ -DACE_HAS_ACE_TOKEN -DACE_HAS_ACE_SVCCONF -Wno-
unknown-pragmas -DTARGET_OS_LINUX -DTYPE_LONGLONG -Wno-multichar -
DACE_AS_STATIC_LIBS -g readWriteTools.cpp -o obj/readWriteTools.cppo
2. this links in the following way:
ar -r libfwCore.a <list of object files, ommited from this email>
please assume that the library is written to: /home/johnc/src/corelib/
libfwCore.a
3. now onto compilation of the GNUstep tool that makes use of
objective-c *and* this little static lib I've just built, it's file
are compiled in the following way:
(echo " Compiling file afile.m ...";gcc afile.m -c \
-MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -
DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -
D_REENTRANT -DGSWARN -DGSDIAGNOSE -g -O2 -fno-strict-aliasing -fgnu-
runtime -I/home/johnc/src -Wextra -Wno-unknown-pragmas -
DTARGET_OS_LINUX -DTYPE_LONGLONG -Wno-multichar -fconstant-string-
class=NSConstantString -I. -IGNUstep/Library/Headers -I/usr/local/lib/
GNUstep/Local/Library/Headers -I/usr/local/lib/GNUstep/Network/
Library/Headers -I/usr/lib/GNUstep/System/Library/Headers \
-o static_obj/afile.o)
4. when the link step runs, it does this:
(echo " Linking tool fwcld ...";gcc -static -rdynamic /home/johnc/src/
ACE_wrappers/lib/libACE.a /home/johnc/src/corelib/
libfwCore.a -fgnu-runtime -o static_obj/fwcld \
<list of object files, ommited>
-LGNUstep/Library/Libraries -L/usr/local/lib/
GNUstep/Local/Library/Libraries -L/usr/local/lib/GNUstep/Network/
Library/Libraries -L/usr/lib/GNUstep/System/Library/Libraries -L/usr/
lib/GNUstep/System/Library/Libraries -L/usr/lib/GNUstep/System/
Library/Libraries/gnu-gnu-gnu -L/usr/lib/GNUstep/System/Library/
Libraries -lstdc++ -lgnustep-base_s -lpthread -lobjc -lxslt -lxml2 -
lz -lm -lcallback -lavcall -ldl -lz -lm -lpthread )
I have a couple of problems with the link step.
Problem A) link errors such as this, I am not sure what this means or
what to do about it:
/usr/lib/GNUstep/System/Library/Libraries/libgnustep-base_s.a(objc-
load.o): In function `objc_load_module': warning: Using 'dlopen' in
statically linked applications requires at runtime the shared
libraries from the glibc version used for linking
Problem B) the linker fails to resolve symbols that I *know* are in
the fwCoreLib.a, e.g.
: afile.m:(.text+0x17b9): undefined reference to `dlog'
: afile.m:(.text+0x189a): undefined reference to `dlog'
: afile.m:(.text+0x18ae): undefined reference to `dlog'
: afile.m:(.text+0x1989): undefined reference to `dlog'
I've confirmed that dlog is contained in the fwCoreLib.a file as
follows:
address@hidden:~/src/corelib $ nm -C libfwCore.a | grep dlog
U dlog
dlog.o:
000000d9 T dlog
000000b7 T dlog_close
0000000d T dlog_init
00000000 d dlog_nonSyslogFile
00000020 b dlog_nonSyslogFilePath
00000004 b dlog_proxy_function_ptr
00000000 T dlog_set_proxy
00000004 d dlog_threshold
00000000 b dlog_useSyslog
000000d4 T dlog_write_sys_infos
U dlog
BUT, what's the
U dlog
doing there?
Any help is massively appreciated, maybe I'll learn something new
after all! :-)
Thanks,
John Clayton
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Link problems compiling tool with shared=no,
Clayton John <=