theochem / horton

HORTON: Helpful Open-source Research TOol for N-fermion systems
http://theochem.github.io/horton/
GNU General Public License v3.0
92 stars 40 forks source link

GCC error when trying to install horton #288

Open BoringBoron opened 4 years ago

BoringBoron commented 4 years ago

Hello, I'm trying to install horton-2.1.1 on Ubuntu 18.04 running inside the wsl. I've followed the tutorial to the point where I'm trying to run setup.py. The script ends with the following error message:

horton/meanfield/cext.cpp: In function ‘PyObject* __pyx_pf_6horton_9meanfield_4cext_12LibXCWrapper_4refs___get__(__pyx_obj_6horton_9meanfield_4cext_LibXCWrapper*)’:
horton/meanfield/cext.cpp:2209:74: error: cannot convert ‘func_reference_type* const*’ to ‘const char*’ for argument ‘1’ to ‘PyObject* PyString_FromString(const char*)’
   __pyx_t_1 = __Pyx_PyBytes_FromString((__pyx_v_self->_func.info[0]).refs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
                                                                          ^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I've tried updating all the dependencies but still get the same error message.

The whole output from running 'python setup.py install --user':

PLATFORM=Linux-4.4.0-17134-Microsoft-x86_64-with-Ubuntu-18.04-bionic
LIBXC Configuration
   File setup.cfg not found. Skipping.
   From environment variables
      -
   Static lib not found in ${QAWORKDIR}
      extra_objects: ['qaworkdir/cached/libxc-2.2.2/lib/libxc.a']
      include_dirs: ['qaworkdir/cached/libxc-2.2.2/include']
   pkg-config failed.
   Last resort fallback plan
      libraries: ['xc']
   Final
      libraries: ['xc']
LIBINT2 Configuration
   File setup.cfg not found. Skipping.
   From environment variables
      -
   Static lib config in ${QAWORKDIR}
      extra_objects: ['qaworkdir/cached/libint-2.0.3/lib/libint2.a']
      include_dirs: ['qaworkdir/cached/libint-2.0.3/include/libint2']
   Final
      extra_objects: ['qaworkdir/cached/libint-2.0.3/lib/libint2.a']
      include_dirs: ['qaworkdir/cached/libint-2.0.3/include/libint2']
Version of dependencies:
             breathe: -- not found --
            coverage: /bin/sh: 1: coverage: not found
            cppcheck: -- not found --
                curl: curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
              cython: Cython version 0.26.1
            docutils: -- not found --
             doxygen: -- not found --
                 gcc: gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
                 git: git version 2.17.1
           gitpython: -- not found --
                h5py: 2.7.1
          matplotlib: 2.1.1
                nose: nosetests version 1.3.7
               numpy: 1.13.3
                 pip: pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
         pycodestyle: -- not found --
          pydocstyle: -- not found --
              pylint:
              python: Python 2.7.15+
               scipy: 0.19.1
              sphinx: -- not found --
    sphinx_rtd_theme: -- not found --
               sympy: 1.1.1
running install
running build
running build_py
running build_ext
skipping 'horton/cext.cpp' Cython extension (up-to-date)
skipping 'horton/matrix/cext.cpp' Cython extension (up-to-date)
skipping 'horton/gbasis/cext.cpp' Cython extension (up-to-date)
skipping 'horton/grid/cext.cpp' Cython extension (up-to-date)
skipping 'horton/meanfield/cext.cpp' Cython extension (up-to-date)
building 'horton.meanfield.cext' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-_wncS2/python2.7-2.7.15=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I. -I/usr/include/python2.7 -c horton/meanfield/cext.cpp -o build/temp.linux-x86_64-2.7/horton/meanfield/cext.o -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1809:0,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                 from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from horton/meanfield/cext.cpp:499:
/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by " \
  ^~~~~~~
horton/meanfield/cext.cpp: In function ‘PyObject* __pyx_pf_6horton_9meanfield_4cext_12LibXCWrapper_4refs___get__(__pyx_obj_6horton_9meanfield_4cext_LibXCWrapper*)’:
horton/meanfield/cext.cpp:2209:74: error: cannot convert ‘func_reference_type* const*’ to ‘const char*’ for argument ‘1’ to ‘PyObject* PyString_FromString(const char*)’
   __pyx_t_1 = __Pyx_PyBytes_FromString((__pyx_v_self->_func.info[0]).refs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error)
                                                                          ^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Any help is appreciated.

Thanks, BoringBoron

tovrstra commented 4 years ago

Which version of LibXC do you have? Does it match the version specified in the install docs? See http://theochem.github.io/horton/2.1.1/user_download_and_install_linux.html#packaged-dependencies-for-building-installing-and-testing-horton

pfantucci commented 3 years ago

I installed both the libxc 2.2.2 and 5.0.0 without problems but the installation of Horton is stopped with an error identical to the above one. It seems to be not dependent on libxc version. Thanks for any help. Piercarlo.fantucci

FarnazH commented 3 years ago

@pfantucci have you tried installing HORTON using conda? Unless you need to touch the source code, that can be an easy alternative. Use:

conda install -c theochem horton

See: https://anaconda.org/theochem/horton

tovrstra commented 3 years ago

Just in case you still want to install from source: It will not work with libxc 5.0 and the error you get seems to indicate that setup.py tries (and fails) to compiles against the wrong LibXC version. If you want to rule out any confusion, you can build libxc in the HORTON source directory as follows:

./tools/qa/install_libxc-2.2.2.sh

If this compilation of the library is present, it will get priority over anything installed on your system.