Search code examples
c++g++intelicc

After removing intel toolkit, g++ looking for intel math library and complain error


This is centos system. I has installed intel HPC toolkit(toolkit before intel oneAPI, including intel c++/c/fortran/MKL...). Then after I remove the intel toolkit, my g++ didn't work(so does my gcc, same error). It seems the g++ is looking for intel math library. Since I removed the intel toolkit, it can not find the intel math library and complain error.

How can I tell g++ do not to find intel math library? And how can I know what library g++ are looking for?

Thank you for your help!


The c++ example

#include<iostream>                                                                                                     #include<cmath>
   int main(){
     int a = 1<<31;
     std::cout<<"a is "<< a <<std::endl;
     int b = std::abs(a);
     std::cout<<"b is "<< b <<std::endl;
     return 0;
   }

the command I used to compile the c++ example

g++ a.cpp

the error it complain

/usr/local/gcc/10.1.0/libexec/gcc/x86_64-pc-linux-gnu/10.1.0/cc1plus: error while loading shared libraries: libsvml.so: cannot open shared object file: No such file or directory

LDD result: for my gcc

(base) [Js@XiaoXin13pro ~]$ ldd  /usr/local/gcc/10.1.0/libexec/gcc/x86_64-pc-linux-gnu/10.1.0/cc1plus
        linux-vdso.so.1 =>  (0x00007fffffad5000)
        libisl.so.15 => /usr/local/lib/libisl.so.15 (0x00007f111d980000)
        libmpc.so.3 => /usr/local/lib/libmpc.so.3 (0x00007f111d760000)
        libmpfr.so.4 => /usr/local/lib/libmpfr.so.4 (0x00007f111d4f0000)
        libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x00007f111d260000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f111d040000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f111cd30000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f111c960000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f111de00000)
        libimf.so => /lib64/libimf.so (0x00007f111c490000)
        libsvml.so => not found
        libirng.so => not found
        libgcc_s.so.1 => /usr/local/gcc/10.1.0/lib64/libgcc_s.so.1 (0x00007f111c260000)
        libintlc.so.5 => not found
        libsvml.so => not found
        libirng.so => not found
        libintlc.so.5 => not found
        libsvml.so => not found
        libirng.so => not found
        libintlc.so.5 => not found
        libsvml.so => not found
        libirng.so => not found
        libintlc.so.5 => not found
        libintlc.so.5 => not found

LDD result: for system gcc

(base) [Js@XiaoXin13pro ~]$ ldd /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/cc1plus
        linux-vdso.so.1 =>  (0x00007fffea241000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f225a4e0000)
        libmpc.so.3 => /usr/local/lib/libmpc.so.3 (0x00007f225a2c0000)
        libmpfr.so.4 => /usr/local/lib/libmpfr.so.4 (0x00007f225a050000)
        libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x00007f2259dc0000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f2259b90000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f2259880000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f22594b0000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f225a800000)
        libimf.so => /lib64/libimf.so (0x00007f2258fe0000)
        libsvml.so => not found
        libirng.so => not found
        libgcc_s.so.1 => /usr/local/gcc/10.1.0/lib64/libgcc_s.so.1 (0x00007f2258db0000)
        libintlc.so.5 => not found
        libsvml.so => not found
        libirng.so => not found
        libintlc.so.5 => not found
        libsvml.so => not found
        libirng.so => not found
        libintlc.so.5 => not found
        libintlc.so.5 => not found

update gcc using scl:

sudo yum install centos-release-scl
sudo yum install devtoolset-8-gcc*
scl enable devtoolset-8 bash

check gcc

(base) [Js@XiaoXin13pro ~]$ which gcc
/opt/rh/devtoolset-8/root/usr/bin/gcc
(base) [Js@XiaoXin13pro ~]$ gcc --version
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and still complain

(base) [Js@XiaoXin13pro ~]$ g++ a.cpp
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/cc1plus: error while loading shared libraries: libsvml.so: cannot open shared object file: No such file or directory

and ldd result

(base) [Js@XiaoXin13pro ~]$ ldd /opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/cc1plus
        linux-vdso.so.1 =>  (0x00007ffff5a56000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fe19add0000)
        libmpc.so.3 => /usr/local/lib/libmpc.so.3 (0x00007fe19abb0000)
        libmpfr.so.4 => /usr/local/lib/libmpfr.so.4 (0x00007fe19a940000)
        libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x00007fe19a6b0000)
        libz.so.1 => /lib64/libz.so.1 (0x00007fe19a480000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fe19a170000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fe199da0000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe19b000000)
        libimf.so => /lib64/libimf.so (0x00007fe1998d0000)
        libsvml.so => not found
        libirng.so => not found
        libgcc_s.so.1 => /usr/local/gcc/10.1.0/lib64/libgcc_s.so.1 (0x00007fe1996a0000)
        libintlc.so.5 => not found
        libsvml.so => not found
        libirng.so => not found
        libintlc.so.5 => not found
        libsvml.so => not found
        libirng.so => not found
        libintlc.so.5 => not found
        libintlc.so.5 => not found

Solution

  • I find someone encountered the same error. It's shown in here Install OpenMPI from repository with GCC instead of Intel.

    Why gcc is looking for the intel math library? In my exampl, it seems mpc\mpfr\gmp in /usr/local/lib depends on the Intel library.

    I searched these three library in other path but found nothing. I removed these three library and reinstalled gcc by sudo yum install gcc. And this time it works fine.

    The last time I reinstalled gcc and failed, because yum find these three library in /usr/local/lib and didn't reinstall them. So the reinstalled gcc that depends on the library still will search for Intel math library. And this time since the library in /usr/local/lib is removed, yum install these three library that don't depend on Intel math library. So gcc don't search for intel math library anymore.

    I guess maybe these libraries in /usr/local/lib is installed when I install my gcc10 and that time Intel library is still in there, so these libraries are builed with intel and depend on intel library.


    By the way, this post explains what is mpc\mpfr\gmp :

    GCC depends on:
    GMP: GNU Multiple Precision Arithmetic Library
    MPFR: GNU Multiple-precision floating-point rounding library
    MPC: GNU Multiple-precision C library
    ELF: Executable and Linkable Format library
    PPL: Parma Polyhedra Library (optional, for memory optimizations)