GCC 构建问题(#include_next limit.h)
当我尝试
$ make depend -f gcc.mak
在我的 Ubuntu 机器上使用中间件时,我得到了
/usr/include/../include/limits.h:125:26: error: no include path in which to search for limits.h
This is thecontents around Limits.h:125:
/* Get the compiler's limits.h, which defines almost all the ISO constants. We put this #include_next outside the double inclusion check because it should be possible to include this file more than once and still get the definitions from gcc's header. */ #if defined __GNUC__ && !defined _GCC_LIMITS_H_ /* `_GCC_LIMITS_H_' is what GCC's file defines. */ # include_next <limits.h> #endif
I attempts set
$ export INCLUDE=/usr/lib/gcc/x86_64-linux-gnu/4.3/include-fixed/ $ export C_INCLUDE_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.3/include-fixed/ $ export CPLUS_INCLUDE_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.3/include-fixed/
(这是我在系统上找到另一个 Limits.h 的地方)。 我已经安装了libc6-dev,难道它的limits.h已经被另一个包覆盖了? 我需要另一个 -dev 包吗? 或者是否需要环境变量; 也许这可以通过其他方式规避?
When i try to
$ make depend -f gcc.mak
a middleware on my Ubuntu machine I get this
/usr/include/../include/limits.h:125:26: error: no include path in which to search for limits.h
This is the contents around limits.h:125:
/* Get the compiler's limits.h, which defines almost all the ISO constants. We put this #include_next outside the double inclusion check because it should be possible to include this file more than once and still get the definitions from gcc's header. */ #if defined __GNUC__ && !defined _GCC_LIMITS_H_ /* `_GCC_LIMITS_H_' is what GCC's file defines. */ # include_next <limits.h> #endif
I tried setting
$ export INCLUDE=/usr/lib/gcc/x86_64-linux-gnu/4.3/include-fixed/ $ export C_INCLUDE_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.3/include-fixed/ $ export CPLUS_INCLUDE_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.3/include-fixed/
(which is where I found another limits.h on my system). I already have libc6-dev installed, could it be that its limits.h has been overwritten by another package? Do I need another -dev package? Or is an environment variable required; perhaps this could be circumvented in some other way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我在交叉编译时遇到过这个问题。 当您执行“make dependent”时,Makefile 将调用 makedepend 程序,如以下分配所示:
makedepend 只搜索以
/usr/include
开头的一些默认包含目录由于
#include_next 指令意味着在搜索路径中包含指定包含文件的下一个找到的实例,如果未找到另一个实例,则此操作将失败。
对我来说,解决方案是直接 makedepend 首先搜索我的交叉编译器包含目录。 我通过更改
MAKEDEPPROG
赋值以包含-I
指令来做到这一点:我建议阅读有关 makedepend 程序的内容(我以前对此一无所知)。 例如,对于我来说 makedepend 不会使用环境搜索路径并不明显。
-I
指令将指定的搜索路径放在 makedepend 的默认路径之前。I have encountered this problem doing a cross-compile. When you execute a 'make depend' the Makefile will invoke the makedepend program as seen from this assignment:
makedepend only searches some default include directories starting with
/usr/include
Since the
#include_next
directive means to include the next found instance of the named include file in the search path, this will fail if another one is not found.For me, the solution was to direct makedepend to search my cross-compiler include directories first. I did this by changing the
MAKEDEPPROG
assignment to include the-I
directive:I suggest reading about the makedepend program (about which I knew nothing before). For example, it was not obvious to me that makedepend would not use an environment search path. The
-I
directive puts the specified search path before makedepend's default paths.我在使用 STLport 5.1.5 进行编译时遇到了问题,但看起来问题在 STLport 5.2.0 中已得到解决。 该问题记录在 STLport 发行说明中。 获得 STLport 5.2.1 的副本后,编译成功,没有出现任何问题。
I had faced my problem with compiling with STLport 5.1.5, but looks like the issue is fixed is STLport 5.2.0. The issue is documented in STLport Release Notes. After getting a copy of STLport 5.2.1, the compilation went successfully without hiccups.
这很可能是这个问题: https://jira.apache.org/jira/browse /STDCXX-768。
我的解决方法是添加编译器选项-I/usr/lib/gcc/x86_64-linux-gnu/4.3/include-fixed(此路径包含limits.h)。
This is most likely this issue: https://jira.apache.org/jira/browse/STDCXX-768.
The workaround for me was to add the compiler option -I/usr/lib/gcc/x86_64-linux-gnu/4.3/include-fixed (this path contains limits.h).
您需要的包是 glibc。
the package that you need is glibc.
考虑使用
#include_next
(gcc 扩展)来强制 gcc 查看包含路径中下一个找到的limits.h
(应该是工具集的副本)。Consider using
#include_next <limits.h>
(gcc extension) in order to force gcc to look at the next foundlimits.h
in the include path (which should be the toolset's copy).我不再确切地记得该解决方案,但它与一些丢失的软件包有关。 在获得更多东西之后,它对我有用。
I don't exactly remember the resolution any more, but it had to do with some missing package. After apt-getting some more stuff, it worked for me.