What's an external relocation entry?
What's an external relocation entry?
- Subject: What's an external relocation entry?
- From: Malte Tancred <email@hidden>
- Date: Tue, 27 Nov 2001 14:48:31 +0100
I've tried to find information here on the list on compiling
static libraries on Mac OS X 10.1. I read something just the
other day stating that the tools depend on specific names
for different types of libraries, ie .a for static libraries and
.dyld for dynamic libraries.
Now, I'm trying to compile an open source product where
all c files are (by default) compiled with:
cc -c file.c
Many of these .o-files are grouped together in static libraries
with the commands:
ar cr library.a o-files...
ranlib library.a
Programs are then loaded by issuing the following command:
cc -s -o program program.o <other .o-files and .a-files>
This is the default setup that works just fine on for example
OpenBSD and slackware linux.
When running with this configuration (except for the -s option
which isn't supported on Mac OS X) I get the following warning
late in the build process, building one of several programs:
/usr/bin/ld: Undefined symbols:
_strerr_sys
/usr/bin/ld: warning unused multiple definitions of symbol _puts
ofmipd.o definition of _puts in section (__TEXT,__text)
/usr/lib/libSystem.dylib(puts.o) unused definition of _puts
strerr_sys is already compiled into one of the libraries and that
library's been used earlier on in the build process for another program.
Two things come to mind:
1. libSystem.dylib is a dynamic library. I'm compiling static libraries.
2. Mixing .o and .a files as source file for the linker might not work
as expected. Is the order a problem on Mac OS X.
I've tried adding -static to both the compile and link phase to make
sure everything is compiled statically. This results in the following
line:
/usr/bin/ld: can't locate file for: -lcrt0.o
Isn't it possible to compile statically linked programs on Mac OS X?
Any ideas welcome!
Cheerio,
Malte
--
Malte Tancred
Computer programmer, Oops AB, Sweden
mailto:email@hidden
http://www.oops.se/