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

icpc: warning #10314: specifying -lm before object files

ali_r_2
Beginner
505 Views

I'm compiling a source using icpc and I get this warning.

icpc: warning #10314: specifying -lm before object files may supercede the Intel(R) math library and affect performance

is it important?

0 Kudos
5 Replies
QIAOMIN_Q_
New Contributor I
505 Views

Hello ali,

This indicates that you must permit linking of the icc libraries,i think removing -lm help as the earlier diagnostic suggests.

Thank you.
--
QIAOMIN.Q
Intel Developer Support

Please participate in our redesigned community support web site:
Tools Knowledge Base:          http://software.intel.com/en-us/articles/tools

0 Kudos
SergeyKostrov
Valued Contributor II
505 Views
>>icpc: warning #10314: specifying -lm before object files may supercede the Intel(R) math library and affect performance >> >>is it important? Yes and it can be easily verified if you have a simple test case with some floating point calculations.
0 Kudos
ali_r_2
Beginner
505 Views

OK, so as I'm compiling a big library I have to contact the developer and ask to fix it. However not sure what message actually mean. Does it simply mean like below?

1- right now doing:  icpc -lm *.o -o a.out

and should change it to?

2- icpc *.o -lm -o a.out

another issue I found during search was that it is recommended to add -limf as well to avoid some liknig errors. here

http://software.intel.com/en-us/forums/topic/298872

so the final correct command would be:

icpc *.o -lm -limf -o a.out

Am I right?

0 Kudos
TimP
Honored Contributor III
505 Views

icpc will cause ld to search the math libraries anyway, at the proper point in the sequence, so I think -lm is redundant.  If you want to see the details, add -# to your icpc command.

In general, the message would be correct in that a library search prior to traversing your .o files would be ineffective. "linux is not windows," gnu ld doesn't act like Microsoft link.exe. If you did want to specify libimf, you would omit -lm and use -limf as you showed. icpc would still use system libraries to resolve libmath references not taken care of by libimf.

0 Kudos
ali_r_2
Beginner
505 Views

Thanks for explanations. However how should I fix this warning?

0 Kudos
Reply