shankar1729 / jdftx

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

Does not accept GSL/2.8 #372

Open paul-f-baumeister opened 3 days ago

paul-f-baumeister commented 3 days ago

I am trying to compile on MacOSX with homebrew and get this error:

$ brew info GSL ==> gsl: stable 2.8 (bottled)

$ CC=clang CXX=clang++ cmake -D GSL_PATH=/opt/homebrew/Cellar/gsl/2.8 ../jdftx -- Git revision hash: 56912112 -- Looking for gsl_integration_glfixed_point -- Looking for gsl_integration_glfixed_point - not found CMake Error at CMake-Modules/FindGSL.cmake:36 (message): Unsupported GNU Scientific Library version; need version >= 1.15 Call Stack (most recent call first): CMakeLists.txt:59 (find_package)

-- Configuring incomplete, errors occurred! See also "/Users/pbaum/Codes/jdftx-git/build/CMakeFiles/CMakeOutput.log". See also "/Users/pbaum/Codes/jdftx-git/build/CMakeFiles/CMakeError.log".

shankar1729 commented 1 day ago

Hi Paul,

I tested a GSL 2.8 build on Linux, and it worked fine for JDFTx. I don't have access to MacOS to test for it specifically, but this likely suggests this has more to do with the brew installation than GSL itself. Could you try a manual from-source compilation of GSL?

Also, does this specifically fail for you only for GSL 2.8 and not for previous versions? Maybe also post the contents of the /opt/homebrew/Cellar/gsl/2.8 directory specified in your build.

Best, Shankar

paul-f-baumeister commented 1 day ago

Maybe the leading underscore causes problems:

$nm /opt/homebrew/Cellar/gsl/2.8/lib/libgsl.dylib | grep -i gsl_integration_glfixed_point
00000000000390d4 T _gsl_integration_glfixed_point

The library function seems to be offered. I guess I will have to build it manually from source.

shankar1729 commented 8 hours ago

The underscore prefix seems to be related to Clang, and likely the corresponding linker should not have an issue with it. Maybe it's just the CMake library check that's somehow broken in this combination.

Perhaps try modifying the version check logic in FindGSL.cmake (line 14); see https://github.com/shankar1729/jdftx/blob/master/jdftx/CMake-Modules/FindGSL.cmake to either add the preceding underscore, or circumvent the version check overall by removing GSL_VERSION_ADEQUATE from line 18. If it then proceeds to build correctly, it's the check that's going wrong rather than the library.

(Make sure you clean out your build directory completely each time before testing these changes, so that you are not affected by CMake's cached results.)