编译strongSwan报错 error: ‘uintptr_t‘ undeclared (first use in this function); did you mean ‘__intptr_t‘
/bin/sh ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/libstrongswan -DIPSEC_DIR=\"/usr/libexec/strongswan\" -DIPSEC_LIB_DIR=\"/usr/lib64/strongswan\" -DPLUGINDIR=\"/usr/lib64/strongswan/plugins\" -DSTRONGSWAN_CONF=\"/etc/strongswan/strongswan.conf\" -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -Wno-pointer-sign -include /builddir/build/BUILD/strongswan-5.6.0/config.h -c -o crypto/transform.lo crypto/transform.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/libstrongswan -DIPSEC_DIR=\"/usr/libexec/strongswan\" -DIPSEC_LIB_DIR=\"/usr/lib64/strongswan\" -DPLUGINDIR=\"/usr/lib64/strongswan/plugins\" -DSTRONGSWAN_CONF=\"/etc/strongswan/strongswan.conf\" -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -Wno-pointer-sign -include /builddir/build/BUILD/strongswan-5.6.0/config.h -c library.c -fPIC -DPIC -o .libs/library.o
In file included from utils/utils.h:55:0,
from library.h:101,
from library.c:17:
utils/utils/memory.h: In function 'memwipe_inline':
utils/utils/memory.h:99:15: error: 'uintptr_t' undeclared (first use in this function); did you mean '__intptr_t'?
for (i = 0; (uintptr_t)&c[i] % sizeof(long) && i < n; i++)
^~~~~~~~~
__intptr_t
utils/utils/memory.h:99:15: note: each undeclared identifier is reported only once for each function it appears in
原因:
最新版本的 glibc 在某些版本中不包含完整的 stdint.h 标头
解决方法:
修改 src/libstrongswan/utils/utils.h:
#define _GNU_SOURCE
#include <sys/types.h>
#include <stdlib.h>
#include <stdint.h> //加入这行
#include <stddef.h>
#include <sys/time.h>
#include <string.h>
参考
https://wiki.strongswan.org/issues/2425

浙公网安备 33010602011771号