Software Archive
Read-only legacy content
17061 Discussions

Library linking problem when compiling the code for MIC cores in the host

Cheng_C_
Beginner
665 Views

I want to compile a code that aims to run natively in mic cores in the host. The code complies well and run correctly in the host. [hpc1]$ icc -no-multibyte-chars test_mic.c -o test_mic -lcrypto [hpc1]$ ./rsa_mic I then compiled the same code for mic cores. As far as I know, when the option -mmic is added, the default paths for the include files and the libraries will change, so I point them out (-I/usr/include/ -L/usr/lib64/). It seems that something is wrong in linking the libcrypt library. [hpc1]$ icc -mmic -no-multibyte-chars test_mic.c -o test_mic -I/usr/include/ -L/usr/lib64/ -lcrypto x86_64-k1om-linux-ld: skipping incompatible /usr/lib64//libcrypto.so when searching for -lcrypto x86_64-k1om-linux-ld: cannot find -lcrypto x86_64-k1om-linux-ld: skipping incompatible /usr/lib64//libm.so when searching for -lm x86_64-k1om-linux-ld: skipping incompatible /usr/lib64//libc.so when searching for -lc It would be great if I could get your help. Thanks.

0 Kudos
4 Replies
Cheng_C_
Beginner
665 Views

For the format.

I want to compile a code that aims to run natively in MIC cores in the host. The code compiles well and run correctly in the host. 

[hpc1]$ icc -no-multibyte-chars test_mic.c -o test_mic -lcrypto

[hpc1]$ ./rsa_mic

 

I then compiled the same code for mic cores. As far as I know, when the option -mmic is added, the default paths for the include files and the libraries will change, so I point them out (-I/usr/include/ -L/usr/lib64/). It seems that something is wrong in linking the libcrypt library.

[hpc1]$ icc -mmic -no-multibyte-chars test_mic.c -o test_mic -I/usr/include/ -L/usr/lib64/ -lcrypto

x86_64-k1om-linux-ld: skipping incompatible /usr/lib64//libcrypto.so when searching for -lcrypto

x86_64-k1om-linux-ld: cannot find -lcrypto x86_64-k1om-linux-ld: skipping incompatible /usr/lib64//libm.so when searching for -lm

x86_64-k1om-linux-ld: skipping incompatible /usr/lib64//libc.so when searching for -lc

 

It would be great if I could get your help. Thanks.

0 Kudos
Kevin_D_Intel
Employee
665 Views

The /usr/lib64//libcrypto.so you directed the compilation/link to was not built with -mmic and that produces the error you received. Redirecting the -mmic compile/link to the -L/usr/lib64/ causes the further confusion with other needed libraries also.

As you noted, the -mmic option adjusts include/library paths accordingly to ensure compatible headers/libs are used so you need to allow the compiler option to select the appropriate paths.

I do not see a libcrypto.so available in the /usr/linux-k1om-4.7/linux-k1om (which sym-links to /opt/mpss/3.1/sysroots/k1om-mpss-linux/ under MPSS 3.1) so if you require that particular library then you may have to build it yourself. There is a libcrypt.so provided under this area but I do not know whether that suites your app’s need. You could try by dropping your -I/usr/include/ -L/usr/lib64/ options to see.

If you require a specific libcrytpo then you may need to build that from source yourself. There is some guidance available in the Configuring Intel® Xeon Phi™ coprocessors inside a cluster guide (http://software.intel.com/en-us/articles/configuring-intel-xeon-phi-coprocessors-inside-a-cluster).  Look at sections Native compiler for Intel Xeon Phi Coprocessor and Compiling native GNU tools.

Hope that helps.

0 Kudos
Cheng_C_
Beginner
665 Views

Kelvin, thanks very much for the detailed and penetrating explanations. It's very helpful!

 

Kevin Davis (Intel) wrote:

The /usr/lib64//libcrypto.so you directed the compilation/link to was not built with -mmic and that produces the error you received. Redirecting the -mmic compile/link to the -L/usr/lib64/ causes the further confusion with other needed libraries also.

As you noted, the -mmic option adjusts include/library paths accordingly to ensure compatible headers/libs are used so you need to allow the compiler option to select the appropriate paths.

I do not see a libcrypto.so available in the /usr/linux-k1om-4.7/linux-k1om (which sym-links to /opt/mpss/3.1/sysroots/k1om-mpss-linux/ under MPSS 3.1) so if you require that particular library then you may have to build it yourself. There is a libcrypt.so provided under this area but I do not know whether that suites your app’s need. You could try by dropping your -I/usr/include/ -L/usr/lib64/ options to see.

If you require a specific libcrytpo then you may need to build that from source yourself. There is some guidance available in the Configuring Intel® Xeon Phi™ coprocessors inside a cluster guide (http://software.intel.com/en-us/articles/configuring-intel-xeon-phi-coprocessors-inside-a-cluster).  Look at sections Native compiler for Intel Xeon Phi Coprocessor and Compiling native GNU tools.

Hope that helps.

0 Kudos
Kevin_D_Intel
Employee
665 Views

You're welcome. I hope you can easily resolve the library need for your app and move forward without too much additional work.

0 Kudos
Reply