[uClibc]Fwd: OpenSSH problems

Valera valeriy at levsha.ru
Thu Oct 31 07:11:44 UTC 2002


Hello!

I have compiled together with library uClibc the following
components: busybox, tinylogin, firewall (iptables utilities), VLAN 802.1Q
utility, Dillon's Cron, ntpclient. All this works well.

But I can't compile OpenSSH (openssh_3.4p1) with uClibc.
For the information(inquiry): for construction uClibc-based system I
use Linux Slackware 8.0 and uClibc-0.9.15 wrapper.
I have executed all recommendations given by Erik Andersen in the
letter (see below) from October, 21 2002:

> There are several ways to approach solving this problem.  Step
> one is to make sure you have built and installed zlib into the
> directory where you are putting your shared libraries (in the
> above case, into ~/staging_dir).  This is the easy part.

> There are several possible ways to approach step two.  The
> easiest way to fix things up (assuming you built uClibc with
> SHARED_LIB_LOADER_PATH=/lib and are both building on and building
> for x86 systems) is to create a ld-uClibc.so.0 symlink
> in the /lib directory of your build system.

But these measures did not give desirable result.
In that letter Eric Andersen also has written:

> There is another (more difficult) solution that will also work
> even when cross-compiling or dealing with badly behaved configure
> scripts.  I can explain that if you need it....
What this solution?

Valery Demyanov.
--
                          mailto:valeriy at levsha.ru

===8<===========End of original message text===========
On Sun Oct 13, 2002 at 12:21:59PM -0500, Michael Shuler wrote:
> Thanks for getting it fixed so quickly!  Works great now!
[-----------snip--------------]
> FYI: Well it almost works great :)  There seems to be a problem with the openssh-3.4p1 configure
> script.  When I run it with the following it complains about 2 things....
> 
> ./configure --prefix=/software/BWWirelessRouter/openssh/openssh --without-shadow
> --disable-largefile --disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx
> --with-ssl-dir=/software/BWWirelessRouter/openssl/openssl
> 
> 
> snprintf is broken and my openssl headers/libs don't match.  I compiled openssl-0.9.6g (which now
> works thanks to your threads fix) and copied the lib files to /usr/i386-linux-uclibc/lib and the
> inlcude files to /usr/i386-linux-uclibc/include/openssl...
On Mon, 21 Oct 2002 14:37:41 -0600, Erik Andersen wrote:

Regarding the "Your snprintf() function is broken" problem, I've
had to do some guessing to track this one down, but I believe I
now have it figured out.  Here's the deal.  uClibc's snprintf
isn't broken -- your build environment is.  :-)  Here are the
relevant bits of what configure is doing when it chokes and
produces this message:

    configure:7686: checking whether snprintf correctly terminates long strings
    configure:7702: /home/andersen/CVS/buildroot/build/staging_dir/bin/i386-uclibc-gcc \
            -o conftest -g -O2 -Wall -Wpointer-arith -Wno-uninitialized   conftest.c -lutil -lz  >&5
    configure:7705: $? = 0
    configure:7707: ./conftest
    ./conftest: linked against GNU libc!
    configure:7710: $? = 150
    configure: program exited with status 150
    configure: failed program was:
    #line 7693 "configure"
    #include "confdefs.h"

    #include <stdio.h>
    int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}

    configure:7720: result: no
    configure:7726: WARNING: ****** Your snprintf() function is broken, complain to your vendor

The 'conftest' test program is partially linked vs uClibc, but
also partially linked vs GNU libc as well.  Here is what the
binary dependancies look like after replicating conftest
manually:

    $ ldd ./conftest
            libutil.so.0 => /home/andersen/staging_dir/lib/libutil.so.0 (0x0x40006000)
            libz.so => //usr/lib/libz.so (0x0x40008000)
            libc.so.0 => /home/andersen/staging_dir/lib/ld-uClibc.so.0 (0x0x40000000)
    ./conftest: linked against GNU libc!

So in this case (the way I was able to replicate your problem),
the system zlib is being linked into the test app, causing it to
barf.

There are several ways to approach solving this problem.  Step
one is to make sure you have built and installed zlib into the
directory where you are putting your shared libraries (in the
above case, into ~/staging_dir).  This is the easy part. 

There are several possible ways to approach step two.  The
easiest way to fix things up (assuming you built uClibc with
SHARED_LIB_LOADER_PATH=/lib and are both building on and building
for x86 systems) is to create a ld-uClibc.so.0 symlink
in the /lib directory of your build system.  In my case that
would be:

    $ cd /lib
    $ sudo ln -s /home/andersen/staging_dir/lib/ld-uClibc.so.0 ld-uClibc.so.0

(if you don't use sudo, run 'su -', but you need to make the link
as root or it won't work).

With the uClibc shared lib loader symlink in /lib pointing to the
real uClibc shared lib loader, all the compilation tests run by
configure will work as expected....

There is another (more difficult) solution that will also work
even when cross-compiling or dealing with badly behaved configure
scripts.  I can explain that if you need it....

Anyway, doing the above, (after compiling zlib and openssl) I was
able to compile a working openssh using uClibc in my buildroot
system:

    $ sudo chroot build/root/ /bin/sh
    [root at dillweed /]# which ssh
    /usr/bin/ssh
    [root at dillweed /]# ls -lh /usr/bin/ssh
    -rwxr-xr-x    1 default  default   217.3k Oct 17 08:09 /usr/bin/ssh
    [root at dillweed /]# ldd /usr/bin/ssh
            libutil.so.0 => /lib/libutil.so.0
            libz.so => /lib/libz.so
            libcrypto.so.0.9.6 => /lib/libcrypto.so.0.9.6
            libcrypt.so.0 => /lib/libcrypt.so.0
            libc.so.0 => /lib/libc.so.0
            libdl.so.0 => /lib/libdl.so.0
            /lib/ld-uClibc.so.0 => /lib/ld-uClibc.so.0
    [root at dillweed /]# wc -c /usr/bin/ssh /lib/libcrypto.so.0.9.6
     222512 /usr/bin/ssh
     732672 /lib/libcrypto.so.0.9.6
     955184 total
    [root at dillweed /]# ssh andersen at 10.10.10.1
    andersen at 10.10.10.1's password: 
    Linux winder 2.4.19-rmk2 #2 Mon Oct 7 02:18:16 MDT 2002 armv4l unknown

    No mail.

    [andersen at winder andersen]$ 

Unfortunately, openssl (libcrypto) is kindof huge.  I expect
staticly linking libcrypto into openssh may help shrink things... 

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--




-- 
Best regards,
 Valera                            mailto:valeriy at levsha.ru





More information about the uClibc mailing list