Error during installation (make): "unsafe srcdir value"

GROMACS version: 2020.2
GROMACS modification: No
Hello,
I used gromacs on a cluster long ago, and need to use it again. I’m trying to install it on my Mac (macOS Catalina 10.15.5) and I have CMake and gcc 5.1 (although when I do “gcc --version” I can’t seem to see the actual version, might be the problem).

I extracted the tar.gz and made build/ and navigated into it, exactly as described in the installation guide.

Then when I do cmake, whether or not I include -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON, I get some weird stuff but it still looks OK:


DN0a1e47a9:build stevenshuken$ cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON

-- Atomic operations not found

-- Atomic operations not found

CMake Warning at cmake/ThreadMPI.cmake:130 (message):

Atomic operations not found for this CPU+compiler combination. Thread

support will be unbearably slow: disable threads. Atomic operations should

work on all but the most obscure CPU+compiler combinations; if your system

is not obscure -- like, for example, x86 with gcc -- please contact the

developers.

Call Stack (most recent call first):

CMakeLists.txt:563 (tmpi_enable)

-- The GROMACS-managed build of FFTW 3 will configure with the following optimizations: 

-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 

-- Doxygen not found. Documentation targets will not be generated.

Downloading: http://gerrit.gromacs.org/download/regressiontests-2020.2.tar.gz

-- [download 100% complete]

-- [download 0% complete]

-- [download 1% complete]

-- [download 2% complete]

................

-- [download 98% complete]

-- [download 99% complete]

-- [download 100% complete]

-- Configuring done

-- Generating done

-- Build files have been written to: /Users/stevenshuken/Documents/Research/_Software and hardware/Gromacs/gromacs-2020.2/build

Then when I do “make” stuff goes seriously wrong:


DN0a1e47a9:build stevenshuken$ make

[ 1%] **Performing configure step for 'fftwBuild'**

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... configure: error: unsafe srcdir value: '/Users/stevenshuken/Documents/Research/_Software and hardware/Gromacs/gromacs-2020.2/build/src/external/build-fftw/fftwBuild-prefix/src/fftwBuild'

make[2]: *** [src/external/build-fftw/fftwBuild-prefix/src/fftwBuild-stamp/fftwBuild-configure] Error 1

make[1]: *** [src/external/build-fftw/CMakeFiles/fftwBuild.dir/all] Error 2

make: *** [all] Error 2

I’ve scoured the internet and although someone on the old email list appears to once have had this problem, I couldn’t find the solution. Please help!! :)
-Steven

As you didn’t assign C/C++ compiler explicitly, I guess cmake picks clang/clang++ as your compiler. You can define C/C++ compiler explicitly. Also, consider to define the installation directory, it helps to avoid unnecessary sudo command. Try something like that,

cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/path/to/gromacs   -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON 

Regards,
Masrul

Ah, that makes sense. This seemed to make cmake perform without incident! But then when I run make, I get into trouble again… everything seems to go smoothly until the end of the output, which you can see below. When I run make check I see the same thing, and then when I try to run gmx or which -a gmx nothing happens. It looks like it might be trying to make a Windows version or something?

DN0a1e47a9:build stevenshuken$ make

**Scanning dependencies of target fftwBuild**

....
....
....

ld: symbol(s) not found for architecture x86_64

clang: **error:** linker command failed with exit code 1 (use -v to see invocation)

make[2]: *** [lib/libgromacs.5.0.0.dylib] Error 1

