Project

General

Profile

Bug #1099

compiling error in r5.3.3

Added by zhonghai li almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Normal
Category:
build
Target version:
Start date:
07.09.2015
Due date:
Estimated time:
Affected version:
5.3.3
Resolution:
Fixed

Description

Hi,

When I try to cross-compile strongswan 5.3.3, I got the error below.
This error not found in r5.3.2, so could you help me check the reason?

libtool: compile:  mipsel-unknown-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../../../.. -I../../../../src/include -I../../../../src/libstrongswan -I../../../../src/libhydra -DROUTING_TABLE=220 -DROUTING_TABLE_PRIO=220 -I/home/shared/gmp_res//include -rdynamic -g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -include /home/shared/strongswan-5.3.3/config.h -MT kernel_netlink_ipsec.lo -MD -MP -MF .deps/kernel_netlink_ipsec.Tpo -c kernel_netlink_ipsec.c  -fPIC -DPIC -o .libs/kernel_netlink_ipsec.o
In file included from kernel_netlink_ipsec.c:25:
../../../../src/include/linux/netlink.h:36: error: expected specifier-qualifier-list before '__kernel_sa_family_t'
In file included from kernel_netlink_ipsec.c:26:
../../../../src/include/linux/rtnetlink.h:357: error: expected specifier-qualifier-list before '__kernel_sa_family_t'
kernel_netlink_ipsec.c: In function 'receive_events':
kernel_netlink_ipsec.c:1036: error: 'struct sockaddr_nl' has no member named 'nl_pid'
kernel_netlink_ipsec.c: In function 'kernel_netlink_ipsec_create':
kernel_netlink_ipsec.c:2956: error: 'struct sockaddr_nl' has no member named 'nl_family'
kernel_netlink_ipsec.c:2966: error: 'struct sockaddr_nl' has no member named 'nl_groups'
make[4]: *** [kernel_netlink_ipsec.lo] Error 1
make[4]: Leaving directory `/home/shared/strongswan-5.3.3/src/libhydra/plugins/kernel_netlink'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/shared/strongswan-5.3.3/src/libhydra'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/shared/strongswan-5.3.3/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/shared/strongswan-5.3.3'
make: *** [all] Error 2
make  install-recursive
make[1]: Entering directory `/home/shared/strongswan-5.3.3'

Here is the configure I used.

./configure --host=mipsel-unknown-linux-gnu --prefix=/home/shared/strongswan_res/ --disable-ikev1 --with-resolv-conf=/etc/resolv.conf --with-lib-prefix=/home/shared/gmp_res/

Thanks.
Zhonghai Li


Related issues

Related to Issue #1166: Strongswan [strongswan-5.3.3.tar.bz2] is not compiling in opensuse linux12 2.6.32.12-0.7-default .Closed20.10.2015

Associated revisions

Revision e7143fe9 (diff)
Added by Tobias Brunner almost 5 years ago

include: Add linux/socket.h

__kernel_sa_family_t is defined and used since Linux 3.1, so on systems
with older kernels (like CentOS 6.7, which still ships a 2.6.32 kernel) the
build with the current UAPI headers fails. And using the native headers on
such system does not really work either because we use structs, defines, and
enum values from the newer headers in the kernel-netlink plugin.

__kernel_sa_family_t is defined in linux/socket.h so we ship that too (in
particular the simplified UAPI version from Linux 3.7+).

Fixes #1099.

History

#1 Updated by Tobias Brunner almost 5 years ago

  • Tracker changed from Bug to Issue
  • Description updated (diff)
  • Category set to build
  • Status changed from New to Feedback

Your kernel version is probably quite old (in particular the headers). The headers we ship in source:src/include are compatible with Linux 3.1 and newer (when __kernel_sa_family_t replaced sa_family_t). Most distributions ship newer kernels. You can try building against the headers on your host (or the target platform) by passing --with-linux-headers=<path to headers> (e.g. --with-linux-headers=/usr/include).

#2 Updated by Tobias Brunner almost 5 years ago

  • Affected version changed from 5.3.2 to 5.3.3

#3 Updated by Pavel Kopchyk almost 5 years ago

Hi,

I have the same problem (system CentOS 6.7 - 2.6.32-573.3.1.el6.i686)

