[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Chicken-users] chicken-static is not really static
From: |
Andrey Fomichev |
Subject: |
RE: [Chicken-users] chicken-static is not really static |
Date: |
Wed, 12 Jan 2005 17:09:01 +0300 |
Thank you for the detailed explanation, Peter.
It seems that chicken-static works fine on another Linux
machine after I link it following Felix's advice. But I have
my own program that I want to be "not a dynamic executable"
and it just uses gethostbyname() function. I already got the
warning from the linker about gethostbyname(). So, your
explanation is very helpful for me.
Best regards,
Andrey
> -----Original Message-----
> From: Peter Keller [mailto:address@hidden
> Sent: Wednesday, January 12, 2005 10:37 AM
> To: felix winkelmann
> Cc: Andrey Fomichev; address@hidden
> Subject: Re: [Chicken-users] chicken-static is not really static
>
>
> On Wed, Jan 12, 2005 at 07:55:22AM +0100, felix winkelmann wrote:
> > I take it you are trying to build a completely static version of the
> > compiler to move it do a different linux system, yes?
>
> Actually, there is more you need to do....
>
> Even though you've used -static on the link line and ldd will say "not
> a dynamic executable", it lies. :) Basically, if you ever make a call
> to something like gethostbyname(), then the glibc will manually dlopen
> the nss libraries and load shared segments which might or might not be
> available (or of the correct API version) on the target machine you've
> moved the binary too.
>
> In this case, the right solution is to download the version of
> glibc you have and configure it with "--enable-static-nss
> --enable-add-ons --disable-shared --without-cvs
> --prefix=/someplace/other/than/default/location" and make it
> (and then install it in the place you specified). You might need
> to seperately deal with the linuxthreads addon, it depends upon
> the revision of the glibc you'll need. When it is all finished, use
> -L/someplace/other/than/the/default/location before any other -L flags on
> the compile line and include -lnss_files -lnss_dns -lnss_ldap -lnss_nis
> -lresolve on the link line. This should ensure that your binary can use
> one of those protocols when moved to another machine.
>
> You don't have to do this, but if you do you'd gain the maximum
> compatibility
> between linux distributions. Yeah, I know it is a pain. Linux is like that
> sometimes.
>
> -pete