Re: [Openvpn-devel] compiling with visual studio

2013-01-18 Thread Athanasios Douitsis
On Fri, Jan 18, 2013 at 10:18 AM, Samuli Seppänen wrote:

>
>
> > Hi,
> >
> > First of thanks for taking the time to write a very comprehensive
> response, much appreciated.
> >
> > Although I have already succeeded with the msvc build, the idea of
> having a dedicated vm doing building and packaging seems very agreeable.
> I'll be sure to get back to you if there are any questions.
> >
> > Best regards and thanks,
> > Athanasios
> >
>
> Hi Athanasios,
>
> Good to hear you got msvc builds to work! Now, you mentioned that the
> documentation about msvc building was obsolete. Could you update the
> documentation on the Wiki or let us know which steps you needed to take
> to get the build working?
>


It was somewhat of a mess, actually. Some download URLs are invalid, so
appropriate replacements must be found. With pkcs11-helper, I had to copy
an older zip from an older build of mine. Trying to get the current zip
file from alon's or opensc repo on github yields the error:

NMAKE : fatal error U1073: don't know how to make 'versioninfo.res'

Correct me if I'm wrong, but to produce the versioninfo.res file one would
need the versioninfo.rc file. But unfortunately the versioninfo.rc file is
not here:

https://github.com/alonbl/pkcs11-helper/tree/pkcs11-helper-1.09/lib

There is the versioninfo.rc.in file in the same place, but the build
requirements are Perl and VS10, so automake is not going to be available
right?

After that it should be smooth sailing from there, apart form the fact that
the source for openvpn 2.3 contains 2 places where c99-ish C is used. But
you already know that.


Kind regards,
Athanasios




>
> --
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
>
> irc freenode net: mattock
>
>


-- 
Athanasios Douitsis


Re: [Openvpn-devel] compiling with visual studio

2013-01-18 Thread Samuli Seppänen


> Hi,
>
> First of thanks for taking the time to write a very comprehensive response, 
> much appreciated. 
>
> Although I have already succeeded with the msvc build, the idea of having a 
> dedicated vm doing building and packaging seems very agreeable. I'll be sure 
> to get back to you if there are any questions. 
>
> Best regards and thanks,
> Athanasios 
>

Hi Athanasios,

Good to hear you got msvc builds to work! Now, you mentioned that the
documentation about msvc building was obsolete. Could you update the
documentation on the Wiki or let us know which steps you needed to take
to get the build working?

-- 
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc

irc freenode net: mattock




Re: [Openvpn-devel] compiling with visual studio

2013-01-17 Thread Athanasios Douitsis


17 Ιαν 2013, 4:01 μ.μ., ο/η Samuli Seppänen  έγραψε:

