dgasmith / gau2grid

Fast computation of a gaussian and its derivative on a grid.
https://gau2grid.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
29 stars 15 forks source link

Build fails: cmake failure #31

Closed yurivict closed 5 years ago

yurivict commented 5 years ago

Version 1.3.0 fails:

[ 12%] Generating gau2grid.h, gau2grid_orbital.c, gau2grid_phi.c, gau2grid_deriv1.c, gau2grid_deriv2.c, gau2grid_spherical.c, gau2grid_helper.c
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/gau2grid/c_generator.py", line 151, in generate_c_gau2grid
    sig = RSH.transformation_c_generator(gg_spherical, L, cartesian_order, spherical_order, align=ALIGN_SIZE)
  File "/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/gau2grid/RSH.py", line 268, in transformation_c_generator
    RSH_coefs = cart_to_RSH_coeffs(L, order=spherical_order)
  File "/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/gau2grid/RSH.py", line 177, in cart_to_RSH_coeffs
    data = _saved_rsh_coefs[L]
KeyError: 0
gmake[3]: *** [CMakeFiles/gg.dir/build.make:62: gau2grid.h] Error 1
gmake[3]: Leaving directory '/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/build/temp.freebsd-11.2-STABLE-amd64-3.6'
gmake[2]: *** [CMakeFiles/Makefile2:72: CMakeFiles/gg.dir/all] Error 2
gmake[2]: Leaving directory '/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/build/temp.freebsd-11.2-STABLE-amd64-3.6'
gmake[1]: *** [Makefile:130: all] Error 2
gmake[1]: Leaving directory '/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/build/temp.freebsd-11.2-STABLE-amd64-3.6'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 143, in <module>
    zip_safe=False, )
  File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 143, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 33, in run
    self.build_extension(ext)
  File "setup.py", line 60, in build_extension
    subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
  File "/usr/local/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.

The underlying cmake command fails:

$ cmake --build . --config Release -- -j2
Error: could not load cache

$ cmake . A simpler cmake command also fails:

$ cmake .
...
...
-- Setting (unspecified) option INSTALL_PYMOD: OFF
CMake Error at cmake/autocmake_safeguards.cmake:16 (message):
  In-source builds not allowed.  Please run CMake from top directory and
  specify a build directory (e.g., cmake -H.  -Bbuild).
Call Stack (most recent call first):
  CMakeLists.txt:47 (include)

-- Configuring incomplete, errors occurred!
dgasmith commented 5 years ago

Works fine on my laptop, Travis, and Appveyor. Can you remove all eggs, dist, pycache, etc and show the exact command that you used?

yurivict commented 5 years ago

This is in the port, there are no eggs, dist, pycace, etc.

Including the full log with commands:

