解决gcc4.5编译L2TP一键安装包 openswan出错问题

错误大概是:

In file included from /home/users/z/rpm/BUILD/openswan-2.6.25/programs/addconn/addconn.c:51:0:
/home/users/z/rpm/BUILD/openswan-2.6.25/include/ipsecconf/confread.h:37:19: error: comparison between ‘enum keyword_string_config_field’ and ‘enum keyword_string_conn_field’
/home/users/z/rpm/BUILD/openswan-2.6.25/include/ipsecconf/confread.h:38:19: error: comparison between ‘enum keyword_numeric_config_field’ and ‘enum keyword_numeric_conn_field’
/home/users/z/rpm/BUILD/openswan-2.6.25/include/ipsecconf/confread.h:39:34: error: comparison between ‘enum keyword_string_config_field’ and ‘enum keyword_string_conn_field’
/home/users/z/rpm/BUILD/openswan-2.6.25/include/ipsecconf/confread.h:40:34: error: comparison between ‘enum keyword_numeric_config_field’ and ‘enum keyword_numeric_conn_field’
make3* [addconn.o] Error 1
make3: Leaving directory `/home/users/z/rpm/BUILD/openswan-2.6.25/OBJ.linux.i386/programs/addconn’
make2
[programs] Error 1
make2: Leaving directory `/home/users/z/rpm/BUILD/openswan-2.6.25/OBJ.linux.i386/programs’
make1
[programs] Error 1
make1: Leaving directory `/home/users/z/rpm/BUILD/openswan-2.6.25/OBJ.linux.i386′
make: *
 [programs] Error 2

 

这是个bug,打上补丁即可解决
https://www.openswan.org/issues/1108

补丁详细信息:

--- openswan-2.6.25/include/ipsecconf/keywords.h~	2010-03-21 18:39:35.000000000 +0100
+++ openswan-2.6.25/include/ipsecconf/keywords.h	2010-05-04 14:11:46.000000000 +0200
@@ -160,8 +160,8 @@
     KNCF_MAX              
 };

-#define KEY_STRINGS_MAX (KSF_MAX > KSCF_MAX ? KSF_MAX : KSCF_MAX)+1
-#define KEY_NUMERIC_MAX (KBF_MAX > KNCF_MAX ? KBF_MAX : KNCF_MAX)+1
+#define KEY_STRINGS_MAX ((int)KSF_MAX > (int)KSCF_MAX ? (int)KSF_MAX : (int)KSCF_MAX)+1
+#define KEY_NUMERIC_MAX ((int)KBF_MAX > (int)KNCF_MAX ? (int)KBF_MAX : (int)KNCF_MAX)+1

 /* these are bits set in a word */
 enum keyword_valid {

openswan-buildfix.zip