Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7669 Discussions

Undefined reference to _mm_malloc Ubuntu 11.10 Parallel Studio XE 12.1.0

Black Belt
After installing Parallel Studio XE 12.1.0 I can convert a project from GCC C++ to Intel C++ (and now) compile and link a particular project.

However, when I revert back to GCC C++ Tool Chain, I now get ld errors (Link) reporting Undefined reference to '_mm_malloc' (and '_mm_free').

It seems like your installation broke something in the GCC C++ Tool Chain

I am not too deft with Linux. I imaging there is a tool to search all installed libraries for an entrypoint.

foo-search-all-libs-for _mm_malloc

I would like to be able to build using both compilers.

Jim Dempsey
0 Kudos
4 Replies
Black Belt
A similar subject was discussed on gcc bugzilla
It doesn't indicate which gcc versions should have fixed it, nor do you indicate your gcc version.
I think the relevant tools to search linux libraries for entry points are different between static (.a) and .so libraries, and recent distros don't include the static libraries.
Black Belt
Sorry, GCC 4.6.1

The _mm_malloc and _mm_free were linking fine _before_ installing Parallel Studio XE

I will look at the bugzilla reference, thanks.

This may be related to other linking problems. e.g.

App linking with libA, libB, libC
App directly calls libA
libA calls libB

ld (Link) reports undefined symbols (ones residing in libB)

Fix (hack) is to insertcalls to those functions in libB (forcing optimizer not to remove "dead code")

Another issue with the _mm_malloc is

The app build with and linked with icpc 12.1 runs for a while then gets an invalid address during free(x).
Building the same app using GCC C++ and its linker, the program runs fine.
(not proof of bug with icpc)

This is a multi-threaded application (pthreads). It may be an issue with the library icpc uses in its builds.
The allocation and deallocation were performed by the same thread (main thread).
However, the immediately preceeding free may have been made by a different thread. I do not know if this relates to the issue or not.

Jim Dempsey

Jim Dempsey
Black Belt
The date on the bugzilla report was 2004-07-15

The fix I used was to insert an actual call to the "undefined" function, call never actually issued, but call code force to remain in application. This may be a new optimization feature (remove library references)...:~S

Jim Dempsey

I compiled a simple program with gcc and linked with icc works fine because icc can understand the .o and .s files generated by GCC. But when i tried compiling same program with icc and linked with gcc then i would get an error undefined reference to `__intel_new_proc_init' So icc generates the .o file that is different when compared to GCC. So this is the reason why we get the linking errors.