===>  Configuring for py36-gau2grid-1.3.0
(cd /usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0; /usr/bin/env XDG_DATA_HOME=/usr/ports/math/py-gau2grid/work-py36  XDG_CONFIG_HOME=/usr/ports/math/py-gau2grid/work-py36  HOME=/usr/ports/math/py-gau2grid/work-py36 PATH=/usr/ports/math/py-gau2grid/work-py36/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES LDSHARED="cc -shared" PYTHONDONTWRITEBYTECODE= PYTHONOPTIMIZE= PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe -fno-omit-frame-pointer  -fstack-protector -fno-strict-aliasing "  CPP="cpp" CPPFLAGS="-fno-omit-frame-pointer"  LDFLAGS=" -fstack-protector " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fno-omit-frame-pointer -fstack-protector -fno-strict-aliasing -fno-omit-frame-pointer  "  MANPREFIX="/usr/local" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" /usr/local/bin/python3.6 -c  "import sys; import setuptools;  __file__='setup.py'; sys.argv[0]='setup.py';  exec(compile(open(__file__, 'rb').read().replace(b'\\r\\n', b'\\n'), __file__, 'exec'))" config )
running config
===>  Building for py36-gau2grid-1.3.0
(cd /usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0; /usr/bin/env XDG_DATA_HOME=/usr/ports/math/py-gau2grid/work-py36  XDG_CONFIG_HOME=/usr/ports/math/py-gau2grid/work-py36  HOME=/usr/ports/math/py-gau2grid/work-py36 PATH=/usr/ports/math/py-gau2grid/work-py36/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES LDSHARED="cc -shared" PYTHONDONTWRITEBYTECODE= PYTHONOPTIMIZE= PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe -fno-omit-frame-pointer  -fstack-protector -fno-strict-aliasing "  CPP="cpp" CPPFLAGS="-fno-omit-frame-pointer"  LDFLAGS=" -fstack-protector " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fno-omit-frame-pointer -fstack-protector -fno-strict-aliasing -fno-omit-frame-pointer  "  MANPREFIX="/usr/local" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" /usr/local/bin/python3.6 -c  "import sys; import setuptools;  __file__='setup.py'; sys.argv[0]='setup.py';  exec(compile(open(__file__, 'rb').read().replace(b'\\r\\n', b'\\n'), __file__, 'exec'))" build )
running build
running build_py
creating build
creating build/lib.freebsd-11.2-STABLE-amd64-3.6
creating build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/RSH.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/__init__.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/_version.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/c_generator.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/c_pragma.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/c_util_generator.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/c_wrapper.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/codegen.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/docs_generator.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/extras.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/np_generator.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/order.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/python_reference.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
copying gau2grid/utility.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid
creating build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/tests
copying gau2grid/tests/__init__.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/tests
copying gau2grid/tests/ref_basis.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/tests
copying gau2grid/tests/test_c_code.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/tests
copying gau2grid/tests/test_c_generator.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/tests
copying gau2grid/tests/test_helper.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/tests
copying gau2grid/tests/test_np_generator.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/tests
copying gau2grid/tests/test_order.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/tests
copying gau2grid/tests/test_rsh.py -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/tests
running egg_info
creating gau2grid.egg-info
writing gau2grid.egg-info/PKG-INFO
writing dependency_links to gau2grid.egg-info/dependency_links.txt
writing requirements to gau2grid.egg-info/requires.txt
writing top-level names to gau2grid.egg-info/top_level.txt
writing manifest file 'gau2grid.egg-info/SOURCES.txt'
reading manifest file 'gau2grid.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.npz' under directory 'gau2grid'
writing manifest file 'gau2grid.egg-info/SOURCES.txt'
creating build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/data
copying gau2grid/data/rsh_coeffs.pkl -> build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/data
UPDATING build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/_version.py
set build/lib.freebsd-11.2-STABLE-amd64-3.6/gau2grid/_version.py to '0+unknown'
running build_ext
-- The C compiler identification is Clang 6.0.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Setting option MAX_AM: 6
-- Setting option SPHERICAL_ORDER: gaussian
-- Setting option CARTESIAN_ORDER: row
-- Setting option MAX_AM: 6
-- Setting option CMAKE_BUILD_TYPE: Release
-- Setting option ENABLE_XHOST: ON
-- Performing Test CMAKE_C_FLAGS [-xHost] - Failed
-- Performing Test CMAKE_C_FLAGS [-march=native] - Success, Appending
-- Setting option BUILD_FPIC: ON
-- Setting option BUILD_SHARED_LIBS: ON
-- Setting option ENABLE_GENERIC: OFF
-- Setting (unspecified) option CMAKE_INSTALL_LIBDIR: lib
-- Setting (unspecified) option PYMOD_INSTALL_LIBDIR: /
-- Setting (unspecified) option INSTALL_PYMOD: OFF
-- gau2grid install: /usr/local/gau2grid
-- Found PythonInterp: /usr/local/bin/python3.6 (found suitable version "3.6.7", minimum required is "2.7") 
-- Found PythonLibs: /usr/local/lib/libpython3.6m.so
-- Found Python 3.6: /usr/local/bin/python3.6 (found version 3.6.7)
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/build/temp.freebsd-11.2-STABLE-amd64-3.6
gmake[1]: Entering directory '/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/build/temp.freebsd-11.2-STABLE-amd64-3.6'
gmake[2]: Entering directory '/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/build/temp.freebsd-11.2-STABLE-amd64-3.6'
gmake[3]: Entering directory '/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/build/temp.freebsd-11.2-STABLE-amd64-3.6'
[ 12%] Generating gau2grid.h, gau2grid_orbital.c, gau2grid_phi.c, gau2grid_deriv1.c, gau2grid_deriv2.c, gau2grid_spherical.c, gau2grid_helper.c
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/gau2grid/c_generator.py", line 151, in generate_c_gau2grid
    sig = RSH.transformation_c_generator(gg_spherical, L, cartesian_order, spherical_order, align=ALIGN_SIZE)
  File "/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/gau2grid/RSH.py", line 268, in transformation_c_generator
    RSH_coefs = cart_to_RSH_coeffs(L, order=spherical_order)
  File "/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/gau2grid/RSH.py", line 177, in cart_to_RSH_coeffs
    data = _saved_rsh_coefs[L]
KeyError: 0
gmake[3]: *** [CMakeFiles/gg.dir/build.make:62: gau2grid.h] Error 1
gmake[3]: Leaving directory '/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/build/temp.freebsd-11.2-STABLE-amd64-3.6'
gmake[2]: *** [CMakeFiles/Makefile2:72: CMakeFiles/gg.dir/all] Error 2
gmake[2]: Leaving directory '/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/build/temp.freebsd-11.2-STABLE-amd64-3.6'
gmake[1]: *** [Makefile:130: all] Error 2
gmake[1]: Leaving directory '/usr/ports/math/py-gau2grid/work-py36/gau2grid-1.3.0/build/temp.freebsd-11.2-STABLE-amd64-3.6'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 143, in <module>
    zip_safe=False, )
  File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 143, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.6/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "setup.py", line 33, in run
    self.build_extension(ext)
  File "setup.py", line 60, in build_extension
    subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
  File "/usr/local/lib/python3.6/subprocess.py", line 291, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.
*** Error code 1

Stop.
make: stopped in /usr/ports/math/py-gau2grid

shell returned 1
yurivict commented 5 years ago

There are 2 ports, C and python binding parts. The above message is from the python binding port. The C port also fails:

===>  Building for gau2grid-1.3.0
[1/9] cd /usr/ports/math/gau2grid/work/.build && /usr/local/bin/python2.7 -c "import sys;                                      sys.path.append('/usr/ports/math/gau2grid/work/gau2grid-1.3.0');                                      import gau2grid as gg;                                      gg.c_gen.generate_c_gau2grid(8, path='/usr/ports/math/gau2grid/work/.build', cartesian_order='row', spherical_order='gaussian')"
FAILED: gau2grid.h gau2grid_orbital.c gau2grid_phi.c gau2grid_deriv1.c gau2grid_deriv2.c gau2grid_spherical.c gau2grid_helper.c 
cd /usr/ports/math/gau2grid/work/.build && /usr/local/bin/python2.7 -c "import sys;                                      sys.path.append('/usr/ports/math/gau2grid/work/gau2grid-1.3.0');                                      import gau2grid as gg;                                      gg.c_gen.generate_c_gau2grid(8, path='/usr/ports/math/gau2grid/work/.build', cartesian_order='row', spherical_order='gaussian')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/ports/math/gau2grid/work/gau2grid-1.3.0/gau2grid/c_generator.py", line 151, in generate_c_gau2grid
    sig = RSH.transformation_c_generator(gg_spherical, L, cartesian_order, spherical_order, align=ALIGN_SIZE)
  File "/usr/ports/math/gau2grid/work/gau2grid-1.3.0/gau2grid/RSH.py", line 268, in transformation_c_generator
    RSH_coefs = cart_to_RSH_coeffs(L, order=spherical_order)
  File "/usr/ports/math/gau2grid/work/gau2grid-1.3.0/gau2grid/RSH.py", line 177, in cart_to_RSH_coeffs
    data = _saved_rsh_coefs[L]
KeyError: 0
ninja: build stopped: subcommand failed.
loriab commented 5 years ago

Could BSD be doing or expecting something odd wrt file case, differently from Linux or Mac? Though all the errors I’ve seen have been on L after dev on M, not the other way around. Has g2g ever built successfully on BSD? I’d work on the C port first.

yurivict commented 5 years ago

The previous version, 1.2.0, builds fine on FreeBSD. This is a regression in 1.3.0 in both C/python parts.

dgasmith commented 5 years ago

Could potentially be an issue with the pickle compression level. Now that we use Decimal over mpmath it may be worth considering removing all of the caching code.

dgasmith commented 5 years ago

It does not look like I can reproduce this on any machine that I have. To force this to work you can edit:

gau2grid/RSH.py:169
gen = True if platform.system() == 'Windows' else gen

to gen = True.

To help debug this can you open the file gau2grid/data/rsh_coeffs.pkl with:

import pickle
with open("rsh_coeffs.pkl", "rb") as handle:
    data = pickle.load(handle)

print(data.keys())

and report the results?

It may also be worth running /scripts/rsh_coef_gen.py and seeing the results there as well.

yurivict commented 5 years ago

This PR https://github.com/dgasmith/gau2grid/pull/32 fixes both C and python ports.