Skip to contentSkip to conversation

: small tweaks to beta16

PATCH In review Peter 'Luna' Runestig 4 participants 5 messages Nov 11, 2004 – Nov 18, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : small tweaks to beta16

Hi again! I need this to compile beta16 with Visual C++:

config-win32.h +1 -0
diff -u openvpn-2.0_beta16.orig/config-win32.h openvpn-2.0_beta16/config-win32.h
@@ -271,6 +271,7 @@
 #define vsnprintf _vsnprintf
 #define vsnwprintf _vsnwprintf
 #define snwprintf _snwprintf
+#define snprintf _snprintf
 #define write _write
 #define open _open
 #define read _read
makefile.w32-vc +1 -1
diff -u openvpn-2.0_beta16.orig/makefile.w32-vc openvpn-2.0_beta16/makefile.w32-vc
@@ -24,7 +24,7 @@
 
 INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include
 
-LIBS = lzo.lib ws2_32.lib iphlpapi.lib winmm.lib gdi32.lib advapi32.lib
+LIBS = lzo.lib ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib gdi32.lib advapi32.lib
 
 LIB_DIRS = -LIBPATH:$(OPENSSL)\out -LIBPATH:$(LZO)
 
thread.h +2 -2
diff -u openvpn-2.0_beta16.orig/thread.h openvpn-2.0_beta16/thread.h
@@ -163,8 +163,8 @@
 
 typedef int openvpn_thread_t;
 
-#define MUTEX_DEFINE(lock)
-#define MUTEX_PTR_DEFINE(lock)
+#define MUTEX_DEFINE(lock) int eat_semicolon
+#define MUTEX_PTR_DEFINE(lock) int eat_semicolon
 
 #define mutex_init(m)
 #define mutex_destroy(m)

I.e. "snprintf" must be renamed to "_snprintf", and "crypt32.lib" is missing from the "makefile.w32-vc" file (but that one is autogenerated, yes?). And look at that last, ugly hack: If USE_PTHREAD is NOT defined, stuff like this get a line with a lonely semicolon, that VC++ chokes on:

struct hash_bucket
{
MUTEX_DEFINE (mutex);
struct hash_element * volatile list;
};

But there is probably a more elegant solution to that one...

Finally, I always have to do this adjustment, to build with MinGW:

makefile.w32 +1 -1
diff -u openvpn-2.0_beta16.orig/makefile.w32 openvpn-2.0_beta16/makefile.w32
@@ -50,7 +50,7 @@
 
 LIBS_DMALLOC = ${LIBS} -ldmalloc
 
-LIB_DIRS = -L${OPENSSL}/out -L${LZO}/src/.libs
+LIB_DIRS = -L${OPENSSL}/out -L${LZO}
 
 LIB_DIRS_DMALLOC = ${LIB_DIRS} -L${DMALLOC}
 

I'm using lzo-1.08, and the "liblzo.a" file was created in the base directory there, and the "src/.libs" subdir doesn't even exist. Or is it just me?

Cheers,
- Peter

Signature · 5 lines
Peter 'Luna' Runestig (fd. Altberg), Sweden <[email protected]...>
PGP Key ID: 0xD07BBE13
Fingerprint: 7B5C 1F48 2997 C061 DE4B  42EA CB99 A35C D07B BE13
AOL Instant Messenger Screen name: PRunestig
Yahoo! Messenger profile name: altberg
#1 lore raw
Quoted 17 lines · Peter 'Luna' Runestig

Hi again! I need this to compile beta16 with Visual C++:

diff -u openvpn-2.0_beta16.orig/config-win32.h openvpn-2.0_beta16/config-win32.h

config-win32.h +1 -0
@@ -271,6 +271,7 @@
 #define vsnprintf _vsnprintf
 #define vsnwprintf _vsnwprintf
 #define snwprintf _snwprintf
+#define snprintf _snprintf
 #define write _write
 #define open _open
 #define read _read

diff -u openvpn-2.0_beta16.orig/makefile.w32-vc openvpn-2.0_beta16/makefile.w32-vc

makefile.w32-vc line 29

Quoted 7 lines
makefile.w32-vc +1 -1
@@ -24,7 +24,7 @@
 
 INCLUDE_DIRS = -I$(OPENSSL)/include -I$(LZO)/include
 
-LIBS = lzo.lib ws2_32.lib iphlpapi.lib winmm.lib gdi32.lib advapi32.lib
+LIBS = lzo.lib ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib gdi32.lib advapi32.lib
 
 LIB_DIRS = -LIBPATH:$(OPENSSL)\out -LIBPATH:$(LZO)

I've merged the above 2 patches.

Quoted 4 lines

diff -u openvpn-2.0_beta16.orig/thread.h openvpn-2.0_beta16/thread.h

thread.h line 170

