Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Ubuntu + gcc-4.8 problems

Juan_Jose_Garcia_Rip
1,932 Views
Hi, I have two sets of computers. One has Ubuntu 12.04, the other one 13.10. The former works fine with Intel MKL 11.0, the later gives some weird link errors. The command line is the same on both platforms, and in both I am using mklvars.sh to get the appropriate paths. Any hints? g++ -m64 -I/opt/intel/mkl/include -I/home/jjgarcia/mps-bundle/include -g -O2 -O2 -o exp_1.exe exp_1.cc -lmps -L/home/jjgarcia/mps-bundle/lib -ltensor -L/home/jjgarcia/mps-bundle/lib -L/opt/intel/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -liomp5 -ldl -lpthread /opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `__kmpc_ok_to_fork /opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `__kmpc_end_single /opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `__kmpc_ordered ...
0 Kudos
1 Solution
Ying_H_Intel
Employee
1,932 Views

Hi Juan Jose

Could it because same reasons in http://software.intel.com/en-us/forums/topic/499216?  I just check one --as-needed in your log_0.txt file. 

We suspect some GCC versions on Ubuntu deployed this observable --as-needed behavior as default for binary-startup-time optimization reasons.

Could you please try the command:

 g++ -v -m64 -L/opt/intel/composerxe/lib/intel64/ -I/opt/intel/mkl/include -I/home/jjgarcia/mps-bundle/include -g -O2 -O2 -o exp_1.exe exp_1.cc -lmps -L/home/jjgarcia/mps-bundle/lib -ltensor -L/home/jjgarcia/mps-bundle/lib -L/opt/intel/mkl/lib/intel64 -Wl, --no-as-needed  -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -liomp5 -ldl -lpthread -Wl,--verbose

and see if it can work

Best Regards,
Ying . 

 

 

View solution in original post

0 Kudos
7 Replies
Gennady_F_Intel
Moderator
1,932 Views

/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `__kmpc_ok_to_fork

/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `__kmpc_end_single
/opt/intel/mkl/lib/intel64/libmkl_intel_thread.so: undefined reference to `__kmpc_ordered

all of these references are defined in  libiomp5.so which is situated  into  <composer_xe_install_path>/compiler/lib/(intel64/ia32) 

 

0 Kudos
Juan_Jose_Garcia_Rip
1,932 Views

Sorry that I forgot to mention this, but this MKL is part of Composer 2013 and of course we have the compiler libraries in path (LD_LIBRARY_PATH). So _that_ is not the problem. In particular, while there should be no need to add it due to the environment variables, the following line also does not work

g++ -m64 -L/opt/intel/composerxe/lib/intel64/ -I/opt/intel/mkl/include -I/home/jjgarcia/mps-bundle/include -g -O2 -O2 -o exp_1.exe exp_1.cc -lmps -L/home/jjgarcia/mps-bundle/lib -ltensor -L/home/jjgarcia/mps-bundle/lib -L/opt/intel/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -liomp5 -ldl -lpthread

 

 

0 Kudos
TimP
Honored Contributor III
1,932 Views

 

if you would add -v you may get some insight about how you should clean up the link command.

0 Kudos
Gennady_F_Intel
Moderator
1,932 Views

I don't see the path to the directory where libiomp5*.* are located. 

g++ -m64 -L/opt/intel/composerxe/lib/intel64/   -->  may be it shoud be like the follow : g++ -m64 -L/opt/intel/composerxe/compiler/lib/intel64/

 

 

0 Kudos
Juan_Jose_Garcia_Rip
1,932 Views

Please note that I may not be as dumb as you might assume :-) I checked the paths. The environments in both machines are the same and they include the compiler libraries as well as MKL. The only difference between both machines is that one was upgraded to 13.10 and the other one wasn't.

The path I provided does contain the iomp library:

$ ls /opt/intel/composerxe/lib/intel64/*omp5*
/opt/intel/composerxe/lib/intel64/libiomp5.a
/opt/intel/composerxe/lib/intel64/libiomp5.dbg
/opt/intel/composerxe/lib/intel64/libiomp5.so

Thus it is most obscure that the output of gcc below does not show any hint of why this library is not recognized. From the log file attached,

$ g++ -v -m64 -L/opt/intel/composerxe/lib/intel64/ -I/opt/intel/mkl/include -I/home/jjgarcia/mps-bundle/include -g -O2 -O2 -o exp_1.exe exp_1.cc -lmps -L/home/jjgarcia/mps-bundle/lib -ltensor -L/home/jjgarcia/mps-bundle/lib -L/opt/intel/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -liomp5 -ldl -lpthread -Wl,--verbose
....
attempt to open /opt/intel/composerxe/lib/intel64//libiomp5.so succeeded
-liomp5 (/opt/intel/composerxe/lib/intel64//libiomp5.so)

...

 

0 Kudos
Ying_H_Intel
Employee
1,933 Views

Hi Juan Jose

Could it because same reasons in http://software.intel.com/en-us/forums/topic/499216?  I just check one --as-needed in your log_0.txt file. 

We suspect some GCC versions on Ubuntu deployed this observable --as-needed behavior as default for binary-startup-time optimization reasons.

Could you please try the command:

 g++ -v -m64 -L/opt/intel/composerxe/lib/intel64/ -I/opt/intel/mkl/include -I/home/jjgarcia/mps-bundle/include -g -O2 -O2 -o exp_1.exe exp_1.cc -lmps -L/home/jjgarcia/mps-bundle/lib -ltensor -L/home/jjgarcia/mps-bundle/lib -L/opt/intel/mkl/lib/intel64 -Wl, --no-as-needed  -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -liomp5 -ldl -lpthread -Wl,--verbose

and see if it can work

Best Regards,
Ying . 

 

 

0 Kudos
Juan_Jose_Garcia_Rip
1,932 Views

Dear Ying, thanks for the hint. Indeed that was the problem! Using the flag --no-as-needed links in "iomp5", which it did not before. Thanks a lot for the help and blame the Ubuntu/gcc people for this stupid move :-)

0 Kudos
Reply