Forum Jump

Select Group :
Select Forum :
Sorted By :
Sort Order :
From The :
 
Thread Tools  Search this thread 
mattst88
Total Points:
120
Status Points:
0
Green Belt
July 22, 2008 9:44 AM PDT
Problems including limits.h with icc-10.1.017 on Linux
Hi,

I have problems compiling programs that use limits.h such as PHP. The symptoms of this problem appear to differ from person to person and from x86 to x86_64. For instance, I can compile the same version of PHP cleanly with my x86 server, but the compile fails with my Core 2 x86_64 laptop and my Sempron 64 desktop. See this thread for reports.

Commonly, I receive this error:

/usr/include/gentoo-multilib/amd64/limits.h(125): catastrophic error: could not open source file "limits.h"
 # include_next 
                          ^ 

I tried reproducing it with a simple test program, but was unable:

#include 

int main() { return 0; }
realnc
July 22, 2008 5:15 PM PDT
Rate
 
#1
Confirmed with GCC 4.3.1 on 64-bit. Always reproducible with the following C++ program:

#include <limits.h>
int main()
{ return 0; }

icpc test.cpp
/usr/include/limits.h(125): catastrophic error: could not open source file
"limits.h"

There is no problem with C. Only C++.


tim18
Total Points:
68,887
Status Points:
68,887
Black Belt
July 22, 2008 7:39 PM PDT
Rate
 
#2 Reply to #1
This doesn't look like a problem with icpc.  You are running non-standard C++ (<limits.h> in place of <climits>) on an unsupported target.  icpc tries to use this header the same way as g++, unless something is done behind our backs to break it.  Unfortunately, g++ 4.3.1 is somewhat newer than what icpc 10.1 was built to support, so there will undoubtedly be problems elsewhere.


realnc
July 23, 2008 8:18 AM PDT
Rate
 
#3 Reply to #2
The problem persists even with #include <climits> instead of #include <limits.h> (the error message does not change, it still refers to "/usr/include/limits.h").

I know of course that GCC 4.3.1 is too new to be supported. I'm just confirming that there is a problem because I assume ICC makes an effort to be GCC compatible.

The code in /usr/include/limits.h where the error happens:

