Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

'_LIB_VERSION_TYPE is undefined' icc and icps errors under Debian Sid

Kokot__Seweryn
Beginner
6,532 Views

Hello,

I installed Intel® Parallel Studio XE 2018 both Update 1 and 2 under Debian Stretch and compiling with icc and icpc worked well. Then I upgraded my system to Debian Sid (Unstable) and then when trying to compile with both icc or icps I get the following error:  

/home/user/intel/compilers_and_libraries_2018.2.199/linux/compiler/include/math.h(1230): error: identifier "_LIB_VERSION_TYPE" is undefined
  _LIBIMF_EXTERN_C _LIB_VERSIONIMF_TYPE _LIBIMF_PUBVAR _LIB_VERSIONIMF;
                   ^

Then I installed Intel® Parallel Studio XE 2018 on the latest Arch Linux and the same code compilations went without problems.

During installation of Intel® Parallel Studio XE 2018 both Debian Sid and Arch Linux are unsupported OSs so perhaps there is a solution to make Intel Compilers work under Debian Sid? Any idea?

 

0 Kudos
18 Replies
Viet_H_Intel
Moderator
6,532 Views

Hi,

We are recommended to use Intel compiler on the list of distributions tested by Intel listed on the Release Notes. Other distributions may or may not work and are not recommended.

The list may change overtime and we will public the new Linux distributions list in the Release Notes.

Thanks,

Viet

0 Kudos
Jingwei_Z_Intel
Employee
6,532 Views

_LIB_VERSION_TYPE is usually defined in math.h header file, check your system header file to see if it's defined. If it's not, one possible solution is to add "-D__PURE_INTEL_C99_HEADERS__" to use _LIB_VERSION_TYPE defined in Intel's math.h

/usr/include/math.h

#ifdef  __USE_MISC
/* Support for various different standard error handling behaviors.  */
typedef enum
{
  _IEEE_ = -1,  /* According to IEEE 754/IEEE 854.  */
  _SVID_,       /* According to System V, release 4.  */
  _XOPEN_,      /* Nowadays also Unix98.  */
  _POSIX_,
  _ISOC_        /* Actually this is ISO C99.  */
} _LIB_VERSION_TYPE;

/* This variable can be changed at run-time to any of the values above to
   affect floating point error handling behavior (it may also be necessary
   to change the hardware FPU exception settings).  */
extern _LIB_VERSION_TYPE _LIB_VERSION;
#endif

 

0 Kudos
Kokot__Seweryn
Beginner
6,532 Views

Thank you for help. In fact on Debian Sid there is no _LIB_VERSION_TYPE in the system math.h header files.

I added -D__PURE_INTEL_C99_HEADERS__ and then other errors occur as follows:

icpc -D_LINUX -D_UNIX -D_TCL85 -D_BLAS -D_NOGRAPHICS   -O3 -D__PURE_INTEL_C99_HEADERS__  -I/usr/include/tcl8.6 -I/home/sewi/opensees-git/SRC/matrix <more includes trimmed> -c TclPlaneStressMaterialTester.cpp -o TclPlaneStressMaterialTester.o
In file included from /usr/include/c++/7/cmath(45),
                 from /home/sewi/opensees-git/SRC/material/uniaxial/PY/PySimple1Gen.h(41),
                 from TclModelBuilder.cpp(103):
/usr/include/math.h(155): error: invalid redeclaration of type name "float_t" (declared at line 267 of "/home/sewi/intel/compilers_and_libraries_2018.2.199/linux/compiler/include/math.h")
  typedef long double float_t;
                      ^

In file included from /usr/include/c++/7/cmath(45),
                 from /home/sewi/opensees-git/SRC/material/uniaxial/PY/PySimple1Gen.h(41),
                 from TclModelBuilder.cpp(103):
/usr/include/math.h(156): error: invalid redeclaration of type name "double_t" (declared at line 268 of "/home/sewi/intel/compilers_and_libraries_2018.2.199/linux/compiler/include/math.h")
  typedef long double double_t;
                      ^

In file included from /usr/include/c++/7/cmath(45),
                 from /home/sewi/opensees-git/SRC/material/uniaxial/PY/PySimple1Gen.h(41),
                 from TclModelBuilder.cpp(103):
/usr/include/math.h(571): error: expected an identifier
      FP_NAN =
      ^

In file included from /usr/include/c++/7/cmath(45),
                 from /home/sewi/opensees-git/SRC/material/uniaxial/PY/PySimple1Gen.h(41),
                 from TclModelBuilder.cpp(103):
