static compilation
Tony J. White
tjw at tjw.org
Tue Dec 25 05:02:32 EST 2001
I had the same problem compiling openssh-3.0.2p1 statically on Slackware 8.0.
The problem is caused by the redefinition of opterr, optind, and optopt in
openbsd-compat/getopt.c (previously defined in libc).
Here's how I was able to get it to build statically:
1. ./configure
2. edit openbsd-compat/getopt.c
45 //int opterr = 1, /* if error message should be printed */
46 // optind = 1, /* index into parent argv vector */
47 // optopt, /* character checked for validity */
48 int optreset; /* reset getopt */
3. edit openbsd-compat/Makefile
Added '-I/usr/include' to the CFLAGS variable.
4. edit Makefile
Added '-static' to the CC and LD variables
5. make
-Tony
>I'm currently running linux mandrake 8.0 and a redhat 7.1. I tried to
>compiled openssh 3.0 static without any succes, an error seems to appear in
>ssh.c, optreset declaration. Openssh 2.9 compiled statically without any
>problems: LDFLAGS=-static, CFLAGS=-static worked fine. Currently im no more
>able to compile it statically, the main error seems due to openbsd-compat..
>Of course if I dont use "-static" the compilation is okay.
>Does anyone have any ideas on how to compile cleanly OpenSSH, statically?
More information about the openssh-unix-dev
mailing list