Cygwin: error compiling shared LAMMPS lib

Hi, everyone:

I am trying to build a shared LAMMPS lib in Cygwin x86_64 environment (setup version 2.859). The mpicxx info is listed below:

$ mpicxx -v
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-4.9.2-1.x86_64/src/gcc-4.9.2/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-4.9.2-1.x86_64/src/gcc-4.9.2 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id
Thread model: posix
gcc version 4.9.2 (GCC)

The error I got is listed below. It looks like the g++ does not like the declaration “void init(int _N, double _deriv0, double _derivN){” in pair_meam_spline.h

mpicxx -O2 -fopenmp -fPIC -DLAMMPS_GZIP -DLAMMPS_JPEG -DLAMMPS_PNG -DLAMMPS_XDR -DLAMMPS_SMALLSMALL -DLMP_USER_OMP -I…/…/lib/atc -I…/…/src -I…/…/lib/poems -DLMP_MPIIO -DFFT_FFTW3 -I/cygdrive/c/cygwin/usr/local/include -I/usr/local/include/voro++ -c …/force.cpp
…/force.cpp:1:0: warning: -fPIC ignored for target (all code is position independent)
/* ----------------------------------------------------------------------
^
In file included from …/force.cpp:16:0:
…/pair_meam_spline.h:77:31: error: expected ‘,’ or ‘…’ before numeric constant
void init(int _N, double _deriv0, double _derivN) {
^
In file included from …/style_pair.h:180:0,
from …/force.cpp:22:
…/pair_meam_spline.h: In member function ‘void LAMMPS_NS::PairMEAMSpline::SplineFunction::init(int)’:
…/pair_meam_spline.h:79:34: error: ‘_deriv0’ was not declared in this scope
deriv0 = _deriv0;
^
…/pair_meam_spline.h:80:34: error: ‘_derivN’ was not declared in this scope
derivN = _derivN;
^
In file included from …/force.cpp:16:0:
…/pair_meam_sw_spline.h: At global scope:
…/pair_meam_sw_spline.h:77:31: error: expected ‘,’ or ‘…’ before numeric constant
void init(int _N, double _deriv0, double _derivN) {
^
In file included from …/style_pair.h:182:0,
from …/force.cpp:22:
…/pair_meam_sw_spline.h: In member function ‘void LAMMPS_NS::PairMEAMSWSpline::SplineFunction::init(int)’:
…/pair_meam_sw_spline.h:79:34: error: ‘_deriv0’ was not declared in this scope
deriv0 = _deriv0;
^
…/pair_meam_sw_spline.h:80:34: error: ‘_derivN’ was not declared in this scope
derivN = _derivN;
^
Makefile:103: recipe for target ‘force.o’ failed
make[1]: *** [force.o] Error 1
make[1]: Leaving directory ‘/home/jing/lammps/src/Obj_shlib_jing’
Makefile.shlib:42: recipe for target ‘jing’ failed
make: *** [jing] Error 2

Do I miss something? Searched the google and found one similar case back to Oct. 2012 in the thread “Cygwin: error compiling USERS-MISC???” without resolution posted. Any suggestion is greatly appreciated.

Best,

jing

Hi, everyone:

      I am trying to build a shared LAMMPS lib in Cygwin x86_64 environment
(setup version 2.859). The mpicxx info is listed below:

$ mpicxx -v
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with:
/cygdrive/i/szsz/tmpp/gcc/gcc-4.9.2-1.x86_64/src/gcc-4.9.2/configure
--srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-4.9.2-1.x86_64/src/gcc-4.9.2
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var
--sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share
--docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C
--build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin
--without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib
--enable-shared --enable-shared-libgcc --enable-static
--enable-version-specific-runtime-libs --enable-bootstrap
--enable-__cxa_atexit --with-dwarf2 --with-tune=generic
--enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite
--enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm
--enable-libquadmath --enable-libquadmath-support --enable-libssp
--enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers
--with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as
--with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix
--without-libintl-prefix --with-system-zlib --enable-linker-build-id
Thread model: posix
gcc version 4.9.2 (GCC)

    The error I got is listed below. It looks like the g++ does not like the
declaration "void init(int _N, double _deriv0, double _derivN){" in
pair_meam_spline.h

mpicxx -O2 -fopenmp -fPIC -DLAMMPS_GZIP -DLAMMPS_JPEG -DLAMMPS_PNG
-DLAMMPS_XDR -DLAMMPS_SMALLSMALL -DLMP_USER_OMP -I../../lib/atc -I../../src
-I../../lib/poems -DLMP_MPIIO -DFFT_FFTW3
-I/cygdrive/c/cygwin/usr/local/include -I/usr/local/include/voro++ -c
../force.cpp
../force.cpp:1:0: warning: -fPIC ignored for target (all code is position
independent)
/* ----------------------------------------------------------------------
^
In file included from ../force.cpp:16:0:
../pair_meam_spline.h:77:31: error: expected ‘,’ or ‘...’ before numeric
constant
                 void init(int _N, double _deriv0, double _derivN) {
                               ^
In file included from ../style_pair.h:180:0,
                 from ../force.cpp:22:
../pair_meam_spline.h: In member function ‘void
LAMMPS_NS::PairMEAMSpline::SplineFunction::init(int)’:
../pair_meam_spline.h:79:34: error: ‘_deriv0’ was not declared in this scope
                         deriv0 = _deriv0;
                                  ^
../pair_meam_spline.h:80:34: error: ‘_derivN’ was not declared in this scope
                         derivN = _derivN;
                                  ^
In file included from ../force.cpp:16:0:
../pair_meam_sw_spline.h: At global scope:
../pair_meam_sw_spline.h:77:31: error: expected ‘,’ or ‘...’ before numeric
constant
                 void init(int _N, double _deriv0, double _derivN) {
                               ^
In file included from ../style_pair.h:182:0,
                 from ../force.cpp:22:
../pair_meam_sw_spline.h: In member function ‘void
LAMMPS_NS::PairMEAMSWSpline::SplineFunction::init(int)’:
../pair_meam_sw_spline.h:79:34: error: ‘_deriv0’ was not declared in this
scope
                         deriv0 = _deriv0;
                                  ^
../pair_meam_sw_spline.h:80:34: error: ‘_derivN’ was not declared in this
scope
                         derivN = _derivN;
                                  ^
Makefile:103: recipe for target 'force.o' failed
make[1]: *** [force.o] Error 1
make[1]: Leaving directory '/home/jing/lammps/src/Obj_shlib_jing'
Makefile.shlib:42: recipe for target 'jing' failed
make: *** [jing] Error 2

Do I miss something? Searched the google and found one similar case back to
Oct. 2012 in the thread "Cygwin: error compiling USERS-MISC???" without
resolution posted. Any suggestion is greatly appreciated.

this looks as if something is going wrong during preprocessing.
perhaps your cygwin installation defines an incompatible preprocessing
macro.
compilation for windows is only tested regularly using a mingw cross
compiler on linux, and that currently doesn't cause any problems with
MEAM. or USER-MISCl

axel.

I checked this and got a clean build from tar-ball including user-misc
and more. For cygwin64, I did the following:

- selected gcc/g++ 4.8 (not sure this is necessary here but my builds
   use 4.8)

- added a extra define in the default *serial* makefile for SMALLBIG
  (cygwin doesn't define INT64_MAX properly)

    [Makefile.mpi]
    ...
    LMP_INC = -DLAMMPS_GZIP ... -DINT64_MAX=9223372036854775807LL ...
    ...

- changed lines 77/78 in "src\pair_meam_sw_spline.h" and
   "src\pair_meam_spline.h" to:
         ...
    77: void init(int _N_, double _deriv0, double _derivN) {
    78: N = _N_;
         ...
    (changed formal argument _N to _N_)

- now I get a clean *serial* (STUBS) build w/cygwin64 (1.733) using
   the modules: user-misc, reax, user-reaxc, rigid, poems, mc.

- Then, I added Axel's user-omp and modified the default *mpi*
   makefile with the INT64_MAX definition, rebuild.

- Now I have two lammps executeables in cygwin64:
    $ ls -la bin/
    -rwxr-xr-x 1 user none 54412620 Feb 2 17:44 lmp_mpi.exe
    -rwxr-xr-x 1 user none 54286229 Feb 2 17:49 lmp_serial.exe

All builds are smooth without any warning.

Regards

M.