/usr/include/math.h(574): error: expected an identifier
      FP_INFINITE =
      ^

In file included from /usr/include/c++/7/cmath(45),
                 from /home/sewi/opensees-git/SRC/material/uniaxial/PY/PySimple1Gen.h(41),
                 from TclModelBuilder.cpp(103):
/usr/include/math.h(577): error: expected an identifier
      FP_ZERO =
      ^

---------------

Any idea?

0 Kudos
Jingwei_Z_Intel
Employee
6,532 Views

That seems like a conflict between math.h from Intel Parallel Studio and the Debian system.

Adding -D__PURE_INTEL_C99_HEADERS__ should ensure only math.h from Intel Parallel Studio is used, if math.h from Intel is included first. I am not sure what happened in your case.

Another possible fix would be just adding

typedef enum ___LIB_VERSIONIMF_TYPE {
     _IEEE_ = -1    /* IEEE-like behavior    */
    ,_SVID_         /* SysV, Rel. 4 behavior */
    ,_XOPEN_        /* Unix98                */
    ,_POSIX_        /* Posix                 */
    ,_ISOC_         /* ISO C9X               */
} _LIB_VERSIONIMF_TYPE;

in any of your own header files.

0 Kudos
Kokot__Seweryn
Beginner
6,532 Views

Since the source code I compile is not developed by me (I often download revisions from svn repository) and contains hundreds of header files, adding

typedef enum ___LIB_VERSIONIMF_TYPE {
     _IEEE_ = -1    /* IEEE-like behavior    */
    ,_SVID_         /* SysV, Rel. 4 behavior */
    ,_XOPEN_        /* Unix98                */
    ,_POSIX_        /* Posix                 */
    ,_ISOC_         /* ISO C9X               */
} _LIB_VERSIONIMF_TYPE;

is not possible. I tried added those lines into /usr/include/math.h but it does not work.

Regarding this comment:

Adding -D__PURE_INTEL_C99_HEADERS__ should ensure only math.h from Intel Parallel Studio is used, if math.h from Intel is included first. I am not sure what happened in your case.

investigating the following lines:

In file included from /usr/include/c++/7/cmath(45),
                 from /home/sewi/opensees-git/SRC/material/uniaxial/PY/PySimple1Gen.h(41),
                 from TclModelBuilder.cpp(103):
/usr/include/math.h(155): error: invalid redeclaration of type name "float_t" (declared at line 267 of "/home/sewi/intel/compilers_and_libraries_2018.2.199/linux/compiler/include/math.h")

I checked that PySimple1Gen.h file has line:

#include <cmath>

which points to usr/include/c++/7/cmath, which in turn has the following lines:

#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#include_next <math.h>
#undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS

It means that although -D__PURE_INTEL_C99_HEADERS__ is used, cmath enforces to use math.h from /usr/include/math.h

 

 

 

 

0 Kudos
Fabian_W_
Beginner
6,532 Views

