Bug 1052 - Static Compile of 4.1.pl1 fails on Solaris 9
Summary: Static Compile of 4.1.pl1 fails on Solaris 9
Status: CLOSED INVALID
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Build system (show other bugs)
Version: 4.1p1
Hardware: UltraSPARC Solaris
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-04 04:41 AEST by Mark Reis
Modified: 2006-10-07 11:40 AEST (History)
0 users

See Also:


Attachments
Config.log (436.87 KB, text/plain)
2005-06-04 04:59 AEST, Mark Reis
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Reis 2005-06-04 04:41:18 AEST
Hello, I'm really at a loss here trying to compile openssh4.1pl1 statically on
my Solaris box. Dynamically compiling with the same flags works (removing -static). 

I'm using gcc 3.3.0 and openssl 0.9.7g. I'll attach the entire config log later.
Please let me know if I can provide any additional information.

<Script used to call configure>

export CFLAGS="-I/usr/cs/lib:/usr/lib"
export CPPFLAGS="-I/usr/cs/lib:/usr/lib"
export LD_LIBRARY_PATH=/usr/cs/lib:/usr/lib
./configure LD_LIBRARY_PATH=/usr/cs/lib:/usr/lib --prefix=/usr/cs/testing
--with-zlib=/usr/cs/testing/lib/ --with-ssl-dir=/usr/cs/ssl
--with-ldflags="-static -lnsl"

</Script>


<Configure Messages>
....
checking whether snprintf correctly terminates long strings... yes
checking whether system supports SO_PEERCRED getsockopt... no
checking whether getpgrp requires zero arguments... yes
configure: error: *** Can't find recent OpenSSL libcrypto (see config.log for
details) ***

</Messages>

<Listing of openssl libs>
ls -al /usr/cs/lib | grep libcrypto.a
-rw-r--r--   1 root      2059764 May 16 17:30 libcrypto.a
</Listing>

<Excerpt of Config.log>

configure:13908: gcc -o conftest -I/usr/cs/lib:/usr/lib -Wall -Wpointer-arith
-Wno-uninitialized -I/usr/local/ssl/include -I/usr/cs/testing/lib/
-I/usr/cs/lib:/usr/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib
-L/usr/cs/testing/lib/ -R/usr/cs/testing/lib/  -static -lnsl conftest.c -lcrypto
-lz -lsocket  >&5
Undefined                       first referenced
 symbol                             in file
