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

icc on Linux - error: function "__gthrw_pthread_once" was referenced but not defined

Nikita_Tropin
Novice
1,212 Views
Hello,

I'm trying to build CLHEP (http://www.cern.ch/clhep) and Geant4 toolkit (http://www.geant4.org) with Intel C++ Compiler 11.1.069 on machine with SLES 11 and gcc 4.3.2.

I have the following error:

Command line: icc -DHAVE_CONFIG_H -I. -I. -I../Vector -I.. -I/opt/intel/Compiler/11.1/069/include -O -ansi -fp-model precise -no-gcc -w1 -MT AxisAngle.o -MD -MP -MF ".deps/AxisAngle.Tpo" -c -o AxisAngle.o AxisAngle.cc

Output:
/usr/include/c++/4.3/x86_64-suse-linux/bits/gthr-default.h(100): error: function "__gthrw_pthread_once" was referenced but not defined
__gthrw(pthread_once)
^

/usr/include/c++/4.3/x86_64-suse-linux/bits/gthr-default.h(101): error: function "__gthrw_pthread_getspecific" was referenced but not defined
__gthrw(pthread_getspecific)
^

/usr/include/c++/4.3/x86_64-suse-linux/bits/gthr-default.h(102): error: function "__gthrw_pthread_setspecific" was referenced but not defined
__gthrw(pthread_setspecific)
^

/usr/include/c++/4.3/x86_64-suse-linux/bits/gthr-default.h(104): error: function "__gthrw_pthread_cancel" was referenced but not defined
__gthrw(pthread_cancel)
^

/usr/include/c++/4.3/x86_64-suse-linux/bits/gthr-default.h(105): error: function "__gthrw_pthread_mutex_lock" was referenced but not defined
__gthrw(pthread_mutex_lock)
^

/usr/include/c++/4.3/x86_64-suse-linux/bits/gthr-default.h(106): error: function "__gthrw_pthread_mutex_trylock" was referenced but not defined
__gthrw(pthread_mutex_trylock)
^

/usr/include/c++/4.3/x86_64-suse-linux/bits/gthr-default.h(107): error: function "__gthrw_pthread_mutex_unlock" was referenced but not defined
__gthrw(pthread_mutex_unlock)
^

/usr/include/c++/4.3/x86_64-suse-linux/bits/gthr-default.h(109): error: function "__gthrw_pthread_cond_broadcast" was referenced but not defined
__gthrw(pthread_cond_broadcast)
^

/usr/include/c++/4.3/x86_64-suse-linux/bits/gthr-default.h(110): error: function "__gthrw_pthread_cond_wait" was referenced but not defined
__gthrw(pthread_cond_wait)
^

/usr/include/c++/4.3/x86_64-suse-linux/bits/gthr-default.h(113): error: function "__gthrw_pthread_key_create" was referenced but not defined
__gthrw(pthread_key_create)
^

/usr/include/c++/4.3/x86_64-suse-linux/bits/gthr-default.h(114): error: function "__gthrw_pthread_key_delete" was referenced but not defined
__gthrw(pthread_key_delete)
^
compilation aborted for AxisAngle.cc (code 2)

I also tried with -cxxlib key but with the same result.

When compiling with g++ everything is ok.

0 Kudos
8 Replies
Milind_Kulkarni__Int
New Contributor II
1,212 Views

I was able to reproduce the problem with the source clhep. However, when I remove the -no-gcc option from the command-line, the error goes away.

I think you have accidentally included that with icc. The option means that all GNU macros are undefined, and the definitions will not be included. What was the intent behind including it.

Please try w/o -no-gcc , and let us know whether it still reproduces at your end.

0 Kudos
Nikita_Tropin
Novice
1,212 Views
It appears that -no-gcc flag is included in CLHEP config when building with icc. Furthermore in some build instructions (for icc 8.0) I've found the recommendation to set this flag when using Intel compiler. I tried to get rid of it in config files but without success, so I just set the environment variable CXXFLAGS=-gcc. Finally my command lines were like

icc -DHAVE_CONFIG_H -I. -I. -I../Vector -I.. -I/opt/intel/Compiler/11.1/069/include -O -ansi -fp-model precise -no-gcc -w1 -gcc -MT AxisAngle.o -MD -MP -MF ".deps/AxisAngle.Tpo" -c -o AxisAngle.o AxisAngle.cc

Fortunately, icc understood my intentions and build CLHEP without errors.

Next step was to build Geant4 - I modified provided /geant4.9.3/config/sys/Linux-icc.gmk to remove -no-gcc flag and Geant4 was built succesfully.

However, now I bumped into another problem - when I try to build my application that uses Geant4 libraries with icc, I have an error:

