Skip to contentSkip to conversation

compiling statically - how?

Openvpn-devel Tomasz Chmielewski 4 participants 4 messages Aug 4, 2004 – Aug 12, 2004

lore
Share & tools
lore
#0 lore raw

Hello,

OpenVPN is a great tool, however, whenever I persuade someone to using it, I'm having problems with installing it.

For example, one server is Debian 3.0, second RedHat 7.3, I compiled the binary somewhere else, and the effect is, it will only work on my machine, and not on Debian or Redhat, as OpenSSL libraries differ and so on.

So my big question is: can OpenVPN be compiled statically? If so, how?

I was thinking of an option like ./configure --compile-statically - and with such compiled binary, I wouldn't have to install compilers, compile OpenVPN, deinstall compilers on every machine I want it to run.

Regards,

Tomasz Chmielewski

----------------------------------------------------------------------
Laczysz sie przez modem? Mamy dla Ciebie bonusy!

Quoted 1 line
Quoted 1 line
Quoted 1 line

http://link.interia.pl/f1826

#1 lore raw
Quoted 3 lines · Tomasz Chmielewski

I was thinking of an option like ./configure --compile-statically - and with such compiled binary, I wouldn't have to install compilers, compile OpenVPN, deinstall compilers on every machine I want it to run.

My first attempt would probably be ./configure CC="gcc -static" - it's untested and may require the installation of static libraries on some systems.

Signature · 3 lines
Matthias Andree

Encrypted mail welcome: my GnuPG key ID is 0x052E7D95 (PGP/MIME preferred)
#2 lore raw
Quoted 9 lines · Matthias Andree
Quoted 3 lines · Tomasz Chmielewski

I was thinking of an option like ./configure --compile-statically - and with such compiled binary, I wouldn't have to install compilers, compile OpenVPN, deinstall compilers on every machine I want it to run.

My first attempt would probably be ./configure CC="gcc -static" - it's untested and may require the installation of static libraries on some systems.

I've had success with 'gcc -static' when static libraries are present, as they are by default on Gentoo Linux.

James

#3 lore raw
Quoted 8 lines · James Yonan
Quoted 6 lines · Matthias Andree
Quoted 3 lines · Tomasz Chmielewski

I was thinking of an option like ./configure --compile-statically - and with such compiled binary, I wouldn't have to install compilers, compile OpenVPN, deinstall compilers on every machine I want it to run.

Quoted 9 lines
Quoted 3 lines

My first attempt would probably be ./configure CC="gcc -static" - it's untested and may require the installation of static libraries on some systems.

I've had success with 'gcc -static' when static libraries are present, as they are by default on Gentoo Linux.

James

I compiled it statically on FC3t1 with this change in the openvpn.spec file:
--- cut ---

%configure \
        --enable-lzo \
        --enable-crypto \
        --enable-ssl \
        --enable-pthread \
        --enable-iproute2 \
        --enable-strict \
        --disable-profiling \
        --enable-mtu-dynamic \
        --enable-strict-options \
        --disable-dependency-tracking

# <Hack_for_static_build>
perl -i -p -e 's/^LDADD =/LDADD = -static -lssl -lcrypto -lkrb5 -lk5crypto -lresolv -lcom_err/' Makef ile
# </Hack_for_static_build>
%{__make} %{?_smp_mflags}
--- cut ---
It worked (openvpn --test-crypto --secret mysecret) on FC3t1, FC2, FC1 and Mandrake 8.2.

Signature · 4 lines
Regards,
  Doncho N. Gunchev    Registered Linux User #291323 at counter.li.org
  GPG-Key-ID: 1024D/DA454F79                        http://pgp.mit.edu
  Key fingerprint = 684F 688B C508 C609 0371  5E0F A089 CB15 DA45 4F79