Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCC build problem (#include_next limits.h)

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?

like image 733
Jonas Byström Avatar asked May 16 '09 08:05

Jonas Byström


People also ask

What is GCC build?

The GNU Compiler Collection, commonly known as GCC, is a set of compilers and development tools available for Linux, Windows, various BSDs, and a wide assortment of other operating systems. It includes support primarily for C and C++ and includes Objective-C, Ada, Go, Fortran, and D.

Is GCC a build tool?

gcc is a compiler, make is a tool to help build programs. The difference is huge. You can never build a program purely using make; it's not a compiler. What make does it introduce a separate file of "rules", that describes how to go from source code to finished program.

Where is the GCC build directory?

You need to use the which command to locate c compiler binary called gcc. Usually, it is installed in /usr/bin directory.

Is GCC bootstrapped?

GCC is a complex beast and a binary of it is often used to bootstrap the whole system. Version 4.7 is the last version of GCC to not require a C++ compiler. This project aims to build GCC version 4.7 with a simple C compiler such as TinyCC.


3 Answers

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:

MAKEDEPPROG=makedepend

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:

MAKEDEPPROG=makedepend -I < path/to/cross-compiler/include-fixed >

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.

like image 137
JSAnderson Avatar answered Nov 15 '22 12:11

JSAnderson


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).

like image 31
Alexander Samoylov Avatar answered Nov 15 '22 12:11

Alexander Samoylov


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.

like image 2
sudar Avatar answered Nov 15 '22 11:11

sudar