/apps/geant4.9.3/lib/Linux-icc/libG4processes.so: undefined reference to `__builtin_isnan'

Is it the same error as in this thread: http://software.intel.com/en-us/forums/showthread.php?t=64188 or not?





0 Kudos
Milind_Kulkarni__Int
New Contributor II
1,212 Views
That was a good workaround around no-gcc.

Regarding isnan , its the same error, and bug already filed.

The current icpc supports g++ 4.2.1 headers, but not current g++, so this error comes with >= g++ 4.3 .
0 Kudos
Nikita_Tropin
Novice
1,212 Views
It appears that Geant4 creators are aware of portability issues and try not to use isnan() and isinf() functions. Basically I've found only one instance of isnan() in Geant4 sources. So I just changed "if (std::isnan(new_weight))" to "if (new_weight!=new_weight)" and rebuilt this library. Now everything works fine and I gained expected 20% speed up by using icc compared to g++.
0 Kudos
G__Hahn
Beginner
1,212 Views
The newly released version of geant4 [9.3 patch02] is patched.
So, I just removed "-no-gcc" in the following text files.

CLHEP v2.0.4.5:
./Vector/autom4te.cache/output.1
./Vector/autom4te.cache/output.0
./Vector/configure
./Vector/configure.in
./Evaluator/autom4te.cache/output.1
./Evaluator/autom4te.cache/output.0
./Evaluator/configure
./Evaluator/configure.in
./Units/autom4te.cache/output.1
./Units/autom4te.cache/output.0
./Units/configure
./Units/configure.in
./RandomObjects/autom4te.cache/output.1
./RandomObjects/autom4te.cache/output.0
./RandomObjects/configure
./RandomObjects/configure.in
./autom4te.cache/output.1
./autom4te.cache/output.0
./Matrix/autom4te.cache/output.1
./Matrix/autom4te.cache/output.0
./Matrix/configure
./Matrix/configure.in
./Exceptions/autom4te.cache/output.1
./Exceptions/autom4te.cache/output.0
./Exceptions/configure
./Exceptions/configure.in
./RefCount/autom4te.cache/output.1
./RefCount/autom4te.cache/output.0
./RefCount/configure
./RefCount/configure.in
./Cast/autom4te.cache/output.1
./Cast/autom4te.cache/output.0
./Cast/configure
./Cast/configure.in
./GenericFunctions/autom4te.cache/output.1
./GenericFunctions/autom4te.cache/output.0
./GenericFunctions/configure
./GenericFunctions/configure.in
./configure
./Geometry/autom4te.cache/output.1
./Geometry/autom4te.cache/output.0
./Geometry/configure
./Geometry/configure.in
./Random/autom4te.cache/output.1
./Random/autom4te.cache/output.0
./Random/configure
./Random/configure.in
./configure.in

Geant4 (9.3 p2):
./config/sys/Linux-icc.gmk

and it works.

One thing I am not sure is about the result of the Geant4. In the release note of geant4, they note icc-linux environment is neither tested nor supported. I don't understand what that means.

Is there any possibility that icc compiled Geant4 can makes a wrong result??
Can anyone let me know what is exactly the problem when using icc compiled Geant4? even if the compilation is done without error..?

0 Kudos
Milind_Kulkarni__Int
New Contributor II
1,212 Views
thats great news that new version compiles successfully.
Here, its mentioned that Linux-icc & 11.1are supported:--

http://geant4.web.cern.ch/geant4/collaboration/working_groups/softman/training/installation.pdf

The icc is meant to be binary and source compatible with gcc, and mostly the results should be right.
If you face any problem with regressionor any test suites , please let us know test-case..
0 Kudos
Dragos_Constantin
1,212 Views
thats great news that new version compiles successfully.
Here, its mentioned that Linux-icc & 11.1are supported:--

http://geant4.web.cern.ch/geant4/collaboration/working_groups/softman/training/installation.pdf

The icc is meant to be binary and source compatible with gcc, and mostly the results should be right.
If you face any problem with regressionor any test suites , please let us know test-case..

Hi Milind,
I try to compile CLHEP 2.0.4.6 and Geant4 (9.4.beta1). Can you shed more light into this issue? What exactly do you do to get CLHEP configured because I am getting errors. I am using icc v11.1.073 on RHEL5. Bellow is what I am issuing from a buid directory:

CC=icc CPP=icc CXX=icc CXXCPP=icc CPPFLAGS='-O3 -g -m64 -multiple-processes=8 -mtune=core2 -parallel -gcc -icc' ./../2.0.4.6/CLHEP/configure --prefix=/opt/clhep-2.0.4.6_intel

and I shortly get:

...
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... configure: error: cannot run C++ compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.

Thanks,
Dragos

0 Kudos
Milind_Kulkarni__Int
New Contributor II
1,212 Views
Hi,

Were you able to correct it.

Try with this:--

CC=icc CPP='icc -E' CXX=icpc CXXCPP='icc -E' CPPFLAGS='-O3 -g -m64 -multiple-processes=8 -mtune=core2 -parallel -gcc -icc'

And let me know whether that works. If not, check the config.log for specific reason for why the configure threw error, and then you can correct it.
0 Kudos
Reply