On 7 Oct 2001, Niels Möller wrote: > In the 1.3.x versions, Btw: which version do you think is better to be used for hacking lsh to be able to run with uClibc, 1.2.x or 1.3.x? I'm doing my next tests with 1.3.4 as I assume it is newer.
I'm not able to compile 1.3.4 properly on my "normal" glibc-2.2.2 system; it stops here: ----------8<---------- gcc -DHAVE_CONFIG_H -I. -I/home/robert/embedded/lsh-1.3.4/src -I.. -I/home/robert/embedded/lsh-1.3.4/src -DLSH -D_GNU_SOURCE -I /home/robert/embedded/gmp-2.0.2 -I/usr/X11R6/include -g -O2 -ggdb3 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Waggregate-return -Wpointer-arith -Wbad-function-cast -Wnested-externs -c client_x11.c client_x11.c: In function `parse_display': client_x11.c:529: parse error before `char' client_x11.c:530: `end' undeclared (first use in this function) client_x11.c:530: (Each undeclared identifier is reported only once client_x11.c:530: for each function it appears in.) client_x11.c:501: warning: `num_length' might be used uninitialized in this function make[3]: *** [client_x11.o] Error 1 make[3]: Leaving directory `/home/robert/embedded/lsh-1.3.4/src' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/robert/embedded/lsh-1.3.4/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/robert/embedded/lsh-1.3.4' make: *** [all-recursive-am] Error 2 robert@callisto:~/embedded/lsh-1.3.4 ! ---------->8---------- Moving the declaration of 'char *end' to the beginning of parse_display() fixes the problem. After removing all the empty addprefix() calls from the Makefile in src/testsuite 1.3.4 compiles fine with glibc-2.2.2. Oops, a first test (generating a key with lsh-keygen, starting lshd and connecting with openssh) works, but results in a lshd: Protocol error: Unexpected EOF The daemon just prints this line when I 'exit' from the ssh connection. === Back to our problem with argp_parse: > So argp_parse is the symbol that is defined. Makes sense. But however, it doesn't work this way. After the linker breaks down with an error (I'm now using 1.3.4!) argp_parse is indeed not being defined: ----------8<---------- gcc -g -O2 -ggdb3 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Waggregate-return -Wpointer-arith -Wbad-function-cast -Wnested-externs -o argp-test argp-test.o libargp.a argp-test.o: In function `main': /home/robert/embedded/lsh-1.3.4-rs/src/argp/argp-test.c:256: undefined reference to `argp_parse' collect2: ld returned 1 exit status make: *** [argp-test] Error 1 robert@callisto:~/embedded/lsh-1.3.4-rs/src/argp ! ---------->8---------- now: ----------8<---------- robert@callisto:~/embedded/lsh-1.3.4-rs/src/argp ! nm -n argp-parse.o | grep argp_parse U __argp_parse ---------->8---------- This looks terribly like the #define magic doesn't work... but why? I tested the mechanism with this little test code in argp-namefrob.h: ----------8<---------- [...] #if !_LIBC /* This code is written for inclusion in gnu-libc, and uses names in the namespace reserved for libc. If we're not compiling in libc, define those names to be the normal ones instead. */ /* test code starts here */ #undef __foo #define __foo foo /* end of test code */ /* argp-parse functions */ #undef __argp_parse [...] ---------->8---------- and this one in argp-parse.c: ----------8<---------- [...] #include "argp.h" #include "argp-namefrob.h" /* test code starts here */ void __foo(void); void foo(void); void __foo(void) { } /* end of test code */ ---------->8---------- This should be exactly the same as what happens with argp_parse. But in contrast to this the test code works: ----------8<---------- robert@callisto:~/embedded/lsh-1.3.4-rs/src/argp ! \ nm -n argp-parse.o | grep foo 00000000 T foo ---------->8---------- So I have again not the slightest idea what's the reason of the problem... > Now I'm confused. Do you mean "SIZE_INT" or "SIZEOF_INT"? Oops, sorry, a typo. SIZEOF_INT was correct. > SIZEOF_INT should be defined in config.h, with a value provided by the > > AC_CHECK_SIZEOF(int, 4) > > test in configure.in. The toplevel config.h has defines for SIZEOF_[INT|LONG|SHORT], but without any value. > What's libnsl? On Solaris it's the nameservice library, but I've never > encountered any linux installation that have that. Well, libnsl is part of glibc, and lsh seems to link against it: ----------8<---------- robert@callisto:~/embedded/lsh-1.3.4-works/src ! ldd lshd libutil.so.1 => /lib/libutil.so.1 (0x40025000) libnsl.so.1 => /lib/libnsl.so.1 (0x40028000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x4003f000) libc.so.6 => /lib/libc.so.6 (0x4006d000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) ---------->8---------- > My guess is that libnsl is something you don't want to link with. You > could try replacing the > > AC_CHECK_LIB(nsl, gethostbyname) > > check in configure.in with > > AC_SEARCH_LIBS(gethostbyname, nsl) I've tried to change that, in my hacked-up 1.2.5 version, but at the moment I assume that I have to solve the argp-problem first. Most of the stuff compiles now with my uggly hack, but it fails at the very last linking stage: ----------8<---------- make[3]: Entering directory `/home/robert/embedded/lsh-1.2.5-rs/src' gcc -g -O2 -ggdb3 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Waggregate-return -Wpointer-arith -Wbad-function-cast -Wnested-externs -L /home/robert/embedded/gmp-2.0.2 -o lsh lsh.o liblsh.a symmetric/libsymmetric.a argp/libargp.a -lutil -lcrypt -lgmp liblsh.a(client.o): In function `client_argp_parser': /home/robert/embedded/lsh-1.2.5-rs/src/client.c:879: undefined reference to `argp_usage' /home/robert/embedded/gmp-2.0.2/libgmp.a(set_str.o): In function `digit_value_in_base': /home/robert/embedded/gmp-2.0.2/mpz/set_str.c:38: undefined reference to `__ctype_b' /home/robert/embedded/gmp-2.0.2/mpz/set_str.c:40: undefined reference to `__ctype_b' /home/robert/embedded/gmp-2.0.2/mpz/set_str.c:42: undefined reference to `__ctype_b' /home/robert/embedded/gmp-2.0.2/libgmp.a(set_str.o): In function `mpz_set_str': /home/robert/embedded/gmp-2.0.2/mpz/set_str.c:71: undefined reference to `__ctype_b' /home/robert/embedded/gmp-2.0.2/mpz/set_str.c:108: undefined reference to `__ctype_b' collect2: ld returned 1 exit status make[3]: *** [lsh] Error 1 make[3]: Leaving directory `/home/robert/embedded/lsh-1.2.5-rs/src' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/robert/embedded/lsh-1.2.5-rs/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/robert/embedded/lsh-1.2.5-rs' make: *** [all-recursive-am] Error 2 robert@callisto:~/embedded/lsh-1.2.5-rs ! ---------->8---------- Robert -- +--------------------------------------------------------+ | Dipl.-Ing. Robert Schwebel | | Linux Solutions for Science and Industry | | Braunschweiger Straße 79, 31134 Hildesheim, Germany | | Phone: +49-5121-28619-0 Fax: +49-5121-28619-4 | +--------------------------------------------------------+