Search code examples
c++g++icc

ICC complains about missing __builtin_ia32_ldmxcsr


When compiling a project with Intel Composer 15 Update 3 on Linux, I get the following unresolved symbols on linking:

undefined reference to `__builtin_ia32_ldmxcsr'
undefined reference to `__builtin_ia32_stmxcsr'

Upon doing a Google search, I found that these functions are built in the 32-bit version of g++ which is why Intel can't find them. Firstly, I am compiling on a 64-bit OS with a 64-bit compiler; why is the linker looking for a function found only in 32-bit? Secondly, why is object code generated by Intel looking for a g++ built-in function?


Solution

  • Firstly, I am compiling on a 64-bit OS with a 64-bit compiler; why is the linker looking for a function found only in 32-bit?

    Likely because some of your source code inappropriately references them.

    First step: figure out which object(s) are referencing these builtins:

    nm -A *.o *.a | egrep '__builtin_ia32_ldmxcsr|__builtin_ia32_stmxcsr'
    

    Second step: preprocess the corresponding source to figure out where the references are coming from:

    icpc -E -I ... bad_source.cpp