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

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

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.

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

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.

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

 

Quote:

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.

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

Login to leave a comment.