How to Build OpenVpn 2.3.4 using MS Visual Studio 2010?-HELP

Weekly dev snapshots are available for testing.
We talk about them here. Testing features in the dev snapshot helps the features make it to stable.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please report your experience with testing branch. Include what you were using and how
If there is a problem, the more info the better!
Post Reply
KyeLee
OpenVpn Newbie
Posts: 4
Joined: Wed Jul 02, 2014 6:14 pm

How to Build OpenVpn 2.3.4 using MS Visual Studio 2010?-HELP

Post by KyeLee » Thu Jul 03, 2014 3:24 pm

I download the OpenVpn 2.3.4 source from https://openvpn.net/index.php/open-sour ... loads.html site and try to build the solution but running in problems.
Can someone lead into right direction to compile and build the solution?

Receive the following error message when I try to build the solution using MS VS 2010.

1>------ Build started: Project: compat, Configuration: Debug Win32 ------
2>------ Build started: Project: msvc-generate, Configuration: Debug Win32 ------
2>
2> Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
2> Copyright (C) Microsoft Corporation. All rights reserved.
2>
2>NMAKE : fatal error U1073: don't know how to make '/config-msvc-version.h.in'
2> Stop.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "nmake -f Makefile.mak all" exited with code 2.
3>------ Build started: Project: openvpnserv, Configuration: Debug Win32 ------
1> compat-inet_pton.c
1>c:\openvpn-2.3.4\src\compat\compat-inet_pton.c(28): fatal error C1083: Cannot open include file: 'config-msvc.h': No such file or directory
1> compat-inet_ntop.c
1>c:\openvpn-2.3.4\src\compat\compat-inet_ntop.c(28): fatal error C1083: Cannot open include file: 'config-msvc.h': No such file or directory

Also, receive the following massages when I ran “msvc-build.bat” file from command window.

C:\openvpn-2.3.4>msvc-build.bat
WARNING: openssl 'c:\Temp\openvpn-deps' does not exist
WARNING: lzo 'c:\Temp\openvpn-deps' does not exist
WARNING: pkcs11-helper 'c:\Temp\openvpn-deps' does not exist
WARNING: tap-windows 'c:\Temp\openvpn-deps' does not exist
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
Microsoft (R) Build Engine version 4.0.30319.18408
[Microsoft .NET Framework, version 4.0.30319.18444]
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 7/3/2014 11:17:38 AM.
Project "C:\openvpn-2.3.4\openvpn.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Release|Win32".
Project "C:\openvpn-2.3.4\openvpn.sln" (1) is building "C:\openvpn-2.3.4\src\openvpnserv\openvpnserv.vcxproj" (2) on node 1 (default target
s).
Project "C:\openvpn-2.3.4\src\openvpnserv\openvpnserv.vcxproj" (2) is building "C:\openvpn-2.3.4\build\msvc\msvc-generate\msvc-generate.vcx
proj" (3) on node 1 (default targets).
Build:
nmake -f Makefile.mak all

Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

Done Building Project "C:\openvpn-2.3.4\build\msvc\msvc-generate\msvc-generate.vcxproj" (default targets).

InitializeBuildStatus:
Touching "Release\openvpnserv.unsuccessfulbuild".
ClCompile:
All outputs are up-to-date.
ResourceCompile:
All outputs are up-to-date.
Link:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\openvpn-2.3.4\Win32-Output\Release\openvp
nserv.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut3
2.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Release\openvpnserv.exe.intermediate.manifest" /MANIFESTUAC:"level='asInv
oker' uiAccess='false'" /DEBUG /PDB:"C:\openvpn-2.3.4\Win32-Output\Release\openvpnserv.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /T
LBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\openvpn-2.3.4\Win32-Output\Release\openvpnserv.lib" /MACHINE:X86 Release\openvpnserv_resources.
res
Release\openvpnserv.obj
Release\service.obj
Generating code
Finished generating code
LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt [C:\openvpn-2.3.4\src\openvpnserv\openvpnserv.vcxpro
j]
Done Building Project "C:\openvpn-2.3.4\src\openvpnserv\openvpnserv.vcxproj" (default targets) -- FAILED.