make[1]: *** [src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2

make: *** [all] Error 2

DN0a1e47a9:build stevenshuken$ make check

**Scanning dependencies of target mdrun_objlib**
....
....
....

ld: symbol(s) not found for architecture x86_64

clang: **error:** linker command failed with exit code 1 (use -v to see invocation)

make[2]: *** [lib/libgromacs.5.0.0.dylib] Error 1

make[1]: *** [src/gromacs/CMakeFiles/libgromacs.dir/all] Error 2

make: *** [all] Error 2

DN0a1e47a9:build stevenshuken$ source /usr/local/gromacs/bin/GMXRC

-bash: /usr/local/gromacs/bin/GMXRC: No such file or directory

DN0a1e47a9:build stevenshuken$ gmx

-bash: gmx: command not found

DN0a1e47a9:build stevenshuken$ which -a gmx

DN0a1e47a9:build stevenshuken$

Ah, and I saw the same thing when I did sudo make install .

Does not look like you are using -DCMAKE_INSTALL_PREFIX

Please use a directory in your home or somewhere else. Don’t use /usr/ or /opt type directory

@Masrul why not? The default for -DCMAKE_INSTALL_PREFIX is /usr/local/gromacs anyway. One can certainly install in /usr/ with sudo make install.

Dr. Lemkul(@jalemkul ),

My original suggestion to problem is to explicitly assign C/C++ compiler, as macOS will pick Clang/Clang++ as compiler. Suggestion of using -DCMAKE_INSTALL_PREFIX was optional, yet I find it convenient. Thanks for indicating, I will be more careful in future while replying.

Sincerely,
Masrul

Masrul,
Thanks for your reply. I did in fact use -DCMAKE_INSTLL_PREFIX when calling cmake and the directory was set to /Users/stevenshuken/Documents/Research/_Software-and-hardware/Gromacs/, which is where I have the gromacs-2020.2.tar.gz and where the expanded gromacs-2020.2 is. I will try setting -DCMAKE_INSTLL_PREFIX to something else in case that’s a problem.

This is what happens:

DN0a1e47a9:build stevenshuken$ cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/Users/stevenshuken/Applications/ -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON

-- The C compiler identification is AppleClang 11.0.3.11030032

-- The CXX compiler identification is AppleClang 11.0.3.11030032

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working C compiler: /usr/bin/gcc - skipped

-- Detecting C compile features

-- Detecting C compile features - done

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Check for working CXX compiler: /usr/bin/g++ - skipped

-- Detecting CXX compile features

-- Detecting CXX compile features - done

-- Performing Test USING_LIBSTDCXX

-- Performing Test USING_LIBSTDCXX - Failed

-- Looking for NVIDIA GPUs present in the system

-- Could not detect NVIDIA GPUs

-- No compatible CUDA toolkit found (v5.0+), disabling native GPU acceleration

-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) 

-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) 

-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND) 

CMake Warning at cmake/gmxManageOpenMP.cmake:44 (message):

The compiler you are using does not support OpenMP parallelism. This might

hurt your performance a lot, in particular with GPUs. Try using a more

recent version, or a different compiler. For now, we are proceeding by

turning off OpenMP.

Call Stack (most recent call first):

CMakeLists.txt:319 (include)



-- [download 100% complete]

-- Configuring done

-- Generating done

-- Build files have been written to: /Users/stevenshuken/Documents/Research/_Software-and-hardware/Gromacs/gromacs-2020.2/build

And then, with make:

DN0a1e47a9:build stevenshuken$ make

**Scanning dependencies of target fftwBuild**

[ 0%] **Creating directories for 'fftwBuild'**

[ 0%] **Performing download step (download, verify and extract) for 'fftwBuild'**

-- Downloading...

dst='/Users/stevenshuken/Documents/Research/_Software-and-hardware/Gromacs/gromacs-2020.2/build/src/external/build-fftw/fftwBuild-prefix/src/fftw-3.3.8.tar.gz'

timeout='none'

-- Using src='http://www.fftw.org/fftw-3.3.8.tar.gz'

-- [download 0% complete]

-- [download 1% complete]

-- [download 2% complete]



**Scanning dependencies of target gmx**

[ 98%] Building CXX object src/programs/CMakeFiles/gmx.dir/gmx.cpp.o

[ 98%] Building CXX object src/programs/CMakeFiles/gmx.dir/legacymodules.cpp.o

[ 98%] **Linking CXX executable ../../bin/gmx**

[ 98%] Built target gmx

**Scanning dependencies of target gmxapi**

[ 98%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/context.cpp.o

[ 98%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/exceptions.cpp.o

[ 98%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/gmxapi.cpp.o

[100%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/md.cpp.o

[100%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/mdmodule.cpp.o

[100%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/mdsignals.cpp.o

[100%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/session.cpp.o

[100%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/status.cpp.o

[100%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/system.cpp.o

[100%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/version.cpp.o

[100%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/workflow.cpp.o

[100%] Building CXX object src/api/cpp/CMakeFiles/gmxapi.dir/tpr.cpp.o

[100%] **Linking CXX shared library ../../../lib/libgmxapi.dylib**

[100%] Built target gmxapi

DN0a1e47a9:build stevenshuken$

@srshuken,
It surprises me that cmake didn’t respect -DCMAKE_C_COMPILER/-DCMAKE_CXX_COMPILER. As your clang doesn’t have OpenMP support, that’s why you are seeing warnings. Due to lack of OpenMP support, gromacs will be slow. I am not sure, but it is worth trying to specify CC and CXX too,

CC=gcc CXX=g++ cmake .. -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/Users/stevenshuken/Applications/ -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON

It is also, worth noting, since macOS catalina, Apple made it very hard to use GNU compiler. I am using the academic version of the Intel compiler in the macOS Catalina to avoid all these hassles.

Sincerely,
Masrul

Masrul, thank you so much for your help. I may try to reinstall with OpenMP support, but the rest of the steps work and gromacs runs now! changing the install prefix worked. Since I am doing pretty small and short simulations hopefully it will be fine. Thanks again.