Compiling a static openssh server

Boris Lenin boris.lenin123 at gmail.com
Mon Dec 29 00:12:38 EST 2014


Hello,

I'm trying to compile a static openssh-server, simply by running:

export LDFLAGS=-static
./configure
make sshd

but the linker shows the warnings I've quoted on the bottom of this mail.
The warnings say that I cannot use NSS functions when statically compiling.

This makes sshd not work because at runtime, every call to getpwnam returns
0.

Do you know a way to compile openssh statically?

Thank you.


the warnings:

(.text+0x11): warning: Using 'dlopen' in statically linked applications
requires at runtime the shared libraries from the glibc version used for
linking
groupaccess.o: In function `ga_init':
/home/john/Downloads/openssh-6.6p1/groupaccess.c:67: warning: Using
'getgrouplist' in statically linked applications requires at runtime the
shared libraries from the glibc version used for linking
session.o: In function `do_setusercontext':
/home/john/Downloads/openssh-6.6p1/session.c:1535: warning: Using
'initgroups' in statically linked applications requires at runtime the
shared libraries from the glibc version used for linking
groupaccess.o: In function `ga_init':
/home/john/Downloads/openssh-6.6p1/groupaccess.c:70: warning: Using
'getgrgid' in statically linked applications requires at runtime the shared
libraries from the glibc version used for linking
sshpty.o: In function `pty_setowner':
/home/john/Downloads/openssh-6.6p1/sshpty.c:211: warning: Using 'getgrnam'
in statically linked applications requires at runtime the shared libraries
from the glibc version used for linking
session.o: In function `do_setusercontext':
/home/john/Downloads/openssh-6.6p1/session.c:1539: warning: Using
'endgrent' in statically linked applications requires at runtime the shared
libraries from the glibc version used for linking
./libssh.a(misc.o): In function `secure_permissions':
/home/john/Downloads/openssh-6.6p1/misc.c:686: warning: Using 'getpwent' in
statically linked applications requires at runtime the shared libraries
from the glibc version used for linking
sshd.o: In function `main':
/home/john/Downloads/openssh-6.6p1/sshd.c:1666: warning: Using 'getpwnam'
in statically linked applications requires at runtime the shared libraries
from the glibc version used for linking
loginrec.o: In function `login_get_lastlog':
/home/john/Downloads/openssh-6.6p1/loginrec.c:308: warning: Using
'getpwuid' in statically linked applications requires at runtime the shared
libraries from the glibc version used for linking
sshd.o: In function `main':
/home/john/Downloads/openssh-6.6p1/sshd.c:1677: warning: Using 'endpwent'
in statically linked applications requires at runtime the shared libraries
from the glibc version used for linking
servconf.o: In function `add_one_listen_addr':
/home/john/Downloads/openssh-6.6p1/servconf.c:582: warning: Using
'getaddrinfo' in statically linked applications requires at runtime the
shared libraries from the glibc version used for linking
auth.o: In function `allowed_user':
/home/john/Downloads/openssh-6.6p1/auth.c:112: warning: Using 'getspnam' in
statically linked applications requires at runtime the shared libraries
from the glibc version used for linking
./libssh.a(canohost.o): In function `check_ip_options':
/home/john/Downloads/openssh-6.6p1/canohost.c:161: warning: Using
'getprotobyname' in statically linked applications requires at runtime the
shared libraries from the glibc version used for linking


More information about the openssh-unix-dev mailing list