/* 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


mattst88
Total Points:
120
Status Points:
0
Green Belt
July 23, 2008 10:17 AM PDT
Rate
 
#4 Reply to #2
This should have been stated earlier, but I experience this with gcc-4.2.x. This isn't a gcc-4.3 issue.


tim18
Total Points:
68,887
Status Points:
68,887
Black Belt
July 23, 2008 10:28 AM PDT
Rate
 
#5 Reply to #3
Yes, icpc makes every attempt to search the paths owned by g++, in the same way that the g++ which is active in the same session does.     If this problem occurs with icpc, but not with g++, something is wrong with the icpc installation.  According to you first post, the include file system in your distro is different from the supported distros.
I'm not expert on it, but this _GCC_LIMITS_H_ scheme appears to be designed to cause the <limits.h> provided by your glibc or other system library installation to be included the first time only, while adding some stuff determined during the fixincludes phase of gcc build.  On my linux installation, that system file is /usr/include/limits.h.  According to your diagnostic, it may be different on yours.
It's also possible to make a plain limits.h using the Pemberton enquire.c program which used to be provided with gcc, in order to use K&R C to bootstrap in the absence of a system <limits.h>.  Maybe you could add that in your project and get something more compatible with generic software.  enquire.c should work identically with gcc or icc.


realnc
July 23, 2008 11:38 AM PDT
Rate
 
#6 Reply to #5
icpc can't find a limits.h even if I compile with:

icpc -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/include-fixed -I./ -I/opt/intel/cce/10.1.017/include test.cpp

And I created a dummy limits.h in the current directory. icpc simply refuses to pick up a limits.h no matter what.

Using the -no-gcc switch fixes the problem though. But a lot packages won't build with -no-gcc.

Also, compiling with -D_GCC_LIMITS_H_ fixes it too, but I really don't think that's a good idea.



carlo@alinoe.com
September 4, 2008 8:10 PM PDT
Rate
 
#7 Reply to #6
I can confirm that this problem still exists with 10.1.018 (Intel takes 'not supported' very seriously)...



wvermin
February 18, 2009 2:04 AM PST
Rate
 
#8 Reply to #6
Quoting - realnc
icpc can't find a limits.h even if I compile with:

icpc -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.1/include-fixed -I./ -I/opt/intel/cce/10.1.017/include test.cpp

And I created a dummy limits.h in the current directory. icpc simply refuses to pick up a limits.h no matter what.

Using the -no-gcc switch fixes the problem though. But a lot packages won't build with -no-gcc.

Also, compiling with -D_GCC_LIMITS_H_ fixes it too, but I really don't think that's a good idea.

 

Another, probably better solution:

 

icc (or icpc) -idirafter/usr/include/linux .....





Kittur Ganesh (Intel)
Total Points:
4,082
Status Points:
3,582
Brown Belt
February 18, 2009 4:04 PM PST
Rate
 
#9 Reply to #8

Hi,
This issue has been fixed in the 10.1.021 version upwards (based on the build date  that I verified). Could you please download the latest version 10.1.022 and try it out? If the problem still exists, please let me know. Also, the latest 11.0 version 11.0.081 should not have this problem too, just FYI.

The work-around earlier when the problem existed was to use -D_GCC_LIMITS_H_ option. But, it should be fixed in the latest 10.1 version. I tested with that version again on x86_64 EL5 and it worked fine. 

-regards,
Kittur

mattst88
Total Points:
120
Status Points:
0
Green Belt
March 4, 2009 9:27 PM PST
Rate
 
#10 Reply to #9
Hi,

Yes, I just confirmed that 10.1.021 does not have this problem.

Thanks so much!


NB
Total Points:
60
Status Points:
10
Green Belt
July 21, 2009 1:03 PM PDT
Rate
 
#11
Hi,

Using icc/icpc version 11.0.083 (build 20090318), I don't have any problem.

But I just upgraded to 11.1.046 and now I can't compile my C++ code, I'm having the same issue as posted above. I cannot use "-idirafter /usr/include/linux" or "-D_GCC_LIMITS_H_" in CFLAGs because I need CHAR_BIT which is defined in limits.h...

Anything could be done for that?

Thanx


Jennifer Jiang (Intel)
Total Points:
20,237
Status Points:
19,737
Brown Belt
July 21, 2009 2:50 PM PDT
Rate
 
#12 Reply to #11
Quoting - NB
Hi,

Using icc/icpc version 11.0.083 (build 20090318), I don't have any problem.

But I just upgraded to 11.1.046 and now I can't compile my C++ code, I'm having the same issue as posted above. I cannot use "-idirafter /usr/include/linux" or "-D_GCC_LIMITS_H_" in CFLAGs because I need CHAR_BIT which is defined in limits.h...

Anything could be done for that?

Thanx

what is your gcc version? I've tried icpc 11.1.046 with gcc 4.3 and 4.1.2, icpc compiles fine with following src:

#include <limits.h>
int main()
{ return 0; }



NB
Total Points:
60
Status Points:
10
Green Belt
July 21, 2009 5:36 PM PDT
Rate
 
#13 Reply to #12

what is your gcc version? I've tried icpc 11.1.046 with gcc 4.3 and 4.1.2, icpc compiles fine with following src:

#include <limits.h>
int main()
{ return 0; }


I am using gcc version 4.4.0 20090630 on ArchLinux. I tried the previous simple example. It works with g++ but not with icpc:
$ icpc test.cpp -o test
/usr/include/limits.h(125): catastrophic error: could not open source file "limits.h"
# include_next <limits.h>
^
compilation aborted for test.cpp (code 4)

I also tried workwaround flags:
$ icpc -no-gcc test.cpp -o test
ld: cannot find -limf
$icpc -idirafter /usr/include/linux test.cpp -o test
ld: cannot find -limf

I would prefer a real solution to a workaround CFLAG. I'll re-verify my installation, but it is simply an upgrade from 11.0...

Thanx a lot.

N


NB
Total Points:
60
Status Points:
10
Green Belt
August 13, 2009 10:18 AM PDT
Rate
 
#14 Reply to #13
After re-packaging / re-installing the compiler, everything works fine. Was probably an error in the installation and not the compiler...




Intel Software Network Forums Statistics

8487 users have contributed to 31622 threads and 100698 posts to date.
In the past 24 hours, we have 35 new thread(s) 121 new posts(s), and 186 new user(s).

In the past 3 days, the most popular thread for everyone has been gemm(A,A,A) like possible? The most posts were made to gemm(A,A,A) like possible? The post with the most views is Dear Steve, excuse me for a d

Please welcome our newest member chat1983