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

Undefined reference to _mm_malloc Ubuntu 11.10 Parallel Studio XE 12.1.0

jimdempseyatthecove
Honored Contributor III
1,117 Views
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
TimP
Honored Contributor III
1,117 Views
A similar subject was discussed on gcc bugzilla http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16570
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.
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,117 Views
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
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,117 Views
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
0 Kudos
Sukruth_H_Intel
Employee
1,117 Views

Hi,
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.

Thanks,
Sukruth.H.V

0 Kudos
Reply