./configure
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../../.. -I../../../../src/include -I../../../../src/libstrongswan -I../../../../src/libhydra -DROUTING_TABLE=220 -DROUTING_TABLE_PRIO=220 -rdynamic -g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -include /home/kopchyk/rpmbuild/BUILD/strongswan-5.3.3/config.h -MT kernel_netlink_ipsec.lo -MD -MP -MF .deps/kernel_netlink_ipsec.Tpo -c kernel_netlink_ipsec.c  -fPIC -DPIC -o .libs/kernel_netlink_ipsec.o
In file included from kernel_netlink_ipsec.c:25:
../../../../src/include/linux/netlink.h:36: error: expected specifier-qualifier-list before '__kernel_sa_family_t'
In file included from kernel_netlink_ipsec.c:26:
../../../../src/include/linux/rtnetlink.h:357: error: expected specifier-qualifier-list before '__kernel_sa_family_t'
kernel_netlink_ipsec.c: In function 'receive_events':
kernel_netlink_ipsec.c:1036: error: 'struct sockaddr_nl' has no member named 'nl_pid'
kernel_netlink_ipsec.c: In function 'kernel_netlink_ipsec_create':
kernel_netlink_ipsec.c:2956: error: 'struct sockaddr_nl' has no member named 'nl_family'
kernel_netlink_ipsec.c:2966: error: 'struct sockaddr_nl' has no member named 'nl_groups'
make[4]: *** [kernel_netlink_ipsec.lo] Error 1
make[4]: Leaving directory `/rpmbuild/BUILD/strongswan-5.3.3/src/libhydra/plugins/kernel_netlink'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/rpmbuild/BUILD/strongswan-5.3.3/src/libhydra'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/rpmbuild/BUILD/strongswan-5.3.3/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/rpmbuild/BUILD/strongswan-5.3.3'
make: *** [all] Error 2
./configure --with-linux-headers=/usr/include
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../../.. -I/usr/include -I../../../../src/libstrongswan -I../../../../src/libhydra -DROUTING_TABLE=220 -DROUTING_TABLE_PRIO=220 -rdynamic -g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -include /home/kopchyk/rpmbuild/BUILD/strongswan-5.3.3/config.h -MT kernel_netlink_ipsec.lo -MD -MP -MF .deps/kernel_netlink_ipsec.Tpo -c kernel_netlink_ipsec.c  -fPIC -DPIC -o .libs/kernel_netlink_ipsec.o
kernel_netlink_ipsec.c:145: error: 'XFRMA_REPLAY_ESN_VAL' undeclared here (not in a function)
kernel_netlink_ipsec.c: In function 'add_sa':
kernel_netlink_ipsec.c:1482: error: 'XFRMA_TFCPAD' undeclared (first use in this function)
kernel_netlink_ipsec.c:1482: error: (Each undeclared identifier is reported only once
kernel_netlink_ipsec.c:1482: error: for each function it appears in.)
kernel_netlink_ipsec.c:1502: error: dereferencing pointer to incomplete type
kernel_netlink_ipsec.c:1508: error: dereferencing pointer to incomplete type
kernel_netlink_ipsec.c:1509: error: dereferencing pointer to incomplete type
kernel_netlink_ipsec.c:1515: error: 'XFRM_STATE_ESN' undeclared (first use in this function)
kernel_netlink_ipsec.c: At top level:
kernel_netlink_ipsec.c:1557: warning: 'struct xfrm_replay_state_esn' declared inside parameter list
kernel_netlink_ipsec.c: In function 'get_replay_state':
kernel_netlink_ipsec.c:1640: error: dereferencing pointer to incomplete type
kernel_netlink_ipsec.c: In function 'update_sa':
kernel_netlink_ipsec.c:1894: warning: passing argument 6 of 'get_replay_state' from incompatible pointer type
kernel_netlink_ipsec.c:1551: note: expected 'struct xfrm_replay_state_esn **' but argument is of type 'struct xfrm_replay_state_esn **'
make[4]: *** [kernel_netlink_ipsec.lo] Error 1
make[4]: Leaving directory `/rpmbuild/BUILD/strongswan-5.3.3/src/libhydra/plugins/kernel_netlink'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/rpmbuild/BUILD/strongswan-5.3.3/src/libhydra'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/rpmbuild/BUILD/strongswan-5.3.3/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/rpmbuild/BUILD/strongswan-5.3.3'
make: *** [all] Error 2

#4 Updated by Tobias Brunner almost 5 years ago

Yeah, the errors in the second log are the reason why we ship some of the headers in the first place (to avoid having to plaster the code with #ifdefs). I guess we could also ship linux/socket.h. Could you try the attached patch (without --with-kernel-headers).

#5 Updated by Pavel Kopchyk almost 5 years ago

Thanks Tobias, this patch works for me.

#6 Updated by Tobias Brunner almost 5 years ago

  • Tracker changed from Issue to Bug
  • Status changed from Feedback to Closed
  • Assignee set to Tobias Brunner
  • Target version set to 5.3.4
  • Resolution set to Fixed

OK, thanks for testing. I pushed the commit to master.

#7 Updated by Tobias Brunner almost 5 years ago

  • Related to Issue #1166: Strongswan [strongswan-5.3.3.tar.bz2] is not compiling in opensuse linux12 2.6.32.12-0.7-default . added

Also available in: Atom PDF