I work at an engineering company. Here, we use a Linux host where are installed licenses of an engineering commercial software, called Abaqus.
Abaqus has a "make" procedure, that makes executable programs using a user soubroutine source code, or the correspondent object file. Here, Abaqus makes use of icpc/ifort compiler to compile C/Fortran codes. My program is written in Fortran, but it uses modules, so instead of using the "make" procedure with the source code of the main program, I precompiled the modules, then compiled the main program (both using ifort), and finally tried the "make" procedure with the object file (according to Abaqus Documentation, that is completely possible).
The problem is that, apparently, during the make procedure, Abaqus needs to compile an internal source code, in C language, and icpc gives this error: Could not open source file "limits.h" . Here goes a copy of the terminal:
tm@master1:/data/users/tm> abaqus make job=abqmain.o
Abaqus JOB abqmain
Begin Compiling User Post-Processing Program
Fri 03 May 2013 02:47:38 PM CEST
icpc: Command line warning: ignoring option '-c'; no argument required
/usr/include/limits.h(125): catastrophic error: could not open source file "limits.h"
# include_next <limits.h>
compilation aborted for /data/users/tm/main_6425.C (code 4)
Abaqus Error: Problem during compilation - /data/users/tm/TM/1_Rchar_Calibration/Fortran/main_6425.C
The Abaqus Make execution procedure exited with errors
Apparently, it's an icpc issue, but I'd rather do not change the Abaqus compilator to gcc.
I searched on the internet, and I found a possible solution, that would be the command:
But I doesn't really know what this command does, and also I don't know if it will actually work. I found it in the end of this page, under "Common Problems": http://www.gentoo-wiki.info/HOWTO_ICC_and_Portage
I am afraid to damage the company's host if I use this command. Also, I currently don't have permission to do it, so I have to be pretty sure this is the solution before asking for permission.
Can anyone help me? That solution really works? Is there someway to "undo" the command, so I can run it and latter undo it? Also, does someone know if there is an alternative, or will I have to use gcc?
describes #include_next and apparently recommends against its use other than for the specific purpose of excluding the preceding search paths. If there is only one <limits.h> on your search path (the normal case), the usual #include <limits.h> should be fine.
You could simply keep a backup copy of the source code and try replacing include_next by include, as needed, but if you are concerned about it, you should consult Abaqus support.
The icpc version is: icpc (ICC) 9.1 20070510
You could simply keep a backup copy of the source code and try replacing include_next by include
I believe that could be a solution, however I don't have the source code of this file, main_6425.C . It is automatically created by Abaqus.
I will contact Abaqus support too, but I am still open to other possible solutions.
But I didn't quite understand this thing: why does the limits.h file has an include statement to "include itself"?
/* 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>
Do you know which directories come after /usr/include in the search path? Can I simply make a copy of limits.h in one of these directories? Is the current directory one of them?
Also, this limits.h file is seeming a little strange for me, I think it may have been edited, look:
[cpp]/* If we are not using GNU CC we have to define all the symbols ourself.
Otherwise use gcc's definitions (see below). */
#if !defined __GNUC__ || __GNUC__ < 2
Following here there are a lof of definitions
Here, the condition is !defined __GNUC__ || __GNUC__ < 2
So, we should expect that before #include_next, the condition should be the opposite (adding the !defined _GCC_LIMITS_H_) : defined __GNUC__ && __GNUC__ >= 2 && !defined _GCC_LIMITS_H_
Am I wrong?
Sergey Kostrov wrote:
About construction: #include_next " someheaderfile ". It is used in many another headers, like float.h, stdarg.h, stddef.h, etc.
So, there should be another limits.h file in the search path? And (I am sorry to ask again) in the case of the limits.h file, do you know for which reason it has to be re-included? I am insisting in this question because, apparently, it should be re-included if I was using a GCC compiler, which is not the case.
Thank you a lot