Wednesday, May 10, 2017

Error compiling SystemC-2.2 with GCC 4.9

GCC now requires some headers to be explicitly defined (whereas in the past they were implicitly included when some functions were used). When trying to compile SystemC-2.2.0 with GCC 4.9 (or latter) the following error is raised:

g++ -I. -I. -I. -I../../../src  -fpermissive  -Wall -DSC_USE_PTHREADS -DSC_INCLUDE_FX -O3 -c -o sc_utils_ids.o `test -f 'sc_utils_ids.cpp' || echo './'`sc_utils_ids.cpp
sc_utils_ids.cpp: In function ‘int sc_core::initialize()’:
sc_utils_ids.cpp:109:36: error: ‘getenv’ is not a member of ‘std’
     const char* deprecation_warn = std::getenv("SC_DEPRECATION_WARNINGS");


This can be solved removing the std:: before getenv, and adding the #include <stdlib.h> header.

In addition to this, #include <string.h> must be also included, otherwise the following error is raised:

sc_utils_ids.cpp: In function ‘int sc_core::initialize()’:
sc_utils_ids.cpp:110:69: error: ‘strcmp’ was not declared in this scope
     if ( (deprecation_warn!=0) && !strcmp(deprecation_warn,"DISABLE") )

No comments:

Post a Comment