Project "C:\openvpn-2.3.4\openvpn.sln" (1) is building "C:\openvpn-2.3.4\src\openvpn\openvpn.vcxproj" (4) on node 1 (default targets).
Project "C:\openvpn-2.3.4\src\openvpn\openvpn.vcxproj" (4) is building "C:\openvpn-2.3.4\src\compat\compat.vcxproj" (5) on node 1 (default
targets).
InitializeBuildStatus:
Creating "Release\compat.unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
All outputs are up-to-date.
Lib:
All outputs are up-to-date.
compat.vcxproj -> C:\openvpn-2.3.4\Win32-Output\Release\compat.lib
FinalizeBuildStatus:
Deleting file "Release\compat.unsuccessfulbuild".
Touching "Release\compat.lastbuildstate".
Done Building Project "C:\openvpn-2.3.4\src\compat\compat.vcxproj" (default targets).

InitializeBuildStatus:
Touching "Release\openvpn.unsuccessfulbuild".
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /I"C:\openvpn-2.3.4" /I"C:\openvpn-2.3.4/src/compat" /I"C:\openvpn-2
.3.4/include" /I"c:\Temp\openvpn-deps/include" /I"c:\Temp\openvpn-deps/include" /I"c:\Temp\openvpn-deps/include" /I"c:\Temp\openvpn-deps/
include" /Zi /nologo /W3 /WX- /O2 /Oi /Oy- /GL /D WIN32 /D NDEBUG /D _CONSOLE /D _CRT_SECURE_NO_WARNINGS /D WIN32_LEAN_AND_MEAN /D _CRT_N
ONSTDC_NO_WARNINGS /D _CRT_SECURE_NO_WARNINGS /D NTDDI_VERSION=NTDDI_WINXP /D _WIN32_WINNT=_WIN32_WINNT_WINXP /D _USE_32BIT_TIME_T /D _UN
ICODE /D UNICODE /UUNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Release\\" /Fd"Release\vc100.pdb" /Gd /TC /ana
lyze- /errorReport:queue crypto.c crypto_openssl.c cryptoapi.c error.c forward.c helper.c httpdigest.c init.c lzo.c manage.c misc.c mrout
e.c mtcp.c mudp.c multi.c ntlm.c occ.c openvpn.c options.c pf.c ping.c pkcs11.c pkcs11_openssl.c plugin.c proxy.c push.c route.c schedule
.c session_id.c sig.c socket.c ssl.c ssl_openssl.c ssl_verify.c ssl_verify_openssl.c tun.c win32.c
cl : Command line warning D9025: overriding '/DUNICODE' with '/UUNICODE' [C:\openvpn-2.3.4\src\openvpn\openvpn.vcxproj]
crypto.c
c:\openvpn-2.3.4\src\openvpn\crypto_openssl.h(33): fatal error C1083: Cannot open include file: 'openssl/evp.h': No such file or directory
[C:\openvpn-2.3.4\src\openvpn\openvpn.vcxproj]
crypto_openssl.c
c:\openvpn-2.3.4\src\openvpn\crypto_openssl.h(33): fatal error C1083: Cannot open include file: 'openssl/evp.h': No such file or directory
[C:\openvpn-2.3.4\src\openvpn\openvpn.vcxproj]
cryptoapi.c
cryptoapi.c(41): fatal error C1083: Cannot open include file: 'openssl/ssl.h': No such file or directory [C:\openvpn-2.3.4\src\openvpn\open
vpn.vcxproj]
error.c
c:\openvpn-2.3.4\src\openvpn\socket.h(1026): warning C4133: 'function' : incompatible types - from 'int *' to 'const char *' [C:\openvpn-2.
3.4\src\openvpn\openvpn.vcxproj]
c:\openvpn-2.3.4\src\openvpn\tun.h(30): fatal error C1083: Cannot open include file: 'tap-windows.h': No such file or directory [C:\openvpn
-2.3.4\src\openvpn\openvpn.vcxproj]
forward.c
c:\openvpn-2.3.4\src\openvpn\tun.h(30): fatal error C1083: Cannot open include file: 'tap-windows.h': No such file or directory [C:\openvpn
-2.3.4\src\openvpn\openvpn.vcxproj]
helper.c
c:\openvpn-2.3.4\src\openvpn\tun.h(30): fatal error C1083: Cannot open include file: 'tap-windows.h': No such file or directory [C:\openvpn
-2.3.4\src\openvpn\openvpn.vcxproj]

