Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29236 Discussions

sin multiply defined in libcmt and libmmt?

Tony_Garratt
Beginner
998 Views

I am finding that sin is defined in libcmt.lib and libmmt.lib. Extract of compile line is below.

ifort -nologo -D_AMD64_-threads -O2 /Qopenmp /names:lowercase /assume:underscore -fpp -for_test.exe for_test.obj fortio.obj some_c_code.obj some_more_c_code.obj fortran_code.f mylib.lib -link -machine:amd64 -FORCE:UNRESOLVED -NODEFAULTLIB:libc.lib mkl_core.lib mkl_intel_lp64.lib mkl_intel_thread.lib mkl_blas95_lp64.lib oldnames.lib wsock32.lib libcmt.lib kernel32.lib user32.lib netapi32.lib advapi32.lib gdi32.lib comdlg32.lib comctl32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

for_test.obj : warning LNK4042: object specified more than once; extras ignored

libcmt.lib(sincos.obj) : error LNK2005: sin already defined in libmmt.lib(sin_stub.obj)

Is this a known issue? I guess I could get around it by changing all my SIN() to DSIN() in my Fortran code, but I would prefer not to. I wondered if anyone else has seen this issue? I am mixing C++ and Fortran. This is on win64 with 11.1 update 5 of the compiler and VS2005.

0 Kudos
5 Replies
Steven_L_Intel1
Employee
998 Views
I find this a bit confusing - normally, ifort does not put out a reference to "sin". You have a lot of options here that can create issues. I'm especially puzzled by -nodefaultlib:libc - I can't imagine any instance where use of that would be appropriate on x64.

Can you attach a small source that demonstrates this problem?
0 Kudos
Tony_Garratt
Beginner
998 Views
Hi Steve,

It might be tricky for me to reproduce this on a small source code unfortunately.I did remove -npdefaultlib:libc and it didnt make any difference. What is curious is that if I use /fp:precise, the problem doesgo away.

What seems to be happening is that libcmt.lib and libmmt.lib are clashing. If I remove the former from the compile line, the problem goes away.

Tony



0 Kudos
Steven_L_Intel1
Employee
998 Views
You should not have to explicitly name either of those libraries on the command line. Removing libcmt is the correct choice.
0 Kudos
Martyn_C_Intel
Employee
998 Views
libc... is provided by Microsoft and libm... is provided by Intel. libm contains more optimized versions of some of the math functions in libc... As Steve says, naming these explicitly is rather dangerous, for example, it might interfere with the preemption of one by the other. There is also an additional, Intel-provided math library, libsvml, that contains optimized math functions used mostly by the vectorizer. The reproducibility requirements of /fp:precise change which entry point and library are called for math functions such as SIN. (In the 11.1 compiler, /fp:precise implies /Qfast-transcendentals- ).

Please let us know whether the undefined reference persists when you remove -NODEFAULTLIB:libc.lib and libcmt.lib.
0 Kudos
Tony_Garratt
Beginner
998 Views

Hi!
We have removed -NODEFAULTLIB:libc.lib and libcmt.lib and the multiply defined problem has gone away. So, I think the problem is solved. Thanks very much.

regards,
Tony
0 Kudos
Reply