Skip to content

pip compilation issues #131

@jeremyagray

Description

@jeremyagray

I keep having a multiple definition error of several functions when using sundials with lapack and pycvodes trying to use headers in anyode. I created a branch to illustrate how I finally got it to compile and install (no errors/warnings) by passing in the appropriate enviroment variable (PYCVODES_USE_LAPACK='1'), but I wonder if there is a problem elsewhere with one of the libraries or something else. I didn't dive deeply enough into the source to see if this turned off all lapack use, but the tests in pycvodes/tests passed. I was intending to work on or at least document pip installation of chempy and got hung on pycvodes.

Hopefully all the relevant setup details are below; errors follow.

versions (current debian/bullseye):

  • gcc/g++/gfortran 10.2.0 (deb)
  • sundials 5.4.0 (source)
  • cmake 3.18.4-1 (deb)
  • libblas-dev 3.9.0-3 (deb)
  • liblapack-dev 3.9.0-3 (deb)
  • libboost-dev 1.71.0.3 (deb)
  • libgsl-dev 2.6+dfsg-2 (deb)
  • libsuitesparse-dev 1:5.8.1+dfsg-2 (deb)
  • Python 3.8.6 (deb)

requirements.txt:

  • apipkg==1.5
  • attrs==20.2.0
  • Cython==0.29.21
  • execnet==1.7.1
  • iniconfig==1.1.1
  • numpy==1.19.3
  • packaging==20.4
  • pep8==1.7.1
  • pluggy==0.13.1
  • py==1.9.0
  • pyflakes==2.2.0
  • pyparsing==2.4.7
  • pytest==6.1.2
  • pytest-cache==1.0
  • pytest-flakes==4.0.2
  • pytest-pep8==1.0.6
  • six==1.15.0
  • toml==0.10.1

Build Errors:
python setup.py bdist_wheel

Compiling pycvodes/_cvodes.pyx because it changed.
[1/1] Cythonizing pycvodes/_cvodes.pyx
running bdist_wheel
running build
running build_py
running egg_info
writing pycvodes.egg-info/PKG-INFO
writing dependency_links to pycvodes.egg-info/dependency_links.txt
writing requirements to pycvodes.egg-info/requires.txt
writing top-level names to pycvodes.egg-info/top_level.txt
reading manifest file 'pycvodes.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pycvodes.egg-info/SOURCES.txt'
copying pycvodes/_cvodes.cpp -> build/lib.linux-x86_64-3.8/pycvodes
running build_ext
building 'pycvodes._cvodes' extension
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYCVODES_NO_KLU=0 -DPYCVODES_NO_LAPACK=0 -DANYODE_NO_LAPACK=0 -I/home/gray/.virtualenvs/pycvodes/lib/python3.8/site-packages/numpy/core/include -Ipycvodes/include -Iexternal/anyode/include -I/home/gray/.virtualenvs/pycvodes/include -I/usr/include/python3.8 -c pycvodes/_cvodes.cpp -o build/temp.linux-x86_64-3.8/pycvodes/_cvodes.o -DVERSION_INFO="0.13.1" --std=c++11
In file included from /home/gray/.virtualenvs/pycvodes/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822,
                 from /home/gray/.virtualenvs/pycvodes/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                 from /home/gray/.virtualenvs/pycvodes/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from pycvodes/_cvodes.cpp:667:
/home/gray/.virtualenvs/pycvodes/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
   17 | #warning "Using deprecated NumPy API, disable it with " \
      |  ^~~~~~~