I have the same issue that -D__PURE_INTEL_C99_HEADERS__ does not help when another file (third party has an #include <math.h>.

/usr/include/math.h has the guard #ifndef _MATH_H

but /home/opt/intel/compilers_and_libraries_2018.1.163/linux/compiler/include/math.h has the guard __MATH_H_INCLUDED

I get

/home/opt/intel/compilers_and_libraries_2018.1.163/linux/compiler/include/math.h(268): error: invalid redeclaration of type name "double_t" (declared at line 159 of "/usr/include/math.h")
  typedef double  double_t;


Trying to patch /usr/include/math.h with #ifndef __MATH_H_INCLUDED didn't work.

 

 

 

0 Kudos
Fabian_W_
Beginner
6,532 Views

I have a
typedef enum ___LIB_VERSIONIMF_TYPE {
     _IEEE_ = -1    /* IEEE-like behavior    */
    ,_SVID_         /* SysV, Rel. 4 behavior */
    ,_XOPEN_        /* Unix98                */
    ,_POSIX_        /* Posix                 */
    ,_ISOC_         /* ISO C9X               */
} _LIB_VERSIONIMF_TYPE;

in my C++ header file (as suggested above)

I compile with opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/icpc   -I/home/fwein/code/cfs/release_icc/include -I/home/fwein/code/cfs/source  -std=c++11 -w0 -Werror -qopenmp   -wd191,279,654,1125,1170,2259 -Wno-unknown-pragmas -Wno-comment -O3 -DNDEBUG   -o CMakeFiles/graph-olas.dir/BaseGraph.cc.o -c /home/fwein/code/cfs/source/OLAS/graph/BaseGraph.cc

In file included from /home/fwein/code/cfs/release_icc/include/boost/math/policies/policy.hpp(29), ... /home/opt/intel/compilers_and_libraries_2018.1.163/linux/compiler/include/math.h(1214): error: identifier "_LIB_VERSION_TYPE" is undefined _LIBIMF_EXTERN_C _LIB_VERSIONIMF_TYPE _LIBIMF_PUBVAR _LIB_VERSIONIMF; policy.hpp includes in line 29 #include and with #if (!defined(__linux__) || !defined(__USE_MISC)) && !defined(__NetBSD__) || defined (__PURE_INTEL_C99_HEADERS__) typedef enum ___LIB_VERSIONIMF_TYPE { _IEEE_ = -1 /* IEEE-like behavior */ ,_SVID_ /* SysV, Rel. 4 behavior */ ,_XOPEN_ /* Unix98 */ ,_POSIX_ /* Posix */ ,_ISOC_ /* ISO C9X */ } _LIB_VERSIONIMF_TYPE; #else #define _LIB_VERSIONIMF_TYPE _LIB_VERSION_TYPE #endif _LIBIMF_EXTERN_C _LIB_VERSIONIMF_TYPE _LIBIMF_PUBVAR _LIB_VERSIONIMF; in intel math.h I cannot understand the problem. Any hints on what I can do? Thanks!
0 Kudos
Fabian_W_
Beginner
6,532 Views

I found a dirty solution I actually don't really understand. I patched

as

/* Standard conformance support */
#if (!defined(__linux__) || !defined(__USE_MISC)) && !defined(__NetBSD__) || defined (__PURE_INTEL_C99_HEADERS__)
typedef enum ___LIB_VERSIONIMF_TYPE {
     _IEEE_ = -1    /* IEEE-like behavior    */
    ,_SVID_         /* SysV, Rel. 4 behavior */
    ,_XOPEN_        /* Unix98                */
    ,_POSIX_        /* Posix                 */
    ,_ISOC_         /* ISO C9X               */
} _LIB_VERSIONIMF_TYPE;
#else
#define _LIB_VERSIONIMF_TYPE _LIB_VERSION_TYPE
#endif

typedef enum ___LIB_VERSIONIMF_TYPE {
     _IEEE_ = -1    /* IEEE-like behavior    */
    ,_SVID_         /* SysV, Rel. 4 behavior */
    ,_XOPEN_        /* Unix98                */
    ,_POSIX_        /* Posix                 */
    ,_ISOC_         /* ISO C9X               */
} _LIB_VERSIONIMF_TYPE;
#define _LIB_VERSIONIMF_TYPE _LIB_VERSION_TYPE

_LIBIMF_EXTERN_C _LIB_VERSIONIMF_TYPE _LIBIMF_PUBVAR _LIB_VERSIONIMF;

Note that when adding the typedef to the #else case it did not work.

So this is a very dirty workaround for me at the moment.

0 Kudos
Bram_S_
New Contributor I
6,532 Views

The -D__PURE_INTEL_C99_HEADERS__ fix doesn't work for me.

I think this bug may originate from the fact that cmath is included?

/usr/include/math.h(155): error: invalid redeclaration of type name "float_t" (declared at line 267 of "/opt/intel/system_studio_2018/compilers_and_libraries_2018.2.199/linux/compiler/include/math.h")

 

0 Kudos
florian
Beginner
6,532 Views

I have the same issue on Ubuntu 18.04. when math.h and cmath are included... has somebody found a solution to this?

0 Kudos
cavalcante__lucas
6,532 Views

I have the same issue here. 
I'm also on Ubuntu 18.04.

Kind regards

0 Kudos
xie__biwei
Beginner
6,532 Views

My method works on my code. 

First, I came across this error.

/home/user/intel/compilers_and_libraries_2018.2.199/linux/compiler/include/math.h(1230): error: identifier "_LIB_VERSION_TYPE" is undefined
  _LIBIMF_EXTERN_C _LIB_VERSIONIMF_TYPE _LIBIMF_PUBVAR _LIB_VERSIONIMF;

Then, I comment this ' _LIB_VERSIONIMF_TYPE '. I mean , not the whole line, just this macro.

In the 1230L of math.h, change it like this:

//_LIBIMF_EXTERN_C _LIB_VERSIONIMF_TYPE _LIBIMF_PUBVAR _LIB_VERSIONIMF;

_LIBIMF_EXTERN_C  _LIBIMF_PUBVAR _LIB_VERSIONIMF;

Then, my case works fine now. 

0 Kudos
Johnny_W_
Beginner
6,532 Views

Same problem on Fedora 28

0 Kudos
quell__michael
Beginner
6,532 Views

Same issue on Linux Mint 19 Tara

0 Kudos
Stewart__Sarah
Beginner
6,532 Views

Same problem here with 18.04.

0 Kudos
Tianyu_L_1
Beginner
6,532 Views
Ubuntu 18.04 + icpc 2018 update 3 has the same problem, and biwei's patch just works since icpc now just ignore this marco. After all, Ubuntu 18.04 is not officially supported by the mentioned versions of icpc.
xie, biwei wrote:

My method works on my code. 

First, I came across this error.

/home/user/intel/compilers_and_libraries_2018.2.199/linux/compiler/include/math.h(1230): error: identifier "_LIB_VERSION_TYPE" is undefined
  _LIBIMF_EXTERN_C _LIB_VERSIONIMF_TYPE _LIBIMF_PUBVAR _LIB_VERSIONIMF;

Then, I comment this ' _LIB_VERSIONIMF_TYPE '. I mean , not the whole line, just this macro.

In the 1230L of math.h, change it like this:

//_LIBIMF_EXTERN_C _LIB_VERSIONIMF_TYPE _LIBIMF_PUBVAR _LIB_VERSIONIMF;

_LIBIMF_EXTERN_C  _LIBIMF_PUBVAR _LIB_VERSIONIMF;

Then, my case works fine now. 

0 Kudos
kang__yaotai
Beginner
6,532 Views

Same issue on Linux Deepin15.7

0 Kudos
Lu__You
Beginner
5,996 Views

It is indeed an annoying problem for a long time as we can't always freely switch compiler/OS or ask the users to choose one in reality. I am on Ubuntu 18.04 with Intel 18.0.0 and the following flags work for me:

icc -U__linux__ -U__USE_MISC -U__NetBSD__ -D__FreeBSD__ -U__PURE_INTEL_C99_HEADERS__

The key is to avoid both undefined _LIB_VERSION_TYPE and redeclaration of float_t at the same time by carefully using macros. In Intel 18's include/math.h:

#if (!defined(__linux__) || !defined(__USE_MISC)) && !defined(__NetBSD__) || defined (__PURE_INTEL_C99_HEADERS__)
typedef enum ___LIB_VERSIONIMF_TYPE {
    _IEEE_ = -1    /* IEEE-like behavior    */
   ,_SVID_         /* SysV, Rel. 4 behavior */
   ,_XOPEN_        /* Unix98                */
   ,_POSIX_        /* Posix                 */
   ,_ISOC_         /* ISO C9X               */
} _LIB_VERSIONIMF_TYPE;
#else
# define _LIB_VERSIONIMF_TYPE _LIB_VERSION_TYPE
#endif

_LIBIMF_EXT _LIB_VERSIONIMF_TYPE _LIBIMF_PUBVAR _LIB_VERSIONIMF;

Then _LIB_VERSION_TYPE has to be explicitly defined rather than being referred to _LIB_VERSION_TYPE. At the same time, in math.h:

#if (!defined (__linux__) && !defined(__APPLE__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__QNX__) && !defined(__VXWORKS__)) || defined (__PURE_INTEL_C99_HEADERS__)
#if defined (FLT_EVAL_METHOD) && (FLT_EVAL_METHOD == 0)
typedef float  float_t;
typedef double double_t;
#elif defined (FLT_EVAL_METHOD) && (FLT_EVAL_METHOD == 1)
typedef double float_t;
typedef double double_t;
#elif defined (FLT_EVAL_METHOD) && (FLT_EVAL_METHOD == 2)
typedef long double float_t;
typedef long double double_t;
#else
typedef float   float_t;
typedef double  double_t;
#endif
#endif /* (!__linux__ && !__APPLE__ && !__NetBSD__ && !__FreeBSD__ && !__QNX__ && !__VXWORKS__) || __PURE_INTEL_C99_HEADERS__ */

So __PURE_INTEL_C99_HEADERS__ must NOT be defined to avoid redeclaration. It is likely the following macros are also needed:

-D_Float32=float -D_Float32x=double -D_Float64=double -D_Float64x=__float128

I hope this helps. Btw, it is strange that -std=c11 does not help at all which is said to tolerate redeclaration.

0 Kudos
Reply