Problem with with building Python extension
Issue #53
new
Hi Nathanael, I'm trying to build the SHTns python extension but there seems to be a problem with the linking of the libraries or something else. I'm using gcc 11.2.0, fftw 3.3.10, python 3.10.4
CC="gcc" python3 setup.py build
/home/-/-/-/-/shtns/setup.py:3: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.core import setup, Extension
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.10
copying shtns.py -> build/lib.linux-x86_64-3.10
running build_ext
building '_shtns' extension
creating build/temp.linux-x86_64-3.10
gcc -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 -I/home/-/.local/lib/python3.10/site-packages/numpy/core/include -I/usr/include/python3.10 -c shtns_numpy_wrap.c -o build/temp.linux-x86_64-3.10/shtns_numpy_wrap.o -std=c99 -fopenmp -DSHTNS_VER="3.5.1"
shtns_numpy_wrap.c: In function ‘shtns_info___ct’:
shtns_numpy_wrap.c:3146:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Wsign-compare]
3146 | for (i=0; i<self->nlat; i++) ct[i] = self->ct[i]; // copy
| ^
shtns_numpy_wrap.c: In function ‘shtns_info_idx’:
shtns_numpy_wrap.c:3183:36: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
3183 | if ( (m > l) || (m > self->mmax * self->mres) || (m % self->mres != 0) ) {
| ^
In file included from shtns_numpy_wrap.c:2713:
At top level:
sht_private.h:743:13: warning: ‘zero_mem’ defined but not used [-Wunused-function]
743 | static void zero_mem(v2d* F0, long n) {
| ^~~~~~~~
sht_private.h:735:13: warning: ‘zero_poles2_vect’ defined but not used [-Wunused-function]
735 | static void zero_poles2_vect(v2d* F0, long ofsm, long n) {
| ^~~~~~~~~~~~~~~~
sht_private.h:725:13: warning: ‘zero_poles4_vect’ defined but not used [-Wunused-function]
725 | static void zero_poles4_vect(v2d* F0, long ofsm, long ofs1, long n) {
| ^~~~~~~~~~~~~~~~
sht_private.h:698:13: warning: ‘SHtor_to_2scal’ defined but not used [-Wunused-function]
698 | static void SHtor_to_2scal(const double *mx, int llim, int m, cplx* Tl, cplx* VWl)
| ^~~~~~~~~~~~~~
sht_private.h:671:13: warning: ‘SHsph_to_2scal’ defined but not used [-Wunused-function]
671 | static void SHsph_to_2scal(const double *mx, int llim, int m, cplx* Sl, cplx* VWl)
| ^~~~~~~~~~~~~~
sht_private.h:586:13: warning: ‘SH_vect_to_2scal_alt’ defined but not used [-Wunused-function]
586 | static void SH_vect_to_2scal_alt(const double *mx, int llim, int m, const cplx* Sl, const cplx* Tl, cplx* VWl)
| ^~~~~~~~~~~~~~~~~~~~
sht_private.h:534:13: warning: ‘SH_vect_to_2scal’ defined but not used [-Wunused-function]
534 | static void SH_vect_to_2scal(const double *mx, int llim, int m, cplx* Sl, cplx* Tl, cplx* VWl)
| ^~~~~~~~~~~~~~~~
sht_private.h:487:13: warning: ‘SH2_to_ishioka’ defined but not used [-Wunused-function]
487 | static void SH2_to_ishioka(const double* xlm, v2d* VWl, const int llim_m)
| ^~~~~~~~~~~~~~
sht_private.h:442:13: warning: ‘SH_to_ishioka’ defined but not used [-Wunused-function]
442 | static void SH_to_ishioka(const double* xlm, const v2d* Ql, const int llim_m, v2d* ql)
| ^~~~~~~~~~~~~
sht_private.h:394:13: warning: ‘ishioka_to_SH2’ defined but not used [-Wunused-function]
394 | static void ishioka_to_SH2(const double* xlm, const v2d* vw, const int llim_m, v2d* VWl)
| ^~~~~~~~~~~~~~
sht_private.h:345:13: warning: ‘ishioka_to_SH’ defined but not used [-Wunused-function]
345 | static void ishioka_to_SH(const double* xlm, const v2d* qq, const int llim_m, v2d* Ql)
| ^~~~~~~~~~~~~
sht_private.h:296:13: warning: ‘SH_2scal_to_vect’ defined but not used [-Wunused-function]
296 | static void SH_2scal_to_vect(const double *mx, const double* l_2, int llim, int m, v2d* vw, v2d* Sl, v2d* Tl)
| ^~~~~~~~~~~~~~~~
sht_private.h:268:13: warning: ‘SH_2scal_to_vect_reduce’ defined but not used [-Wunused-function]
268 | static void SH_2scal_to_vect_reduce(const double *mx, const double* l_2, int llim, int m, rnd* vw, v2d* Sl, v2d* Tl)
| ^~~~~~~~~~~~~~~~~~~~~~~
x86_64-linux-gnu-gcc -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -g -fwrapv -O2 -Wl,-Bsymbolic-functions -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.10/shtns_numpy_wrap.o sht_init.o sht_kernels_a.o sht_kernels_s.o sht_odd_nlat.o sht_fly.o sht_omp.o -L/usr/local/lib -lfftw3_omp -lfftw3 -lm -o build/lib.linux-x86_64-3.10/_shtns.cpython-310-x86_64-linux-gnu.so
/usr/bin/ld: /usr/local/lib/libfftw3.a(lt7-conf.o): warning: relocation against `fftw_solvtab_rdft_r2cf' in read-only section `.text'
/usr/bin/ld: /usr/local/lib/libfftw3_omp.a(libfftw3_omp_la-api.o): relocation R_X86_64_PC32 against symbol `fftw_mksolver_ct_hook' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
make: *** [Makefile:116: _shtns.so] Fehler 1
Maybe you know already this kind of error but I'm not sure how to interpret this.
Cheers, Patrick
Comments (2)
-
repo owner -
Hi Nathanael,
sorry for the late response. I actually used
--enable-python
. However, since the installation worked on my other machine, I found out it was just a problem with the fftw library. I did not install it with the--enable-shared
option.Cheers,
Patrick
- Log in to comment
Hello Patrick, You must first configure with
--enable-python