scottransom / presto

Open source pulsar search and analysis toolkit
http://www.cv.nrao.edu/~sransom/presto/
GNU General Public License v2.0
239 stars 177 forks source link

ERROR: Failed building wheel for pyslalib #187

Open xuhengdada opened 1 year ago

xuhengdada commented 1 year ago

I am trying to install presto on CentOS7 and encounter "ERROR: Failed building wheel for pyslalib" problem, the problem here is basically:

build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/fortranobject.c:707:5: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int i = 0; i < rank; ++i) { ^ build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/fortranobject.c:707:5: note: use option -std=c99 or -std=gnu99 to compile your code build/src.linux-x86_64-3.9/slalibmodule.c:203:12: warning: ‘f2py_size’ defined but not used [-Wunused-function] static int f2py_size(PyArrayObject* var, ...) ^ error: Command "gcc -pthread -B /opt/pulsar_software/miniconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /opt/pulsar_software/miniconda3/include -I/opt/pulsar_software/miniconda3/include -fPIC -O2 -isystem /opt/pulsar_software/miniconda3/include -fPIC -I. -Ibuild/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9 -I/tmp/pip-build-env-ktomdtz8/overlay/lib/python3.9/site-packages/numpy/core/include -Ibuild/src.linux-x86_64-3.9/numpy/distutils/include -I/opt/pulsar_software/miniconda3/include/python3.9 -c build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/fortranobject.c -o build/temp.linux-x86_64-cpython-39/build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/fortranobject.o -MMD -MF build/temp.linux-x86_64-cpython-39/build/src.linux-x86_64-3.9/build/src.linux-x86_64-3.9/fortranobject.o.d -msse -msse2 -msse3" failed with exit status 1

and I tried to install pyslablib by hand, and add -std=gnu99 to CFLAGS in the Makefile of pyslablib, but does not solve that issue.

Any suggestion to solve this issue? Many thanks!

scottransom commented 1 year ago

Hmmm. I can't reproduce this on RHEL7 using python3.7 (which is the most recent that I have access to). I was able to "pip install pyslalib" into a virtual environment with no issues. I notice that you are using miniconda. I wonder if it is related to that? (although note that I am successfully using miniconda to compile pyslalib on a couple other machines)

scottransom commented 1 year ago

It does seem to be related to your C compiler. Are you using gcc? And do you know what version it is? And did you try by adding -std=c99 as well as the gnu99 version? The fact that it compiled fine for me on pure RHEL7 (which is a very old one!) makes it seem like that might not be the actual issue, though.

xuhengdada commented 1 year ago

Yes, I'm using the miniconda, since on the CentOS7, yum could only install python3.6 which is lower than the required version. Here I was using gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), probably the version is too low? I can try to have a gcc with high version then give feedback.

Thank you very much!