Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
7568 Discussions

intel compiler toolchain on CentOS - linking against custom glibc

krukov__ivan
Beginner
184 Views

Hello, all.

I am trying to get the the 2019 release working on centos6.

The system ships with gcc 4.4 and old glibc, which do not have full support for c++11. Instead, I compiled and installed gcc 5.5 and glibc 2.23 through linuxbrew, and I am trying to compile with `icpc` with linuxbrew's `gcc` toolchain.

However, when compiling, icpc insists on using system versions of glibc:

> icpc -cxxlib=/home/user/.linuxbrew/ -std=c++11 hello.cpp -o hello
ld: /home/user/.linuxbrew/Cellar/gcc/5.5.0_4/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.5.0/../../..//libstdc++.so: 
undefined reference to `memcpy@GLIBC_2.14'

Instead, I expect it to resolve to glibc 2.23, as installed with homebrew.

`icpc` seems to know about my 5.5 executable:

> icpc -v
icpc version 19.0.0.117 (gcc version 5.5.0 compatibility)

Further, if I explicitly include `~/.linuxbrew/lib` as a linking directory, `ld` succeeds, but the runtime library lookup fails, as it appears that the linker uses system libraries:

> icpc -cxxlib=/home/user/.linuxbrew/ -std=c++11 -L ~/.linuxbrew/lib hello.cpp -o hello
> ldd hello
./hello: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./hello)
	linux-vdso.so.1 =>  (0x00007f1781c4c000)
	libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003caee00000)
	libm.so.6 => /lib64/libm.so.6 (0x0000003ca5200000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003caea00000)
	libc.so.6 => /lib64/libc.so.6 (0x0000003ca4e00000)
	libdl.so.2 => /lib64/libdl.so.2 (0x0000003ca5a00000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003ca4a00000)

I would expect that providing `-cxxlib=<path>` and `-L <inlclude>` should link against libraries in `/home/user/.linuxbrew/lib`.

What am I missing?

Thank you!

0 Kudos
1 Reply
Viet_H_Intel
Moderator
184 Views

Instead of using -cxxlib=/home/user/.linuxbrew/, can you try -gxx-name=/home/user/.linuxbrew/?

Thanks,

Viet

Reply