> Hi Athanasios,
> 
>> Right, so this is because c99 and VS don't mix. Thanks very much Gert.
>> 
>> To explain why I'm trying to do this: Our institution uses OpenVPN to
>> provide remote access (e.g. access to electronic libraries, etc) to
>> its users. So we used to build openvpn and package it very very
>> similarly to the official release (we were using msys and nsis) along
>> with a couple of our conf files. However, domake-win has been removed
>> in 2.3 so I am trying to figure out the best way to do it. What would
>> be ideal would be the thing that tunnelblick does with deployed mode
>> (http://code.google.com/p/tunnelblick/wiki/cCusDeployed). The admin
>> does not have to build anything, just open the package and drop a
>> deploy folder to the appropriate location. Sadly the windows package
>> does not include something similar, so lots of work need to be done to
>> build a customized package.
>> 
> I'll look into current status of openvpn-build/msvc and setup a Windows
> buildslave to ensure it stays in working order. I really haven't touched
> that buildsystem after doing the initial testing way back when.
> 
> The official Windows packages have been cross-compiled on Ubuntu 12.04
> 64-bit. As you used "domake-win" earlier, I'd suggest you set up a
> cross-compilation box, too:
> 
> 
> 
> 
> After the build environment has been setup, you will need to customize
> two files:
> 
> - openvpn-build/windows-nsis/build-complete.vars
> - openvpn-build/generic/build.vars
> 
> Alternatively, you can override the values in them using environment
> variables. Most of the dependencies for openvpn-build are available here:
> 
> 
> 
> You can modify openvpn-build/windows-nsis/openvpn.nsi to install custom
> files/directories using "File /r":
> 
> 
> 
> If you have any issues setting up a cross-compilation box, just let me know.
> 
>> BTW, if you are referring to
>> 
>> https://community.openvpn.net/openvpn/wiki/BuildingUsingGenericBuildsystem#BuildingnativelyonWindowsusingtheMSVCtoolchainmsvcsubdir
>> 
>> I am sorry to say that the info on this page outdated, one has to do
>> quite a few things differently to proceed. The biggest gripe is that
>> the scripts that are mentioned try to download stuff directly from
>> github but github has changed the way it exposes its files. In
>> addition, it tries to download some files from Alon's repo and not
>> from the official openvpn repo. And now that I mention it, I think
>> that the github repo is not synced to the official git so 2.3 is not
>> really available there.
> 
> The build configuration can and should be changed. That said, I think
> openvpn-build default values should make sense, i.e. work out of the
> box. I'll send a patch that fixes this.

Hi,

First of thanks for taking the time to write a very comprehensive response, 
much appreciated. 

Although I have already succeeded with the msvc build, the idea of having a 
dedicated vm doing building and packaging seems very agreeable. I'll be sure to 
get back to you if there are any questions. 

Best regards and thanks,
Athanasios 




> 
> Best regards,
> 
> -- 
> Samuli Seppänen
> Community Manager
> OpenVPN Technologies, Inc
> 
> irc freenode net: mattock
> 



Re: [Openvpn-devel] compiling with visual studio

2013-01-17 Thread Samuli Seppänen
Hi Athanasios,

> Right, so this is because c99 and VS don't mix. Thanks very much Gert.
>
> To explain why I'm trying to do this: Our institution uses OpenVPN to
> provide remote access (e.g. access to electronic libraries, etc) to
> its users. So we used to build openvpn and package it very very
> similarly to the official release (we were using msys and nsis) along
> with a couple of our conf files. However, domake-win has been removed
> in 2.3 so I am trying to figure out the best way to do it. What would
> be ideal would be the thing that tunnelblick does with deployed mode
> (http://code.google.com/p/tunnelblick/wiki/cCusDeployed). The admin
> does not have to build anything, just open the package and drop a
> deploy folder to the appropriate location. Sadly the windows package
> does not include something similar, so lots of work need to be done to
> build a customized package.
>
I'll look into current status of openvpn-build/msvc and setup a Windows
buildslave to ensure it stays in working order. I really haven't touched
that buildsystem after doing the initial testing way back when.

The official Windows packages have been cross-compiled on Ubuntu 12.04
64-bit. As you used "domake-win" earlier, I'd suggest you set up a
cross-compilation box, too:




After the build environment has been setup, you will need to customize
two files:

- openvpn-build/windows-nsis/build-complete.vars
- openvpn-build/generic/build.vars

Alternatively, you can override the values in them using environment
variables. Most of the dependencies for openvpn-build are available here:



You can modify openvpn-build/windows-nsis/openvpn.nsi to install custom
files/directories using "File /r":



If you have any issues setting up a cross-compilation box, just let me know.

> BTW, if you are referring to
>
> https://community.openvpn.net/openvpn/wiki/BuildingUsingGenericBuildsystem#BuildingnativelyonWindowsusingtheMSVCtoolchainmsvcsubdir
>
> I am sorry to say that the info on this page outdated, one has to do
> quite a few things differently to proceed. The biggest gripe is that
> the scripts that are mentioned try to download stuff directly from
> github but github has changed the way it exposes its files. In
> addition, it tries to download some files from Alon's repo and not
> from the official openvpn repo. And now that I mention it, I think
> that the github repo is not synced to the official git so 2.3 is not
> really available there.

The build configuration can and should be changed. That said, I think
openvpn-build default values should make sense, i.e. work out of the
box. I'll send a patch that fixes this.

Best regards,

-- 
Samuli Seppänen
Community Manager
OpenVPN Technologies, Inc

irc freenode net: mattock




Re: [Openvpn-devel] compiling with visual studio

2013-01-17 Thread Athanasios Douitsis
On Thu, Jan 17, 2013 at 2:19 AM, Matthias Andree wrote:

> Am 16.01.2013 11:11, schrieb Gert Doering:
> > Hi,
> >
> > On Tue, Jan 15, 2013 at 09:03:07PM +0200, Athanasios Douitsis wrote:
> >> Trying to compile 2.3 with visual studio 2010. I am getting the
> following
> >> error:
> >>
> >> init.c(186): error C2143: syntax error : missing ';' before 'type'
> >>
> [C:\openvpn4\openvpn-build\msvc\build.tmp\openvpn-2.3_master\src\openvpn\openvpn.vcxproj]
> >>
> >> (after that there are many many more errors, but you get the idea)
> >
> > Oh well, we've done it again...
>
> User reply follows, Developer reply after next quote:
>
> Arguably, Visual Studio is broken if it does not accept the then-current
> version of ISO 9899, which would have been C99 for anything except
> VS2012 that should support C11, but reality differs, and
> <
> http://stackoverflow.com/questions/146381/visual-studio-support-for-new-c-c-standards
> >
> contains a few links to official info.
>
> If something has really failed to catch on with many commercial
> compilers, then I fear C99 is to carry this red light. :-(
>
> If the code is really type-safe and -clean in C++ terms, you may have
> some success with convincing VS to compile in C++ mode - but this needs
> typecasts for virtually everything that deals with void * - but there
> are some things in C99 that are incompatible with (at least the most
> widely implemented pre-C++11 variants of) C++, such as variable-length C
> arrays.
>
> >   if (management)
> > {
> >   gc = gc_new ();
> >   struct buffer out = alloc_buf_gc (256, &gc);
> >
> > ... this is not allowed in visual studio (having a variable declaration
> > after "non-declaration" code), but gcc doesn't complain, so we usually
> > don't notice.
>
>
>
> You can make gcc complain, -pedantic -std=c89 should do it, or if you
> are not enabling additional compiler warnings, -pedantic-errors.
>   And it possibly causes tons of other warnings because it nukes system
> extensions from the compilation environment.
>
> What I personally usually do is to test with various different compilers
> and configurations:
>
> 1. do not configure the source directory (or call "make distclean")
>
> 2. mkdir _build _build-c89 _build-clang _build-icc
>
> 3. for each $DIR of these new directories, do:
>
> 3a. cd $DIR
>
> 3b. ../configure CC="gcc"
> (or CC="gcc -std=c89 -pedantic" or "clang" or "icc" or... you name it) -
> you can also add CFLAGS, LDFLAGS, CPPFLAGS as you see fit, stuff -m32 to
> compile 32-bit code on 64-bit systems that support it (some Linux
> distributions would work - if they offer you i686 packages to install on
> your x86_64, they are usually ready; such as: Debian if you stay away
> from aptitude, and Fedora, for instance).
>
> 3c. make -sj4 check (use higher numbers for machines with more than
> 4 CPU cores)
>
> where
>  - icc is Intel's compiler package that keeps changing names more often
> than I chase new versions
>  - clang is Apple's LLVM-based free-and-open-source compiler which gives
> decent and useful hints, but defaults to C99 mode
>
> Best regards,
> Matthias
>
>
> --
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> ___
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel
>

For anyone interested, the offending lines are init.c:186 and
socket.c:1264. I've been able to successfully compile the project with VS10
after trivial changes to these two spots.

Also, please anyone interested take a look at my reply yesterday about the
problems with the build instructions.
--
Athanasios Douitsis


Re: [Openvpn-devel] compiling with visual studio

2013-01-17 Thread Matthias Andree
Am 16.01.2013 11:11, schrieb Gert Doering:
> Hi,
> 
> On Tue, Jan 15, 2013 at 09:03:07PM +0200, Athanasios Douitsis wrote:
>> Trying to compile 2.3 with visual studio 2010. I am getting the following
>> error:
>>
>> init.c(186): error C2143: syntax error : missing ';' before 'type'
>> [C:\openvpn4\openvpn-build\msvc\build.tmp\openvpn-2.3_master\src\openvpn\openvpn.vcxproj]
>>
>> (after that there are many many more errors, but you get the idea)
> 
> Oh well, we've done it again...

User reply follows, Developer reply after next quote:

Arguably, Visual Studio is broken if it does not accept the then-current
version of ISO 9899, which would have been C99 for anything except
VS2012 that should support C11, but reality differs, and

contains a few links to official info.

If something has really failed to catch on with many commercial
compilers, then I fear C99 is to carry this red light. :-(

If the code is really type-safe and -clean in C++ terms, you may have
some success with convincing VS to compile in C++ mode - but this needs
typecasts for virtually everything that deals with void * - but there
are some things in C99 that are incompatible with (at least the most
widely implemented pre-C++11 variants of) C++, such as variable-length C
arrays.

>   if (management)
> {
>   gc = gc_new ();
>   struct buffer out = alloc_buf_gc (256, &gc);
> 
> ... this is not allowed in visual studio (having a variable declaration
> after "non-declaration" code), but gcc doesn't complain, so we usually
> don't notice.



You can make gcc complain, -pedantic -std=c89 should do it, or if you
are not enabling additional compiler warnings, -pedantic-errors.
  And it possibly causes tons of other warnings because it nukes system
extensions from the compilation environment.

What I personally usually do is to test with various different compilers
and configurations:

1. do not configure the source directory (or call "make distclean")

2. mkdir _build _build-c89 _build-clang _build-icc

3. for each $DIR of these new directories, do:

3a. cd $DIR

3b. ../configure CC="gcc"
(or CC="gcc -std=c89 -pedantic" or "clang" or "icc" or... you name it) -
you can also add CFLAGS, LDFLAGS, CPPFLAGS as you see fit, stuff -m32 to
compile 32-bit code on 64-bit systems that support it (some Linux
distributions would work - if they offer you i686 packages to install on
your x86_64, they are usually ready; such as: Debian if you stay away
from aptitude, and Fedora, for instance).

3c. make -sj4 check (use higher numbers for machines with more than
4 CPU cores)

where
 - icc is Intel's compiler package that keeps changing names more often
than I chase new versions
 - clang is Apple's LLVM-based free-and-open-source compiler which gives
decent and useful hints, but defaults to C99 mode

Best regards,
Matthias



Re: [Openvpn-devel] compiling with visual studio

2013-01-16 Thread Athanasios Douitsis
Right, so this is because c99 and VS don't mix. Thanks very much Gert.

To explain why I'm trying to do this: Our institution uses OpenVPN to
provide remote access (e.g. access to electronic libraries, etc) to its
users. So we used to build openvpn and package it very very similarly to
the official release (we were using msys and nsis) along with a couple of
our conf files. However, domake-win has been removed in 2.3 so I am trying
to figure out the best way to do it. What would be ideal would be the thing
that tunnelblick does with deployed mode (
http://code.google.com/p/tunnelblick/wiki/cCusDeployed). The admin does not
have to build anything, just open the package and drop a deploy folder to
the appropriate location. Sadly the windows package does not include
something similar, so lots of work need to be done to build a customized
package.

BTW, if you are referring to

https://community.openvpn.net/openvpn/wiki/BuildingUsingGenericBuildsystem#BuildingnativelyonWindowsusingtheMSVCtoolchainmsvcsubdir

I am sorry to say that the info on this page outdated, one has to do quite
a few things differently to proceed. The biggest gripe is that the scripts
that are mentioned try to download stuff directly from github but github
has changed the way it exposes its files. In addition, it tries to download
some files from Alon's repo and not from the official openvpn repo. And now
that I mention it, I think that the github repo is not synced to the
official git so 2.3 is not really available there.

Best regards,
Athanasios


On Wed, Jan 16, 2013 at 12:11 PM, Gert Doering  wrote:

> Hi,
>
> On Tue, Jan 15, 2013 at 09:03:07PM +0200, Athanasios Douitsis wrote:
> > Trying to compile 2.3 with visual studio 2010. I am getting the following
> > error:
> >
> > init.c(186): error C2143: syntax error : missing ';' before 'type'
> >
> [C:\openvpn4\openvpn-build\msvc\build.tmp\openvpn-2.3_master\src\openvpn\openvpn.vcxproj]
> >
> > (after that there are many many more errors, but you get the idea)
>
> Oh well, we've done it again...
>
>   if (management)
> {
>   gc = gc_new ();
>   struct buffer out = alloc_buf_gc (256, &gc);
>
> ... this is not allowed in visual studio (having a variable declaration
> after "non-declaration" code), but gcc doesn't complain, so we usually
> don't notice.
>
> > Which puzzles me, because I thought that OpenVPN can actually be built
> with
> > visual studio. Is there something I'm missing?
>
> Visual Studio is a big pain, so we cross-compile using MinGW64 from Linux.
>
> Samuli has a wiki page somewhere on community.openvpn.net that explains
> how to build OpenVPN in a non-maddening way.
>
> But thanks for the report.  I have a Win7 VM that should actually be
> able to do a Visual Studio build - I'll try to find time to look at these
> issues and send a patch.
>
> gert
>
> --
> USENET is *not* the non-clickable part of WWW!
>//
> www.muc.de/~gert/
> Gert Doering - Munich, Germany
> g...@greenie.muc.de
> fax: +49-89-35655025
> g...@net.informatik.tu-muenchen.de
>



-- 
Athanasios Douitsis


Re: [Openvpn-devel] compiling with visual studio

2013-01-16 Thread Gert Doering
Hi,

On Tue, Jan 15, 2013 at 09:03:07PM +0200, Athanasios Douitsis wrote:
> Trying to compile 2.3 with visual studio 2010. I am getting the following
> error:
> 
> init.c(186): error C2143: syntax error : missing ';' before 'type'
> [C:\openvpn4\openvpn-build\msvc\build.tmp\openvpn-2.3_master\src\openvpn\openvpn.vcxproj]
> 
> (after that there are many many more errors, but you get the idea)

Oh well, we've done it again...

  if (management)
{
  gc = gc_new ();
  struct buffer out = alloc_buf_gc (256, &gc);

... this is not allowed in visual studio (having a variable declaration
after "non-declaration" code), but gcc doesn't complain, so we usually
don't notice.

> Which puzzles me, because I thought that OpenVPN can actually be built with
> visual studio. Is there something I'm missing?

Visual Studio is a big pain, so we cross-compile using MinGW64 from Linux.

Samuli has a wiki page somewhere on community.openvpn.net that explains
how to build OpenVPN in a non-maddening way.

But thanks for the report.  I have a Win7 VM that should actually be
able to do a Visual Studio build - I'll try to find time to look at these
issues and send a patch.

gert

-- 
USENET is *not* the non-clickable part of WWW!
   //www.muc.de/~gert/
Gert Doering - Munich, Germany g...@greenie.muc.de
fax: +49-89-35655025g...@net.informatik.tu-muenchen.de


pgpQup_ZQ3jYP.pgp
Description: PGP signature


[Openvpn-devel] compiling with visual studio

2013-01-15 Thread Athanasios Douitsis
Hi all,

Trying to compile 2.3 with visual studio 2010. I am getting the following
error:

init.c(186): error C2143: syntax error : missing ';' before 'type'
[C:\openvpn4\openvpn-build\msvc\build.tmp\openvpn-2.3_master\src\openvpn\openvpn.vcxproj]

(after that there are many many more errors, but you get the idea)

Which puzzles me, because I thought that OpenVPN can actually be built with
visual studio. Is there something I'm missing?
-- 
Athanasios Douitsis