编译包含open("FILENAME", O_RDONLY);
没有-O2
标志一切都很好。 但是当-O2
打开时,我得到:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h: In function 'open': /usr/include/x86_64-linux-gnu/bits/fcntl2.h:44:7: error: invalid use of '__builtin_va_arg_pack_len ()' /usr/include/x86_64-linux-gnu/bits/fcntl2.h:45:26: error: call to '__open_too_many_args' declared with attribute error: open can be called either with 2 or 3 arguments, not more /usr/include/x86_64-linux-gnu/bits/fcntl2.h:42:1: error: invalid use of '__builtin_va_arg_pack_len ()' /usr/include/x86_64-linux-gnu/bits/fcntl2.h:60:3: error: invalid use of '__builtin_va_arg_pack ()' /usr/include/x86_64-linux-gnu/bits/fcntl2.h: In function 'open64': /usr/include/x86_64-linux-gnu/bits/fcntl2.h:76:7: error: invalid use of '__builtin_va_arg_pack_len ()' /usr/include/x86_64-linux-gnu/bits/fcntl2.h:77:28: error: call to '__open64_too_many_args' declared with attribute error: open64 can be called either with 2 or 3 arguments, not more /usr/include/x86_64-linux-gnu/bits/fcntl2.h:74:1: error: invalid use of '__builtin_va_arg_pack_len ()' /usr/include/x86_64-linux-gnu/bits/fcntl2.h:92:3: error: invalid use of '__builtin_va_arg_pack ()' /usr/include/x86_64-linux-gnu/bits/fcntl2.h: In function 'openat': /usr/include/x86_64-linux-gnu/bits/fcntl2.h:120:7: error: invalid use of '__builtin_va_arg_pack_len ()' /usr/include/x86_64-linux-gnu/bits/fcntl2.h:121:28: error: call to '__openat_too_many_args' declared with attribute error: openat can be called either with 3 or 4 arguments, not more /usr/include/x86_64-linux-gnu/bits/fcntl2.h:118:1: error: invalid use of '__builtin_va_arg_pack_len ()' /usr/include/x86_64-linux-gnu/bits/fcntl2.h:136:3: error: invalid use of '__builtin_va_arg_pack ()' /usr/include/x86_64-linux-gnu/bits/fcntl2.h: In function 'openat64': /usr/include/x86_64-linux-gnu/bits/fcntl2.h:154:7: error: invalid use of '__builtin_va_arg_pack_len ()' /usr/include/x86_64-linux-gnu/bits/fcntl2.h:155:30: error: call to '__openat64_too_many_args' declared with attribute error: openat64 can be called either with 3 or 4 arguments, not more /usr/include/x86_64-linux-gnu/bits/fcntl2.h:152:1: error: invalid use of '__builtin_va_arg_pack_len ()' /usr/include/x86_64-linux-gnu/bits/fcntl2.h:170:3: error: invalid use of '__builtin_va_arg_pack ()'
哪里可以解决问题? 它是混合的C/C++
项目,但这是在C
部分。 gcc 4.6.1,内核3.0.0
编辑:事实certificate,这些线条给出了另一种“types”的错误,如:
/usr/include/x86_64-linux-gnu/bits/stdio2.h: In function 'sprintf': /usr/include/x86_64-linux-gnu/bits/stdio2.h:34:3: error: invalid use of '__builtin_va_arg_pack ()'
尝试使用-fno-builtins
编译。 如果解决了这个问题,那么你显然会遇到某种问题,但这可能不是你的原因。
我只是简单地下载一个不同的(稍微老一点的)内核版本:
这是一个错误报告,无论它是值得的:
https://bugs.archlinux.org/task/27100
不,我不知道为什么“-O2”与这个特定的错误有什么关系。
附录:这个链接可能会给你更多关于错误信息本身的解释。 但是再次 – 我建议尝试一个不同的内核构建作为你的第一步:
如果您想忽略此错误,请考虑删除标志-Wp,-D_FORTIFY_SOURCE=2
。 例如,如果您使用rpmbuild
,则此标志由RPM_OPT_FLAGS
引入
%build export CFLAGS="$RPM_OPT_FLAGS" export CXXFLAGS="$RPM_OPT_FLAGS" ./configure …
这是一个简单的方法来保持一切,但提到的国旗
OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's/-Wp,-D_FORTIFY_SOURCE=2 //'` export CFLAGS="$OPT_FLAGS" export CXXFLAGS="$OPT_FLAGS"