Search code examples
linuxdynamic-linkingicclibm

How not to link with libm using Intel C Compiler


I want to compile some very basic test code calling the log function and then printing the result on the standard output on Linux, with the Intel C Compiler. I want the code to be linked against libimf (Intel's Math Functions library) and not the GNU libm, so that I can be sure which log function is called.

So far I have managed to link with libimf.so with -limf, but icc links against libm.so with -lm by default. I would like to avoid this. How should I proceed?


Solution

  • to override linking against system libraries, we should set and export the LD_LIBRARY_PATH
    according to the icc manual, icc links against some default libraries, to disable this behavior add the -nodefaultlibs