Quoted 10 lines
thread.h +2 -2
@@ -163,8 +163,8 @@
 
 typedef int openvpn_thread_t;
 
-#define MUTEX_DEFINE(lock)
-#define MUTEX_PTR_DEFINE(lock)
+#define MUTEX_DEFINE(lock) int eat_semicolon
+#define MUTEX_PTR_DEFINE(lock) int eat_semicolon
 
 #define mutex_init(m)
 #define mutex_destroy(m)

This one I bracketed with #ifdef _MSC_VER

Quoted 28 lines

I.e. "snprintf" must be renamed to "_snprintf", and "crypt32.lib" is missing from the "makefile.w32-vc" file (but that one is autogenerated, yes?). And look at that last, ugly hack: If USE_PTHREAD is NOT defined, stuff like this get a line with a lonely semicolon, that VC++ chokes on:

struct hash_bucket
{
MUTEX_DEFINE (mutex);
struct hash_element * volatile list;
};

But there is probably a more elegant solution to that one...

Finally, I always have to do this adjustment, to build with MinGW:

diff -u openvpn-2.0_beta16.orig/makefile.w32 openvpn-2.0_beta16/makefile.w32

makefile.w32 +1 -1
@@ -50,7 +50,7 @@
 
 LIBS_DMALLOC = ${LIBS} -ldmalloc
 
-LIB_DIRS = -L${OPENSSL}/out -L${LZO}/src/.libs
+LIB_DIRS = -L${OPENSSL}/out -L${LZO}
 
 LIB_DIRS_DMALLOC = ${LIB_DIRS} -L${DMALLOC}
 
Quoted 3 lines

I'm using lzo-1.08, and the "liblzo.a" file was created in the base directory there, and the "src/.libs" subdir doesn't even exist. Or is it just me?

That's strange because when I build lzo-1.08, it puts the .a file in src/.libs.

James

#2 lore raw
Quoted 14 lines · James Yonan
Quoted 12 lines · Peter 'Luna' Runestig
makefile.w32 +1 -1
@@ -50,7 +50,7 @@
 
 LIBS_DMALLOC = ${LIBS} -ldmalloc
 
-LIB_DIRS = -L${OPENSSL}/out -L${LZO}/src/.libs
+LIB_DIRS = -L${OPENSSL}/out -L${LZO}
 
 LIB_DIRS_DMALLOC = ${LIB_DIRS} -L${DMALLOC}
 
Quoted 6 lines
Quoted 3 lines

I'm using lzo-1.08, and the "liblzo.a" file was created in the base directory there, and the "src/.libs" subdir doesn't even exist. Or is it just me?

That's strange because when I build lzo-1.08, it puts the .a file in src/.libs.

The software that builds the LZO archive and shared library (liblzo.a and .so) in src/.libs is libtool, and libtool should then be used to either _install_ or _link_ against the LZO library. (Libtool stores information that describes the .a and .so files in its .la files.)

Is libtool used for Windows builds?

Signature · 1 line
Matthias Andree
#3 lore raw
Quoted 23 lines · Matthias Andree
Quoted 14 lines · James Yonan
Quoted 12 lines · Peter 'Luna' Runestig
makefile.w32 +1 -1
@@ -50,7 +50,7 @@
 
 LIBS_DMALLOC = ${LIBS} -ldmalloc
 
-LIB_DIRS = -L${OPENSSL}/out -L${LZO}/src/.libs
+LIB_DIRS = -L${OPENSSL}/out -L${LZO}
 
 LIB_DIRS_DMALLOC = ${LIB_DIRS} -L${DMALLOC}
 
Quoted 6 lines
Quoted 3 lines

I'm using lzo-1.08, and the "liblzo.a" file was created in the base directory there, and the "src/.libs" subdir doesn't even exist. Or is it just me?

That's strange because when I build lzo-1.08, it puts the .a file in src/.libs.

Quoted 6 lines

The software that builds the LZO archive and shared library (liblzo.a and .so) in src/.libs is libtool, and libtool should then be used to either _install_ or _link_ against the LZO library. (Libtool stores information that describes the .a and .so files in its .la files.)

Is libtool used for Windows builds?

Right now the Windows build is statically linking with the LZO lib, just as is specified in the makefile.w32. libtool is used to make the library, but not to link against it. Is there a problem with this?

James

#4 lore raw
Quoted 3 lines · James Yonan

Right now the Windows build is statically linking with the LZO lib, just as is specified in the makefile.w32. libtool is used to make the library, but not to link against it. Is there a problem with this?

Yes, I believe so. If you use libtool to make the library, then you should use libtool --mode=link to link with it, too - or install it before building OpenVPN.

The alternative is, when you know you're building the library only statically, to leave libtool out. I haven't looked close enough to determine if this is applicable.

Signature · 1 line
Matthias Andree