Psi4 runtime Python failure

Hi everyone,

I am building Psi4 in a cluster environment using modules to import the necessary compilers/libraries. I compiled and linked with gcc 5.4.0 without problems. However, tests fail with:

E   ImportError: /global/software/sl-7.x86_64/modules/langs/python/2.7/bin/../lib/libstdc++.so.6: version `CXXABI_1.3.8'     not found (required by /local/scratch/users/jgonthier/psi4_trunk/obj_rel/stage/clusterfs/mhg/jgonthier/psi4_inst/lib/psi4/core.so)

The same error appears if I launch python and try “import core” from the staged core.so directory. It’s using the wrong libstdc++ that it takes from the Python 2.7 library. The correct libstdc++ is in the gcc 5.4.0 path. However, the correct library is in my LD_LIBRARY_PATH and I also added it to my PYTHONPATH. Running

ldd core.so

gives

   linux-vdso.so.1 =>  (0x00007ffd08bdf000)
    libz.so.1 => /usr/lib64/libz.so.1 (0x00002ac413f7f000)
    libmkl_rt.so => /global/software/sl-7.x86_64/modules/langs/intel/2016.4.072/mkl/lib/intel64/libmkl_rt.so (0x00002ac414197000)
    libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00002ac41478f000)
    libhdf5.so.10 => /global/software/sl-7.x86_64/modules/gcc/5.4.0/hdf5/1.8.18-gcc-s/lib/libhdf5.so.10 (0x00002ac4149af000)
    libdl.so.2 => /usr/lib64/libdl.so.2 (0x00002ac414eaf000)
    libm.so.6 => /usr/lib64/libm.so.6 (0x00002ac4150b7000)
    libgfortran.so.3 => /global/software/sl-7.x86_64/modules/langs/gcc/5.4.0/lib64/libgfortran.so.3 (0x00002ac4153bf000)
    libquadmath.so.0 => /global/software/sl-7.x86_64/modules/langs/gcc/5.4.0/lib64/libquadmath.so.0 (0x00002ac4156e7000)
    libstdc++.so.6 => /global/software/sl-7.x86_64/modules/langs/gcc/5.4.0/lib64/libstdc++.so.6 (0x00002ac415927000)
    libgomp.so.1 => /global/software/sl-7.x86_64/modules/langs/gcc/5.4.0/lib64/libgomp.so.1 (0x00002ac415ca7000)
    libgcc_s.so.1 => /global/software/sl-7.x86_64/modules/langs/gcc/5.4.0/lib64/libgcc_s.so.1 (0x00002ac415ecf000)
    libc.so.6 => /usr/lib64/libc.so.6 (0x00002ac4160e7000)
    /lib64/ld-linux-x86-64.so.2 (0x00002ac407327000)

thus finding the correct library. Does anyone know how do I tell Python which libstdc++ to load when importing a dynamic library?

You can force the correct libs by using LD_PRELOAD
In the past I used a bash script that had this line:

LD_PRELOAD=/somewhere/gcc-4.9.4/lib64/libstdc++.so /psi4_install_path/bin/psi4 $@

1 Like

That was exactly what I needed. I spent some time trying to figure out which environment variable could help me and after trying a few I figured I’d use the forum’s wisdom. My problem is resolved and the tests are passing (for now at least). Thanks a lot!