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
On Sun, Dec 28, 2014 at 8:12 AM, Boris Lenin <boris.lenin123 at gmail.com> wrote: [...]> Do you know a way to compile openssh statically? >Link against a libc that better supports static compiling? I've use uclibc for this in the past. -- Darren Tucker (dtucker at zip.com.au) GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69 Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.
Thanks for the answer! This means I also have to re-compile zlib and openssl right? On Sun, Dec 28, 2014 at 6:27 PM, Darren Tucker <dtucker at zip.com.au> wrote:> On Sun, Dec 28, 2014 at 8:12 AM, Boris Lenin <boris.lenin123 at gmail.com> > wrote: > [...] > >> Do you know a way to compile openssh statically? >> > > Link against a libc that better supports static compiling? I've use > uclibc for this in the past. > > -- > Darren Tucker (dtucker at zip.com.au) > GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69 > Good judgement comes with experience. Unfortunately, the experience > usually comes from bad judgement. >