Possible solution to glibc problem (again)

Tushar T tush at yahoo.com
Fri Oct 11 10:11:41 PDT 2002


Tushar T wrote:

> da02043 wrote:
>
>> A solution is to configure glibc with --enable-static-nss.  In this 
>> case you
>> can create a static binary that will use only the services dns and files
>> (change /etc/nsswitch.conf for this).  You need to link explicitly 
>> against
>> all these services. For example:
>>
>>  gcc -static test-netdb.c -o test-netdb \
>>    -Wl,--start-group -lc -lnss_files -lnss_dns -lresolv -Wl,--end-group
>
> The problem is that the glibc on the host distro won't have the static 
> glibc libraries (libnss_dns.a & libnss_files.a). So we need to compile 
> glibc-2.3 on the host distro (maybe with a different prefix, say 
> ~lfs). glibc-2.3 requires gcc-3.2, hence you will need to compile gcc 
> before glibc. And just to be safe, binutils. After doing all this if 
> you try to link bash against glibc-2.3, it starts complaining coz the 
> host ncurses is linked against a different glibc version that is not 
> compatible. So finally you end up installing lot of packages with 
> --prefix=~lfs before starting Chapter 5.

One solution that I can think of is to install the static version of 
glibc in with a prefix of ~lfs (lfs being the temporary user created in 
Ch 5). The version of glibc used should be the same as the version on 
the host. So for a glibc-2.2.5 system, we build glibc-2.2.5. That way we 
avoid having to compile lot of other packages like gcc, ncurses, etc. 
just to compile Ch. 5. Then for all packages in Ch 5 that are installed 
in $LFS/static, we link to static nss files as in the above example.

Think this will work?

I have a static version of glibc compiled, but am not very sure how to 
use the above example to compile Ch 5. Would setting LDFLAGS="-lc 
-lnss_files -lnss_dns -lresolv" work? or should I add 
CFLAGS="-Wl,--start-group -lc -lnss_files -lnss_dns -lresolv 
-Wl,--end-group"? If someone has an answer I would appreciate it, else 
will go 'google' in the gcc docs.

-- 
Tushar Teredesai
LFS ID: 1377
http://tushar.lfsforum.org/

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message



More information about the lfs-dev mailing list