Skip to contentSkip to conversation

Compiling OpenVPN 2.1rc7

Openvpn-devel Diaa Sami 3 participants 12 messages Feb 16, 2008 – Feb 18, 2008

lore
Share & tools
lore

Diaa Sami

author
#0 lore raw

Hi,
I was compiling OpenVPN 2.1rc7 on Windows(MinGW) and I did it successfully after 2 days of trying.
This is a list of the issues I met, I thought I should tell you so that you can fix or mention them at least to make building easier:
* The current latest version of PKCS11-helper(which is 1.05) doesn't produce a DLL when compiled using MinGW, although the DLL is needed for building OpenVPN successfully, (I just used the DLL from the binary distribution so that the build will succeed without having to modify the installer)
* In the compilation command, although PKCS-helper depends on OpenSSL, it comes after it in the libraries(I had to fix this by modifying the makefile)
* After compiling OpenSSL 0.9.7m, it's necessary to copy all files matching incout\openssl\* to include\openssl\*
* The source tree must reside under the same drive as WINDDK(which is hardcoded as C:\)

Regards,
Diaa Sami

#1 lore raw

I can't help you with the none standard build system of OpenVPN and dependencies.
But I can help with the pkcs11-helper issue.

Can you please provide config.log of that build?

Alon.

Quoted 30 lines · Diaa Sami

Hi,
I was compiling OpenVPN 2.1rc7 on Windows(MinGW) and I did it successfully after 2 days of trying.
This is a list of the issues I met, I thought I should tell you so that you can fix or mention them at least to make building easier:
* The current latest version of PKCS11-helper(which is 1.05) doesn't produce a DLL when compiled using MinGW, although the DLL is needed for building OpenVPN successfully, (I just used the DLL from the binary distribution so that the build will succeed without having to modify the installer)
* In the compilation command, although PKCS-helper depends on OpenSSL, it comes after it in the libraries(I had to fix this by modifying the makefile)
* After compiling OpenSSL 0.9.7m, it's necessary to copy all files matching incout\openssl\* to include\openssl\*
* The source tree must reside under the same drive as WINDDK(which is hardcoded as C:\)

Regards,
Diaa Sami

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

author
#2 lore raw
Quoted 2 lines · Alon Bar-Lev

I can't help you with the none standard build system of OpenVPN and dependencies.

Why is this a non-standard build system, I thought it was. if it isn't then what's the standard build system for Windows?

Quoted 3 lines

But I can help with the pkcs11-helper issue.

Can you please provide config.log of that build?

please find it attached

Thanks

#3 lore raw
Quoted 6 lines · Diaa Sami
Quoted 2 lines · Alon Bar-Lev

I can't help you with the none standard build system of OpenVPN and dependencies.

Why is this a non-standard build system, I thought it was. if it isn't then what's the standard build system for Windows?

Should be one autoconf/automake for all platforms. But James rejects this.

Quoted 6 lines
Quoted 3 lines

But I can help with the pkcs11-helper issue.

Can you please provide config.log of that build?

please find it attached

I see nothing wrong here...
Can you please remove ac_cv_type_size_t=no and --disable-static from configure? And also end me the complete build log?

Thanks!
Alon.

author
#4 lore raw
Quoted 5 lines · Alon Bar-Lev

I see nothing wrong here...
Can you please remove ac_cv_type_size_t=no and --disable-static from configure? And also end me the complete build log?

I did and here are the new config.log and build output

#5 lore raw

Thanks!
I solved something similar to this using a cross compiler, with newer gcc than I used in msys.

Can you please try this one?
http://alon.barlev.googlepages.com/pkcs11-helper-1.06_beta1.tar.bz2

If it does not work, please provide a full build log again... The linker cannot find proper libraries.

Also, if I remember correctly, you need to reference the DLL and not the lib, modify:
OPENSSL_LIBS=-L/c/openvpn_job/openssl-0.9.7m-patched/out/ -leay32 -lssl32 to:
OPENSSL_LIBS=-L/c/openvpn_job/openssl-0.9.7m-patched/ -leay32 -lssl32

Thanks!

Quoted 10 lines · Diaa Sami
Quoted 5 lines · Alon Bar-Lev

I see nothing wrong here...
Can you please remove ac_cv_type_size_t=no and --disable-static from configure? And also end me the complete build log?

I did and here are the new config.log and build output

author
#6 lore raw

I tried this one but it's the same, no DLL is created even after linking with the DLLs instead of the the libs.

Here are the new config.log and build.log so you can find what's wrong.

Quoted 30 lines · Alon Bar-Lev

Thanks!
I solved something similar to this using a cross compiler, with newer gcc than I used in msys.

Can you please try this one?
http://alon.barlev.googlepages.com/pkcs11-helper-1.06_beta1.tar.bz2

If it does not work, please provide a full build log again... The linker cannot find proper libraries.

Also, if I remember correctly, you need to reference the DLL and not the lib, modify:
OPENSSL_LIBS=-L/c/openvpn_job/openssl-0.9.7m-patched/out/ -leay32 -lssl32 to:
OPENSSL_LIBS=-L/c/openvpn_job/openssl-0.9.7m-patched/ -leay32 -lssl32

Thanks!

Quoted 10 lines · Diaa Sami
Quoted 5 lines · Alon Bar-Lev

I see nothing wrong here...
Can you please remove ac_cv_type_size_t=no and --disable-static from configure? And also end me the complete build log?

I did and here are the new config.log and build output

#7 lore raw
Quoted 4 lines · Diaa Sami

I tried this one but it's the same, no DLL is created even after linking with the DLLs instead of the the libs.

Here are the new config.log and build.log so you can find what's wrong.

