[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: creating statically linked binaries
From: |
Lumpkin, Buddy |
Subject: |
RE: creating statically linked binaries |
Date: |
Thu, 18 Apr 2002 15:37:57 -0600 |
Katherine,
First I would start by figuring out which library has the symbol your trying to
reference:
Using nm you can find which libraries contain open64 with nm <filename> | grep
Open64
Im betting that some how your linker isn't finding your pthread libraries. They
seem to have this function.
If you use the ugly hack that I posted a few months ago where you hack the
configure file, make sure when compiling that the arguments are passed as
expected. You'll notice that in my post, I gave one line of output where it
shows the fully qualified paths being linked in without the -L:
In this case, the static linking is implicit because it's just like writing a C
program comprised of several individual .c files, then compiling the .c files
to individual object files with $CC -c (creates .o files), and then compiling
and linking them all together on one line, i.e. gcc file1.o
file2.o file3.o main.c -o program
the .a file is just an archive of .o files. To see what I mean, run ar -x
libdb-3.3.a (substitute your library name).
---snip---
Here's the output of make compiling cfagent ...
gcc -g -O2 /usr/local/BerkeleyDB.3.3/lib/libdb-3.3.a
/usr/local/openssl/lib/libcrypto.a /usr/local/openssl/lib/libssl.a
-L/usr/local/lib -o cfagent cfagent.o do.o wrapper.o report.o client.o
process.o ifconf.o image.o item.o item-ext.o item-file.o 2Dlist.o globals.o
classes.o misc.o parse.o
edittools.o patches.o install.o link.o tidy.o filedir.o eval.o modes.o
chflags.o locks.o mount.o macro.o filenames.o varstring.o wildcard.o cfparse.o
comparray.o read.o checksums.o proto.o filters.o copy.o repository.o rotate.o
errors.o cflex.o net.o df.o log.o encrypt.o popen.o popen_def.o
sensible.o acl.o dce_acl.o nameinfo.o strategies.o -ll
/usr/local/BerkeleyDB.3.3/lib/libdb-3.3.a -lpthread
/usr/local/openssl/lib/libcrypto.a /usr/local/openssl/lib/libssl.a -lnsl
-lsocket -lm -lelf -lsec ../pub/libpub.a
---snip---
We really need an option to do this from the command line without the pain :)
Hope this helps,
--Buddy
-----Original Message-----
From: Morris, Katherine L. [mailto:X2KMORRI@southernco.com]
Sent: Thursday, April 18, 2002 1:14 PM
To: 'help-cfengine@gnu.org'
Subject: creating statically linked binaries
I'm attempting to compile 2.0.1 on Solaris 2.6 sun4m. I'm having a similar
problem as the folks that I found in the archives that had discussed this
before. Basically, my compile environment is much richer than my production
environment. I find that I need to be able to compile cfengine as stand
alone executables rather than being able to distribute BerkeleyDB4.0 and
openssl to all of my systems for two reasons:
1) It's easier to manage one set of executables across multiple platforms
and architectures than 3 different packages.
2) In the long run, there will be less disk space utilized by a slightly
fatter cfengine than to have all of the supporting packages installed
"properly".
My first attempt at setting LDFLAGS="-static" failed miserably. I then
tried the two suggestions that I found in the archives, but first let me say
that while I did attend "C++ for non-C programmers" I'm not a C++ programmer
by a long stretch (besides they didn't teach me anything about compile real
apps in that class anyway). ;))
At any rate, while I did manage to get a fatter executable, I have not been
able to get cfenvd to run on a system that does not have the libraries
installed.
First I tried:
http://groups.google.com/groups?hl=en&threadm=Pine.LNX.4.30.0112281017370.98
1-100000%40loco.packetpushers.com&rnum=1&prev=/groups%3Fq%3Dcfengine%2Bstati
c%2Bcompile%26hl%3Den%26selm%3DPine.LNX.4.30.0112281017370.981-100000%2540lo
co.packetpushers.com%26rnum%3D1
This did seem to make any difference for me at all... but now I'm realizing
I edited the Makefile rather than the configure file. I'll have to try this
one again...
This one gave me the fatter executable, but still won't run:
http://groups.google.com/groups?q=cfengine+static+compile&hl=en&selm=webwuvg
3mmw.fsf%40jlab.org&rnum=2
Here's the error:
ld.so.1: /opt/cfengine/sbin/cfenvd: fatal: relocation error: file
/opt/cfengine/sbin/cfenvd: symbol open64: referenced symbol not found
Killed
Any sage wisdom, advice would be greatly appreciated.
> Katherine Morris
> Solaris 8 Certified System Administrator
> Solaris 8 Certified Network Administrator
> Sprint E|Solutions
> @ Southern Company Services, Inc.
> x2kmorri@southernco.com
> Phone 8-506-2621
> Pager 770-660-1742
> Linc 404-717-6657
> katherine.l.morris@mail.sprint.com
>
>
_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://mail.gnu.org/mailman/listinfo/help-cfengine