Make.py adding restrict flag to g++ compilation

I’m trying to compile a serial LAMMPS executable on an OSX machine. I believe this is caused by the Make.py script incorrectly adding the -restrict flag to g++. Compiling directly using “make serial” works fine. This is with lammps that was updated today, and python 2.7.

python make:
python Make.py -j 2 -p none user-reaxc asphere molecule kspace rigid manybody class2 granular mc opt shock orig -a file clean exe -m serial -v

python error:

Traceback (most recent call last):
File “Make.py”, line 2258, in
elif action == “file”: actions.file(“file”)
File “Make.py”, line 340, in file
if compile_check(compiler,"-restrict",0):
File “Make.py”, line 88, in compile_check
txt = subprocess.check_output(tmp,stderr=subprocess.STDOUT,shell=True).decode()
File “/Users/bdjensen/miniconda2/lib/python2.7/subprocess.py”, line 573, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command ‘g++ -restrict -c tmpauto.cpp’ returned non-zero exit status 1

Thanks.

-Ben

I'm trying to compile a serial LAMMPS executable on an OSX machine. I
believe this is caused by the Make.py script incorrectly adding the
-restrict flag to g++. Compiling directly using "make serial" works fine.
This is with lammps that was updated today, and python 2.7.

thanks for reporting. this is not really incorrect, but Make.py should
not fail on it.
this is a side effect of our attempt to get LAMMPS ready for python 3.

i will look into it.

An additional note:

The crashed Make.py is leaving behind the file “tmpauto.cpp”, so that when I subsequently tried to compile without Make.py I got an error:

duplicate symbol _main in:
main.o
tmpauto.o

Removing the tmpauto.cpp file allows the compile to complete without additional errors.

Thanks.

-Ben

An additional note:

The crashed Make.py is leaving behind the file "tmpauto.cpp", so that when I
subsequently tried to compile without Make.py I got an error:

duplicate symbol _main in:
    main.o
    tmpauto.o

Removing the tmpauto.cpp file allows the compile to complete without
additional errors.

yes. this should not happen anymore, after i fixed the problem in Make.py.

unfortunately, i was caught up in testing bugfix for ad different
issue and then a little bit late in submitting the pull request for
steve to merge it into the development repository today.
it will hopefully be processed tomorrow and included in the next LAMMPS patch.

in case you want to test it (and hunt for other bugs), i am attaching
the latest version.

axel.

Make.py.gz (16.9 KB)

Thanks Axel, the system compiles with no problems using the patch you sent.
Thanks.

-Ben