Compiling VASP.6.1.1 on a macOS Catalina 10.15.6-errors

Questions regarding the compilation of VASP on various platforms: hardware, compilers and libraries, etc.

Moderators: Global Moderator, Moderator

Post Reply
Message
Author
nicholas_dimakis1
Newbie
Newbie
Posts: 17
Joined: Tue Sep 15, 2020 3:36 pm

Compiling VASP.6.1.1 on a macOS Catalina 10.15.6-errors

#1 Post by nicholas_dimakis1 » Wed Sep 16, 2020 7:08 pm

Hello

I have a problem compiling VASP.6.1.1 on a macOS Catalina 10.15.6. I use gfortran. Both the make.include and the output from the make command files are included as attachments. I copy the crash here.

% make
if [ ! -d build/std ] ; then mkdir build/std ; fi; \
cp src/makefile src/.objects makefile.include build/std ; \
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C build/std VERSION=std all
rsync -ru ../../src/lib .
cp makefile.include lib
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C lib -j1
make libdmy.a
gcc -O -c -o getshmem.o getshmem.c
getshmem.c:23:42: error: use of undeclared identifier 'SHM_NORESERVE'
shmflg = IPC_CREAT | IPC_EXCL | 0600 | SHM_NORESERVE ;
^
getshmem.c:40:42: error: use of undeclared identifier 'SHM_NORESERVE'
shmflg = IPC_CREAT | IPC_EXCL | 0600 | SHM_NORESERVE ;
^
2 errors generated.
make[3]: *** [getshmem.o] Error 1
make[2]: *** [all] Error 2
make[1]: *** [lib] Error 2
make: *** [std] Error 2

Thank you,
Nick
You do not have the required permissions to view the files attached to this post.

User avatar
chengcheng_xiao1
Newbie
Newbie
Posts: 26
Joined: Sun Nov 17, 2019 6:23 pm
Location: London, UK
Contact:

Re: Compiling VASP.6.1.1 on a macOS Catalina 10.15.6-errors

#2 Post by chengcheng_xiao1 » Tue Sep 22, 2020 11:56 am

The fix can be found here https://thelostelectron.wordpress.com/tag/vasp/.

Note that installing VASP on your laptop might be a violation of the user agreement.

henrique_miranda
Global Moderator
Global Moderator
Posts: 414
Joined: Mon Nov 04, 2019 12:41 pm
Contact:

Re: Compiling VASP.6.1.1 on a macOS Catalina 10.15.6-errors

#3 Post by henrique_miranda » Thu Oct 01, 2020 5:45 am

Note that the solution posted above might fix the compilation but it does not explain the issue or why and if the fix works.

The getshmem.c file contains a custom implementation of shared memory used by VASP.
If you look inside the code you will see specific system calls for example: shmget
here is the Linux manual:
https://man7.org/linux/man-pages/man2/shmget.2.html
there is a macOS counterpart:
https://developer.apple.com/library/arc ... get.2.html

This system call is specific of System V: https://en.wikipedia.org/wiki/UNIX_System_V
Without going into too much details, this is a function is provided by the operating system which might or might not be implemented in macOS with the same arguments as Linux.
This seemd to be the case here: the SHM_NORESERVE option does not exist in macOS (and hence not defined in the header) so the function should not be called in the same way as in Linux.
As such, I would say that the fix suggested above is not the most appropriate.

Note that you only need the getshmem.o object when you want to use the custom shared memory implementation inside VASP i.e. when '-Duse_shmem -Dshmem_rproj -Dshmem_bcast_buffer' are present in CPP_OPTIONS.
If this is not the case, the proper fix would be to remove getshmem.o from OBJECTS_LIB and skip the compilation of this file altogether.

TL;DR
The shared memory feature provided by getshmem.c is not officially supported on macOS, as such you should:
- NOT use any of the -Duse_shmem -Dshmem_rproj -Dshmem_bcast_buffer in CPP_OPTIONS
- remove getshmem.o from OBJECTS_LIB

Post Reply