BubeQ
OpenVpn Newbie
Posts: 3
Joined: Fri Jul 04, 2014 3:22 pm

Re: How to Build OpenVpn 2.3.4 using MS Visual Studio 2010?-

Post by BubeQ » Thu Jul 24, 2014 9:16 am

Hey KyeLee
I'm having same problem and I have tried every solution I have found online, nothing helped.
Did you find out what the problem is?

KyeLee
OpenVpn Newbie
Posts: 4
Joined: Wed Jul 02, 2014 6:14 pm

Re: How to Build OpenVpn 2.3.4 using MS Visual Studio 2010?-

Post by KyeLee » Thu Jul 24, 2014 1:43 pm

Not yet but I am still trying ...
As you mentioned, I've tried every solutions with no success.

Kye Lee

BubeQ
OpenVpn Newbie
Posts: 3
Joined: Fri Jul 04, 2014 3:22 pm

Re: How to Build OpenVpn 2.3.4 using MS Visual Studio 2010?-

Post by BubeQ » Fri Jul 25, 2014 8:47 am

Friggin hell I'm fighting with it for two weeks now, if I figure it out I will let you know

BubeQ

KyeLee
OpenVpn Newbie
Posts: 4
Joined: Wed Jul 02, 2014 6:14 pm

Re: How to Build OpenVpn 2.3.4 using MS Visual Studio 2010?-

Post by KyeLee » Fri Jul 25, 2014 1:08 pm

I gave up trying to build the OpenVpn using Visual Studio 2010.
I am spending way more time than I should trying to compile using VS 2010.

So, I switched gear to compile it using provide build steps described in https://community.openvpn.net/openvpn/w ... uildsystem
I was able to get clean compile after few tries. Here is what I did.

Download the “openvpn-build-master.zip” from https://github.com/OpenVPN/openvpn-build
Move the extracted openvpn-build-master.zip files to to C:\openvpn-build
*Make sure the path does NOT have spaces … Build commend uses the space as a field separator in perl copy function
Described in bottom of this.

cd to C:\openvpn-build\msvc dir and ran build.bat

Got the following error
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Processing archive: sources\pkcs11-helper-1.10.tar.bz2
Error: Can not open file as archive
FAILED

This error was cause by download pkcs11-helper-1.10.tar.bz2 file and not able to unzip gz2 extension
It appears the download file is bad. So I manually download the file (pkcs11-helper-1.10.tar.bz2) from http://sourceforge.net/projects/opensc/ ... 11-helper/ into “source” dir.

Ran the build.bat again

Got following error
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Processing archive: sources\tap-windows-9.9.0_master.zip
Error: Can not open file as archive
FAILED

Again the “tap-windows-9.9.0_master.zip” appears bad so I manually download the file from https://github.com/OpenVPN/tap-windows-old/downloadsinto “source” dir

Ran the build.bat again

While build the openssl receive the following msg
error LNK1123: failure during conversion to COFF: file invalid or corrupt

This error was cause by MS VS 2010 is not up-to-date … updated with service pack 1

Ran the build.bat again

Receive the following error msg
Destination must be a directory at util/copy.pl line 32.
NMAKE : fatal error U1077: 'C:\Perl\bin\perl.EXE' : return code '0x2'
Stop.
FAILED

Received above message because the destination dir is defined as “C:\Users\Kye Lee\Desktop\OpenVpn\openvpn-build-master\msvc\image” in ms/ntdll.mak file.

In perl parsing the copy input arg with space as field separator where above destination dir is treated as 2 fields.
C:\Users\Kye
Lee\Desktop\OpenVpn\openvpn-build-master\msvc\image

Move the top level directory (openvpn-build) to c:\

Ran the build.bat again

Clean Build

… Compile … Work …

Post Reply