Thanks!
First, you don't need the -lssl32 for pkcs11-helper.

But it still does not find libeay32.dll...
Do you sure the openssl is built correctly?
Do you have libeay32.dll at "/c/openvpn_job/openssl-0.9.7m-patched"? What is the output of "file" command on libeay32.dll?

Alon.

author
#8 lore raw
Quoted 10 lines · Alon Bar-Lev
Quoted 4 lines · Diaa Sami

I tried this one but it's the same, no DLL is created even after linking with the DLLs instead of the the libs.

Here are the new config.log and build.log so you can find what's wrong.

Thanks!
First, you don't need the -lssl32 for pkcs11-helper.

But it still does not find libeay32.dll...

I think it's something with linking with DLLs, unfortunately I didn't do it before on MinGW
but on VC you only link to the import library not the DLL itself.

Quoted 1 line

Do you sure the openssl is built correctly?

Yes, because the static version of pkcs-helper builds successfully and I used it to build openvpn successfully.

Quoted 2 lines

Do you have libeay32.dll at "/c/openvpn_job/openssl-0.9.7m-patched"? What is the output of "file" command on libeay32.dll?

Yes, the output of file is Ok as far as I can see, it's ../openssl-0.9.7m-patched/libeay32.dll; MS-DOS executable PE for MS Windows (DLL) (console) Intel 80386 32-bit

#9 lore raw

I wish to reproduce this.
Can you please provide some instruction of how to do this?
1. Which EXACT version and platform of Windows are you using?
2. Which mingw version you are using, how did you installed it.
3. Which msys version are you using, how did you installed it.
4. How did you EXACTLY compile OpenSSL?

Thanks!

Quoted 28 lines · Diaa Sami
Quoted 10 lines · Alon Bar-Lev
Quoted 4 lines · Diaa Sami

I tried this one but it's the same, no DLL is created even after linking with the DLLs instead of the the libs.

Here are the new config.log and build.log so you can find what's wrong.

Thanks!
First, you don't need the -lssl32 for pkcs11-helper.

But it still does not find libeay32.dll...

I think it's something with linking with DLLs, unfortunately I didn't do it before on MinGW
but on VC you only link to the import library not the DLL itself.

Quoted 1 line

Do you sure the openssl is built correctly?

Yes, because the static version of pkcs-helper builds successfully and I used it to build openvpn successfully.

Quoted 2 lines

Do you have libeay32.dll at "/c/openvpn_job/openssl-0.9.7m-patched"? What is the output of "file" command on libeay32.dll?

Yes, the output of file is Ok as far as I can see, it's ../openssl-0.9.7m-patched/libeay32.dll; MS-DOS executable PE for MS Windows (DLL) (console) Intel 80386 32-bit

author
#10 lore raw
Quoted 3 lines · Alon Bar-Lev

I wish to reproduce this.
Can you please provide some instruction of how to do this?
1. Which EXACT version and platform of Windows are you using?

Windows XP SP2 Home edition

Quoted 1 line

2. Which mingw version you are using, how did you installed it.

The current latest, there's no single version for the whole package but gcc -v gives
----
Reading specs from c:/MinGW/bin/../lib/gcc/mingw32/3.4.5/specs

Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug

Thread model: win32

gcc version 3.4.5 (mingw special)
----

I installed MinGW manually by unpacking .tar.gz packages in c:/MinGW

Quoted 1 line

3. Which msys version are you using, how did you installed it.

1.0.10, installed using the installer provided at mingw.org

Quoted 1 line

4. How did you EXACTLY compile OpenSSL?

Patched it using the patch provided with openvpn, then ran ms\mw.bat

Thanks

#11 lore raw
In reply to Alon Bar-Lev

The latest Windows build system for OpenVPN is actually quite powerful, and can autodetect when certain dependencies are missing, such as the Windows DDK, and substitute in a pre-built binary of the driver, instead of requiring that every component be built from source.

This means, for example, that if you just want to make a simple change to the NSIS script, you don't need to have the DDK installed or build OpenSSL, lzo, or PKCS11-Helper.

To build OpenVPN for Windows, use the ./domake-win script. This script has extensive comments, and describes how to use the pre-built binaries feature, where pre-built binaries are substituted at every build step where a lack of dependencies precludes a build from source.

You can also view the ./domake-win script here:

http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn/domake-win

For example, suppose you want to build a windows installer for OpenVPN that includes a custom configuration file and keys. Here is a quick-start guide:

(1) Install the minimum tool chain:

# MinGW     -- for GNU C compiler
# MSYS      -- for bash
# msysDTK   -- for perl
# NSIS      -- for building installer

(2) Download and expand the prebuilt binaries distribution, for example: https://secure.openvpn.net/devel/openvpn-2.1_rc7a-prebuilt.tbz

(3) In the top-level directory of the prebuilt-binary distribution, download and expand a source .tar.gz file, for example:
https://secure.openvpn.net/devel/openvpn-2.1_rc7a.tar.gz

Edit install-win32/settings.in, uncommenting out these lines, and setting them to the appropriate file names:

# include a sample configuration file and key
;!define SAMPCONF_DIR   "test-key"
;!define SAMPCONF_CONF  "test.ovpn"
;!define SAMPCONF_P12   "test.p12"
;!define SAMPCONF_TA    "ta.key"

In the commented-out example above, the test-key directory should be present in the prebuilt-binaries top-level directory (the parent directory of the source distribution), and should contain the files test.ovpn, test.p12, ta.key.

Now you should be able to build an installer with ./domake-win that includes these custom configuration files, such that when the installer is run by an end-user, these files are placed into \program files\openvpn\config

James