Problem with building Psi4-1.3

Hi there,

While building Psi4-1.3, I am getting such an error message:

Scanning dependencies of target cc
In file included from /home/eve/Git/psi4-1.3/psi4/src/psi4/libmints/eribase.cc:33:
/home/eve/Git/psi4-1.3/psi4/src/psi4/libmints/eri.h:33:10: fatal error: libderiv/libderiv.h: No such file or directory
#include <libderiv/libderiv.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
src/psi4/libmints/CMakeFiles/mints.dir/build.make:387: recipe for target ‘src/psi4/libmints/CMakeFiles/mints.dir/eribase.cc.o’ failed
make[5]: *** [src/psi4/libmints/CMakeFiles/mints.dir/eribase.cc.o] Error 1
make[5]: *** Waiting for unfinished jobs…

I have tried to find the libderiv.h file, but it does not seem that it is located somewhere in the repository. Did I miss any configuration before cmake?

I would really appreciate if anyone has any hint how to solve the problem.

Look over this topic. The first five posts are the most relevant. Let us know if that doesn’t solve the issue.

What @loriab said in that discussion was to simply copy include/libderiv/libderiv.h to include/libint/libderiv.h. The current version of Psi4 has a different structure and these paths do not lead to libderiv.h. I ran the command: find -name libderiv.h to find a location of the libderiv.h, but it does not exist.

libint/libderiv isn’t in the psi4 source – it’s an external dependency that either gets detected as pre-built (you cloned and built it elsewhere or installed through a package manager) or gets cloned and built before psi4 builds. I suspect you have the former. You should find where libint is installed that it’s detecting (printed in cmake output or in Libint_DIR of <objdir>/CMakeCache.txt) and do the copying there.

Thank you for your explanation, @loriab! I checked the path which is:
/tools/anacondapython-3.6.4/share/cmake/Libint
so that dependencies are pulled out from the anaconda package. There are only cmake files. Does it mean that I should update anaconda? What do you think?

then the file you want to shift is in /tools/anacondapython-3.6.4/include/

@loriab Thank you for your help! I managed building Psi4-1.3.
However, I ran the tests and all of them failed.
The log file lists such errors:

Start testing: Jul 01 10:54 CDT
----------------------------------------------------------
7/420 Testing: casscf-sp
7/420 Test: casscf-sp
Command: "/tools/anacondapython-3.6.4/bin/python" "/home/esz001/Git/psi4-1.3/tests/runtest.py" "/home/esz001/Git/psi4-1.3/tests/casscf-sp/input.dat" "/home/esz001/Git/psi4-1.3/objdir_test/testresults.log" "false" "/home/esz001/Git/psi4-1.3" "false" "/home/esz001/Git/psi4-1.3/objdir_test/tests/casscf-sp/output.dat" "/home/esz001/Git/psi4-1.3/objdir_test/stage/bin/psi4" "/home/esz001/Git/psi4-1.3/objdir_test/stage/share/psi4" "/home/esz001/Git/psi4-1.3/objdir_test/stage/lib/"
Directory: /home/esz001/Git/psi4-1.3/objdir_test/tests/casscf-sp
"casscf-sp" start time: Jul 01 10:54 CDT
Output:
----------------------------------------------------------
Traceback (most recent call last):
  File "/home/esz001/Git/psi4-1.3/objdir_test/stage/lib/psi4/__init__.py", line 55, in <module>
    from . import core
ImportError: /home/esz001/Git/psi4-1.3/objdir_test/stage/lib/psi4/../libgg.so.1: undefined symbol: aligned_alloc

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/esz001/Git/psi4-1.3/objdir_test/stage/bin/psi4", line 177, in <module>
    import psi4
  File "/home/esz001/Git/psi4-1.3/objdir_test/stage/lib/psi4/__init__.py", line 60, in <module>
    raise ImportError("{0}".format(err))
ImportError: /home/esz001/Git/psi4-1.3/objdir_test/stage/lib/psi4/../libgg.so.1: undefined symbol: aligned_alloc
Exit Status: infile ( 1 ); autotest ( None ); sowreap ( None ); overall ( 1 )
<end of output>
Test time =   2.56 sec

Do you have any idea what may cause this issue?

What’s your OS and compiler? Looks a little like https://github.com/dgasmith/gau2grid/issues/42. Can bypass by using a conda package.

I just got the same string of errors today when building the last version of Psi4 but on under Linux, not MacOS. Python comes from an Anaconda3 install. I’m using gcc 9.2.1. What is the best fix for this (and why does it happen)?

For one thing, psi v1.3 uses gau2grid v1 and psi4 master uses gau2grid v2, so make you have the right lib built. Second, even if you built the right one, if the other one is still findable (LD_LIBRARY_PATH and such), it can mess up runtime. ldd -v core.*so can help reveal the current state.

ldd doesn’t seem to help too much:

122 thor.chem.wsu.edu:/home/kipeters/psi4/broadwell/stage/lib/psi4> ldd core*.so
linux-vdso.so.1 => (0x00007ffe5f95c000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002adef4d9c000)
libgomp.so.1 => /share/apps/lib64/libgomp.so.1 (0x00002adef4fa0000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002adef51d5000)
libgfortran.so.5 => /share/apps/lib64/libgfortran.so.5 (0x00002adef53f3000)
libquadmath.so.0 => /share/apps/lib64/libquadmath.so.0 (0x00002adef584d000)
libstdc++.so.6 => /share/apps/lib64/libstdc++.so.6 (0x00002adef5a93000)
libm.so.6 => /lib64/libm.so.6 (0x00002adef5e6e000)
libgcc_s.so.1 => /share/apps/lib64/libgcc_s.so.1 (0x00002adef60f2000)
libc.so.6 => /lib64/libc.so.6 (0x00002adef6309000)
/lib64/ld-linux-x86-64.so.2 (0x00000036ee400000)
librt.so.1 => /lib64/librt.so.1 (0x00002adef669e000)

I should have noted I’m using psi4 master (git pull today)

Looks like I did build v2 of gau2grid, but it has lots of compilation warnings that seem to be related to my issue:

/home/kipeters/psi4/broadwell/external/upstream/gau2grid/gau2grid_external-prefix/src/gau2grid_external-build/gau2grid_pragma.h:70:62: warning: incompatible implicit declaration of built-in function ‘aligned_alloc’
70 | #define ALIGNED_MALLOC(alignment, size) aligned_alloc(alignment, size)

Deleted everything today, did a fresh clone from the git repository, rebuilt Anaconda3, rebuilt psi4. Same issue. I’m using a much more up-to-date gcc (9.2.1) compared to the system one, which is very old. But cmake seems to find all the right paths and such.

I have tried to build Psi4 from source on MacOS. I have followed these instructions:
https://psicode.netlify.app/installs/v132/

While running the command:

psi4-path-advisor --clang

I got the error message:

zsh: no such file or directory: CONDA_BUILD_SYSROOT=~/SDKs/MacOSX10.9.sdk

What is the fix for this?

Are you trying to build v.1.3.2 or the latest version?
Btw, unless you want to do code changes, there is no need to compile psi4 yourself, the conda packages are fast and optimized.

You can try to remove the CONDA_BUILD_SYSROOT part from the output of psi4-path-advisor --clang or you can download it from here: https://github.com/phracker/MacOSX-SDKs

What OSX and Xcode version are you using?

also paging @loriab