In file included from pycvodes/include/sundials_cxx.hpp:4,
                 from pycvodes/include/cvodes_cxx.hpp:37,
                 from pycvodes/_cvodes.cpp:669:
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:38:43: error: conflicting declaration of C function ‘void dgemv_(const char*, sunindextype*, sunindextype*, const double*, const double*, sunindextype*, const double*, sunindextype*, const double*, double*, sunindextype*)’
   38 | #define dgemv_f77       SUNDIALS_F77_FUNC(dgemv, DGEMV)
      |                                           ^~~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:38:25: note: in expansion of macro ‘SUNDIALS_F77_FUNC’
   38 | #define dgemv_f77       SUNDIALS_F77_FUNC(dgemv, DGEMV)
      |                         ^~~~~~~~~~~~~~~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:122:13: note: in expansion of macro ‘dgemv_f77’
  122 | extern void dgemv_f77(const char *trans, sunindextype *m, sunindextype *n,
      |             ^~~~~~~~~
In file included from external/anyode/include/anyode/anyode_matrix.hpp:14,
                 from external/anyode/include/anyode/anyode_iterative.hpp:7,
                 from external/anyode/include/anyode/anyode_numpy.hpp:5,
                 from pycvodes/_cvodes.cpp:668:
external/anyode/include/anyode/anyode_blas_lapack.hpp:2:17: note: previous declaration ‘void dgemv_(const char*, int*, int*, const double*, const double*, int*, const double*, int*, const double*, double*, int*)’
    2 | extern "C" void dgemv_(const char* trans, int* m, int* n, const double* alpha, const double* a, int* lda,
      |                 ^~~~~~
In file included from pycvodes/include/sundials_cxx.hpp:4,
                 from pycvodes/include/cvodes_cxx.hpp:37,
                 from pycvodes/_cvodes.cpp:669:
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:54:43: error: conflicting declaration of C function ‘void sgemv_(const char*, sunindextype*, sunindextype*, const float*, const float*, sunindextype*, const float*, sunindextype*, const float*, float*, sunindextype*)’
   54 | #define sgemv_f77       SUNDIALS_F77_FUNC(sgemv, SGEMV)
      |                                           ^~~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_config.h:38:38: note: in definition of macro ‘SUNDIALS_F77_FUNC’
   38 | #define SUNDIALS_F77_FUNC(name,NAME) name ## _
      |                                      ^~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:132:13: note: in expansion of macro ‘sgemv_f77’
  132 | extern void sgemv_f77(const char *trans, sunindextype *m, sunindextype *n,
      |             ^~~~~~~~~
In file included from external/anyode/include/anyode/anyode_matrix.hpp:14,
                 from external/anyode/include/anyode/anyode_iterative.hpp:7,
                 from external/anyode/include/anyode/anyode_numpy.hpp:5,
                 from pycvodes/_cvodes.cpp:668:
external/anyode/include/anyode/anyode_blas_lapack.hpp:4:17: note: previous declaration ‘void sgemv_(const char*, int*, int*, const float*, const float*, int*, const float*, int*, const float*, float*, int*)’
    4 | extern "C" void sgemv_(const char* trans, int* m, int* n, const float* alpha, const float* a, int* lda,
      |                 ^~~~~~
In file included from pycvodes/include/sundials_cxx.hpp:4,
                 from pycvodes/include/cvodes_cxx.hpp:37,
                 from pycvodes/_cvodes.cpp:669:
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:42:43: error: conflicting declaration of C function ‘void dgbtrf_(const sunindextype*, const sunindextype*, const sunindextype*, const sunindextype*, double*, sunindextype*, sunindextype*, sunindextype*)’
   42 | #define dgbtrf_f77      SUNDIALS_F77_FUNC(dgbtrf, DGBTRF)
      |                                           ^~~~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_config.h:38:38: note: in definition of macro ‘SUNDIALS_F77_FUNC’
   38 | #define SUNDIALS_F77_FUNC(name,NAME) name ## _
      |                                      ^~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:158:13: note: in expansion of macro ‘dgbtrf_f77’
  158 | extern void dgbtrf_f77(const sunindextype *m, const sunindextype *n,
      |             ^~~~~~~~~~
In file included from external/anyode/include/anyode/anyode_matrix.hpp:14,
                 from external/anyode/include/anyode/anyode_iterative.hpp:7,
                 from external/anyode/include/anyode/anyode_numpy.hpp:5,
                 from pycvodes/_cvodes.cpp:668:
external/anyode/include/anyode/anyode_blas_lapack.hpp:25:17: note: previous declaration ‘void dgbtrf_(const int*, const int*, const int*, const int*, double*, int*, int*, int*)’
   25 | extern "C" void dgbtrf_(const int* dim1, const int* dim2, const int* kl, const int* ku, double* a, int* lda, int* ipiv, int* info);
      |                 ^~~~~~~
In file included from pycvodes/include/sundials_cxx.hpp:4,
                 from pycvodes/include/cvodes_cxx.hpp:37,
                 from pycvodes/_cvodes.cpp:669:
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:43:43: error: conflicting declaration of C function ‘void dgbtrs_(const char*, const sunindextype*, const sunindextype*, const sunindextype*, const sunindextype*, double*, const sunindextype*, sunindextype*, double*, const sunindextype*, sunindextype*)’
   43 | #define dgbtrs_f77      SUNDIALS_F77_FUNC(dgbtrs, DGBTRS)
      |                                           ^~~~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_config.h:38:38: note: in definition of macro ‘SUNDIALS_F77_FUNC’
   38 | #define SUNDIALS_F77_FUNC(name,NAME) name ## _
      |                                      ^~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:163:13: note: in expansion of macro ‘dgbtrs_f77’
  163 | extern void dgbtrs_f77(const char *trans, const sunindextype *n,
      |             ^~~~~~~~~~
In file included from external/anyode/include/anyode/anyode_matrix.hpp:14,
                 from external/anyode/include/anyode/anyode_iterative.hpp:7,
                 from external/anyode/include/anyode/anyode_numpy.hpp:5,
                 from pycvodes/_cvodes.cpp:668:
external/anyode/include/anyode/anyode_blas_lapack.hpp:28:17: note: previous declaration ‘void dgbtrs_(const char*, const int*, const int*, const int*, const int*, double*, const int*, int*, double*, const int*, int*)’
   28 | extern "C" void dgbtrs_(const char* trans, const int* n, const int* kl, const int* ku, const int* nrhs, double* a,
      |                 ^~~~~~~
In file included from pycvodes/include/sundials_cxx.hpp:4,
                 from pycvodes/include/cvodes_cxx.hpp:37,
                 from pycvodes/_cvodes.cpp:669:
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:44:43: error: conflicting declaration of C function ‘void dgetrf_(const sunindextype*, const sunindextype*, double*, sunindextype*, sunindextype*, sunindextype*)’
   44 | #define dgetrf_f77      SUNDIALS_F77_FUNC(dgetrf, DGETRF)
      |                                           ^~~~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_config.h:38:38: note: in definition of macro ‘SUNDIALS_F77_FUNC’
   38 | #define SUNDIALS_F77_FUNC(name,NAME) name ## _
      |                                      ^~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:179:13: note: in expansion of macro ‘dgetrf_f77’
  179 | extern void dgetrf_f77(const sunindextype *m, const sunindextype *n, double *a,
      |             ^~~~~~~~~~
In file included from external/anyode/include/anyode/anyode_matrix.hpp:14,
                 from external/anyode/include/anyode/anyode_iterative.hpp:7,
                 from external/anyode/include/anyode/anyode_numpy.hpp:5,
                 from pycvodes/_cvodes.cpp:668:
external/anyode/include/anyode/anyode_blas_lapack.hpp:14:17: note: previous declaration ‘void dgetrf_(const int*, const int*, double*, int*, int*, int*)’
   14 | extern "C" void dgetrf_(const int* dim1, const int* dim2, double* a, int* lda, int* ipiv, int* info);
      |                 ^~~~~~~
In file included from pycvodes/include/sundials_cxx.hpp:4,
                 from pycvodes/include/cvodes_cxx.hpp:37,
                 from pycvodes/_cvodes.cpp:669:
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:45:43: error: conflicting declaration of C function ‘void dgetrs_(const char*, const sunindextype*, const sunindextype*, double*, const sunindextype*, sunindextype*, double*, const sunindextype*, sunindextype*)’
   45 | #define dgetrs_f77      SUNDIALS_F77_FUNC(dgetrs, DGETRS)
      |                                           ^~~~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_config.h:38:38: note: in definition of macro ‘SUNDIALS_F77_FUNC’
   38 | #define SUNDIALS_F77_FUNC(name,NAME) name ## _
      |                                      ^~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:183:13: note: in expansion of macro ‘dgetrs_f77’
  183 | extern void dgetrs_f77(const char *trans, const sunindextype *n,
      |             ^~~~~~~~~~
In file included from external/anyode/include/anyode/anyode_matrix.hpp:14,
                 from external/anyode/include/anyode/anyode_iterative.hpp:7,
                 from external/anyode/include/anyode/anyode_numpy.hpp:5,
                 from pycvodes/_cvodes.cpp:668:
external/anyode/include/anyode/anyode_blas_lapack.hpp:17:17: note: previous declaration ‘void dgetrs_(const char*, const int*, const int*, double*, const int*, int*, double*, const int*, int*)’
   17 | extern "C" void dgetrs_(const char* trans, const int* n, const int* nrhs, double* a, const int* lda, int* ipiv, double * b, const int* ldb, int* info);
      |                 ^~~~~~~
In file included from pycvodes/include/sundials_cxx.hpp:4,
                 from pycvodes/include/cvodes_cxx.hpp:37,
                 from pycvodes/_cvodes.cpp:669:
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:58:43: error: conflicting declaration of C function ‘void sgbtrf_(const sunindextype*, const sunindextype*, const sunindextype*, const sunindextype*, float*, sunindextype*, sunindextype*, sunindextype*)’
   58 | #define sgbtrf_f77      SUNDIALS_F77_FUNC(sgbtrf, SGBTRF)
      |                                           ^~~~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_config.h:38:38: note: in definition of macro ‘SUNDIALS_F77_FUNC’
   38 | #define SUNDIALS_F77_FUNC(name,NAME) name ## _
      |                                      ^~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:205:13: note: in expansion of macro ‘sgbtrf_f77’
  205 | extern void sgbtrf_f77(const sunindextype *m, const sunindextype *n,
      |             ^~~~~~~~~~
In file included from external/anyode/include/anyode/anyode_matrix.hpp:14,
                 from external/anyode/include/anyode/anyode_iterative.hpp:7,
                 from external/anyode/include/anyode/anyode_numpy.hpp:5,
                 from pycvodes/_cvodes.cpp:668:
external/anyode/include/anyode/anyode_blas_lapack.hpp:26:17: note: previous declaration ‘void sgbtrf_(const int*, const int*, const int*, const int*, float*, int*, int*, int*)’
   26 | extern "C" void sgbtrf_(const int* dim1, const int* dim2, const int* kl, const int* ku, float* a, int* lda, int* ipiv, int* info);
      |                 ^~~~~~~
In file included from pycvodes/include/sundials_cxx.hpp:4,
                 from pycvodes/include/cvodes_cxx.hpp:37,
                 from pycvodes/_cvodes.cpp:669:
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:59:43: error: conflicting declaration of C function ‘void sgbtrs_(const char*, const sunindextype*, const sunindextype*, const sunindextype*, const sunindextype*, float*, const sunindextype*, sunindextype*, float*, const sunindextype*, sunindextype*)’
   59 | #define sgbtrs_f77      SUNDIALS_F77_FUNC(sgbtrs, SGBTRS)
      |                                           ^~~~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_config.h:38:38: note: in definition of macro ‘SUNDIALS_F77_FUNC’
   38 | #define SUNDIALS_F77_FUNC(name,NAME) name ## _
      |                                      ^~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:210:13: note: in expansion of macro ‘sgbtrs_f77’
  210 | extern void sgbtrs_f77(const char *trans, const sunindextype *n,
      |             ^~~~~~~~~~
In file included from external/anyode/include/anyode/anyode_matrix.hpp:14,
                 from external/anyode/include/anyode/anyode_iterative.hpp:7,
                 from external/anyode/include/anyode/anyode_numpy.hpp:5,
                 from pycvodes/_cvodes.cpp:668:
external/anyode/include/anyode/anyode_blas_lapack.hpp:30:17: note: previous declaration ‘void sgbtrs_(const char*, const int*, const int*, const int*, const int*, float*, const int*, int*, float*, const int*, int*)’
   30 | extern "C" void sgbtrs_(const char* trans, const int* n, const int* kl, const int* ku, const int* nrhs, float* a,
      |                 ^~~~~~~
In file included from pycvodes/include/sundials_cxx.hpp:4,
                 from pycvodes/include/cvodes_cxx.hpp:37,
                 from pycvodes/_cvodes.cpp:669:
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:60:43: error: conflicting declaration of C function ‘void sgetrf_(const sunindextype*, const sunindextype*, float*, sunindextype*, sunindextype*, sunindextype*)’
   60 | #define sgetrf_f77      SUNDIALS_F77_FUNC(sgetrf, SGETRF)
      |                                           ^~~~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_config.h:38:38: note: in definition of macro ‘SUNDIALS_F77_FUNC’
   38 | #define SUNDIALS_F77_FUNC(name,NAME) name ## _
      |                                      ^~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:226:13: note: in expansion of macro ‘sgetrf_f77’
  226 | extern void sgetrf_f77(const sunindextype *m, const sunindextype *n, float *a,
      |             ^~~~~~~~~~
In file included from external/anyode/include/anyode/anyode_matrix.hpp:14,
                 from external/anyode/include/anyode/anyode_iterative.hpp:7,
                 from external/anyode/include/anyode/anyode_numpy.hpp:5,
                 from pycvodes/_cvodes.cpp:668:
external/anyode/include/anyode/anyode_blas_lapack.hpp:15:17: note: previous declaration ‘void sgetrf_(const int*, const int*, float*, int*, int*, int*)’
   15 | extern "C" void sgetrf_(const int* dim1, const int* dim2, float* a, int* lda, int* ipiv, int* info);
      |                 ^~~~~~~
In file included from pycvodes/include/sundials_cxx.hpp:4,
                 from pycvodes/include/cvodes_cxx.hpp:37,
                 from pycvodes/_cvodes.cpp:669:
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:61:43: error: conflicting declaration of C function ‘void sgetrs_(const char*, const sunindextype*, const sunindextype*, float*, const sunindextype*, sunindextype*, float*, const sunindextype*, sunindextype*)’
   61 | #define sgetrs_f77      SUNDIALS_F77_FUNC(sgetrs, SGETRS)
      |                                           ^~~~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_config.h:38:38: note: in definition of macro ‘SUNDIALS_F77_FUNC’
   38 | #define SUNDIALS_F77_FUNC(name,NAME) name ## _
      |                                      ^~~~
/home/gray/.virtualenvs/chempy/include/sundials/sundials_lapack.h:230:13: note: in expansion of macro ‘sgetrs_f77’
  230 | extern void sgetrs_f77(const char *trans, const sunindextype *n,
      |             ^~~~~~~~~~
In file included from external/anyode/include/anyode/anyode_matrix.hpp:14,
                 from external/anyode/include/anyode/anyode_iterative.hpp:7,
                 from external/anyode/include/anyode/anyode_numpy.hpp:5,
                 from pycvodes/_cvodes.cpp:668:
external/anyode/include/anyode/anyode_blas_lapack.hpp:18:17: note: previous declaration ‘void sgetrs_(const char*, const int*, const int*, float*, const int*, int*, float*, const int*, int*)’
   18 | extern "C" void sgetrs_(const char* trans, const int* n, const int* nrhs, float* a, const int* lda, int* ipiv, float * b, const int* ldb, int* info);
      |                 ^~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions