shankar1729 / jdftx

JDFTx: software for joint density functional theory
http://jdftx.org
82 stars 54 forks source link

DFT C compiler and CXX compiler not loading correctly #267

Closed 24sunho closed 9 months ago

24sunho commented 1 year ago

I kept running into the issue with the C compiler and CXX compiler not loading correctly, and was wondering if there is a fix for this.

cmake -D EnableLibXC=yes -D GSL_PATH=/home/sunhok/gslbuild/gsl-2.7.1 -D EnableMKL=yes -D MKL_PATH=/home/sunhok/lib/cmake/mkl-2023.0.0 -D FFTW3_PATH=/home/sunhok/fftw-3.3.10 ../jdftx-1.7.0/jdftx -- The C compiler identification is unknown -- The CXX compiler identification is unknown -- Check for working C compiler: /home/spack/.spack/opt/spack/linux-centos7-haswell/gcc-4.8.5/gcc-11.2.0-badtwcass7lspftppao5xnb2a4n77nbo/bin/gcc -- Check for working C compiler: /home/spack/.spack/opt/spack/linux-centos7-haswell/gcc-4.8.5/gcc-11.2.0-badtwcass7lspftppao5xnb2a4n77nbo/bin/gcc - broken CMake Error at /usr/share/cmake3/Modules/CMakeTestCCompiler.cmake:60 (message): The C compiler

"/home/spack/.spack/opt/spack/linux-centos7-haswell/gcc-4.8.5/gcc-11.2.0-badtwcass7lspftppao5xnb2a4n77nbo/bin/gcc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /home/sunhok/JDFTXDIR/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_0669b/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_0669b.dir/build.make CMakeFiles/cmTC_0669b.dir/build
gmake[1]: Entering directory `/home/sunhok/JDFTXDIR/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_0669b.dir/testCCompiler.c.o
/home/spack/.spack/opt/spack/linux-centos7-haswell/gcc-4.8.5/gcc-11.2.0-badtwcass7lspftppao5xnb2a4n77nbo/bin/gcc    -o CMakeFiles/cmTC_0669b.dir/testCCompiler.c.o   -c /home/sunhok/JDFTXDIR/build/CMakeFiles/CMakeTmp/testCCompiler.c
cc1: error: /home/lazhang/gsl-2.7.1/gsl/include: Permission denied
gmake[1]: *** [CMakeFiles/cmTC_0669b.dir/testCCompiler.c.o] Error 1
gmake[1]: Leaving directory `/home/sunhok/JDFTXDIR/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_0669b/fast] Error 2

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:3 (project)

-- Configuring incomplete, errors occurred! See also "/home/sunhok/JDFTXDIR/build/CMakeFiles/CMakeOutput.log". See also "/home/sunhok/JDFTXDIR/build/CMakeFiles/CMakeError.log".

shankar1729 commented 1 year ago

This seems to be a permissions issue as indicated by the error message error: /home/lazhang/gsl-2.7.1/gsl/include: Permission denied in the above snippet.

I'm not sure why the compiler test is trying to access GSL. You may want to test that compiler manually with a simple C/C++ hello-world file and check that it works first, before trying to debug this within cmake further. There is nothing specific about the JDFTx CMake file that is causing this issue (since it happens so early), and so you first need to test that the compiler itself works.