endnetconfig                        /usr/lib/libsocket.a(_soutil.o)
getnetconfig                        /usr/lib/libsocket.a(_soutil.o)
setnetconfig                        /usr/lib/libsocket.a(_soutil.o)
ld: fatal: Symbol referencing errors. No output written to conftest
collect2: ld returned 1 exit status
configure:13914: $? = 1
configure: failed program was:
</Config.log>
Comment 1 Tim Rice 2005-06-04 04:56:38 AEST
Why are you are using --with-ssl-dir=/usr/cs/ssl if your ssl libs
are in /usr/cs/lib?
Comment 2 Mark Reis 2005-06-04 04:59:17 AEST
(In reply to comment #1)
> Why are you are using --with-ssl-dir=/usr/cs/ssl if your ssl libs
> are in /usr/cs/lib?

The openssl is a split install where /usr/cs/ssl contains "certs, man, private"
and /usr/cs/lib contains the libs. I've also created symlinks for lib and
include in /usr/cs/ssl to point to /usr/cs in addition to changing that flag to
try /usr/cs and /usr/cs/lib. 
Comment 3 Mark Reis 2005-06-04 04:59:40 AEST
Created attachment 927 [details]
Config.log

Here is the configure log from a failed ./configure
Comment 4 Tim Rice 2005-06-04 05:50:36 AEST
(In reply to comment #2)
> The openssl is a split install where /usr/cs/ssl contains "certs, man,...

OpenSSH doesn't care where the ssl certs, etc. are. It only cares about
the libs and include files. So if the openssl libs are in /sr/cs/lib and
the includes are in /usr/cs/include, you would use --with-ssl-dir=/usr/cs

But now back to the real problem.
> Undefined                       first referenced
>  symbol                             in file
> endnetconfig                        /usr/lib/libsocket.a(_soutil.o)
> getnetconfig                        /usr/lib/libsocket.a(_soutil.o)
> setnetconfig                        /usr/lib/libsocket.a(_soutil.o)
> ld: fatal: Symbol referencing errors. No output written to conftest
> collect2: ld returned 1 exit status

Does Solaris 9 have /usr/lib/libnsl.a ?
Comment 5 Mark Reis 2005-06-04 06:22:27 AEST
Yes, it is there.

/usr/cs/src/openssh-4.1p1 ; ls -al /usr/lib | grep nsl
-rw-r--r--   1 root      1184388 Oct  9  2003 libnsl.a
lrwxrwxrwx   1 root           13 Jun 22  2004 libnsl.so -> ./libnsl.so.1
-rwxr-xr-x   1 root       743856 Oct  9  2003 libnsl.so.1
Comment 6 Tim Rice 2005-06-04 06:39:35 AEST
OK so track down which library has 
endnetconfig, getnetconfig, and setnetconfig in it.
You may find they don't exist in a static library.
Comment 7 Mark Reis 2005-06-04 07:05:03 AEST
Hrm..

The symbols look like they are in libnsl.a

/usr/cs/src/openssh-4.1p1 ; nm /usr/lib/libnsl.a | grep endnetconfig
0000011c T endnetconfig
         U endnetconfig
         U endnetconfig
         U endnetconfig
         U endnetconfig
         U endnetconfig
         U endnetconfig
         U endnetconfig
         U endnetconfig

/usr/cs/src/openssh-4.1p1 ; objdump -t /usr/lib/libnsl.a | grep -i setnetconfig
0000005c g     F .text  000000c0 setnetconfig
00000000       F *UND*  00000000 setnetconfig
00000000       F *UND*  00000000 setnetconfig
00000000       F *UND*  00000000 setnetconfig
00000000       F *UND*  00000000 setnetconfig
00000000       F *UND*  00000000 setnetconfig
00000000       F *UND*  00000000 setnetconfig
00000000       F *UND*  00000000 setnetconfig
00000000       F *UND*  00000000 setnetconfig

/usr/cs/src/openssh-4.1p1 ; objdump -t /usr/lib/libnsl.a | grep -i getnetconfig
00000574 l     F .text  00000260 fgetnetconfig
00000190 g     F .text  00000114 getnetconfig
000002a4 g     F .text  00000154 getnetconfigent
00000000       F *UND*  00000000 getnetconfig
00000000       F *UND*  00000000 getnetconfigent
00000000       F *UND*  00000000 getnetconfig
00000000       F *UND*  00000000 getnetconfigent
00000000       F *UND*  00000000 getnetconfig
00000000       F *UND*  00000000 getnetconfigent
00000000       F *UND*  00000000 getnetconfigent
00000000       F *UND*  00000000 getnetconfigent
00000000       F *UND*  00000000 getnetconfig
00000000       F *UND*  00000000 getnetconfigent
00000000       F *UND*  00000000 getnetconfigent
00000000       F *UND*  00000000 getnetconfig
00000000       F *UND*  00000000 getnetconfig
00000000       F *UND*  00000000 getnetconfig
00000000       F *UND*  00000000 getnetconfigent
00000000       F *UND*  00000000 getnetconfig
00000000       F *UND*  00000000 getnetconfigent
Comment 8 Darren Tucker 2005-06-04 10:45:48 AEST
To fix that particular problem, you just need to reverse the order of the
-lsocket and -lnsl.  ./configure --with-ldflags=-static --libs=-lnsl ought to do it.

It's likely that it still won't build, though, since static linking is not
supported by Sun:
http://www.sun.com/bigadmin/content/misc/solaris2faq.html#q6.24

$ cat test.c
char RAND_add();
int main()
{ RAND_add(); return 0; }

$ gcc test.c -L/usr/local/ssl/lib -static -lcrypto -lsocket -lnsl
/usr/lib/libnsl.a(netdir.o)(.text+0xdec): In function `load_xlate':
: undefined reference to `dlopen'
/usr/lib/libnsl.a(netdir.o)(.text+0xe20): In function `load_xlate':
: undefined reference to `dlsym'
[snip other dl* functions]

You may be able to fiddle with the linker flags to make it build, according to
the information at the URL and your requirements.  If you do then good luck to
you, however since static linking isn't supported by Sun it's not supported by
us either.
Comment 9 Darren Tucker 2005-07-14 14:36:12 AEST
Static linking isn't supported by the OS vendor so closing this bug.
Comment 10 Darren Tucker 2006-10-07 11:40:47 AEST
Change all RESOLVED bug to CLOSED with the exception of the ones fixed post-4.4.