yt-project / yt_astro_analysis

yt astrophysical analysis modules
Other
22 stars 21 forks source link

Fix compilation issue #258

Closed cphyc closed 2 months ago

cphyc commented 2 months ago

Somehow merging #255 broke compilation. This fixes the compilation issue:

$ python -m pip install -e -v .
[...]
gcc-9 -fno-strict-overflow -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/cphyc/miniforge3/envs/py312/include -fPIC -O2 -isystem /home/cphyc/miniforge3/envs/py312/include -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -DNPY_TARGET_VERSION=NPY_1_19_API_VERSION -I/home/cphyc/miniforge3/envs/py312/include/python3.12 -I/home/cphyc/miniforge3/envs/py312/lib/python3.12/site-packages/numpy/_core/include -c yt_astro_analysis/halo_analysis/halo_finding/hop/hop_hop.c -o build/temp.linux-x86_64-cpython-312/yt_astro_analysis/halo_analysis/halo_finding/hop/hop_hop.o
In file included from /home/cphyc/miniforge3/envs/py312/lib/python3.12/site-packages/numpy/_core/include/numpy/npy_common.h:380,
                 from /home/cphyc/miniforge3/envs/py312/lib/python3.12/site-packages/numpy/_core/include/numpy/ndarraytypes.h:4,
                 from /home/cphyc/miniforge3/envs/py312/lib/python3.12/site-packages/numpy/_core/include/numpy/ndarrayobject.h:12,
                 from yt_astro_analysis/halo_analysis/halo_finding/hop/kd.h:22,
                 from yt_astro_analysis/halo_analysis/halo_finding/hop/hop_hop.c:25:
yt_astro_analysis/halo_analysis/halo_finding/hop/hop_hop.c: In function ‘ssort’:
yt_astro_analysis/halo_analysis/halo_finding/hop/hop_hop.c:683:18: error: expected identifier or ‘(’ before ‘__extension__’
  683 |     int TTY, TY, I, IJ, J, K, KK, L, M, NN;
      |                  ^
yt_astro_analysis/halo_analysis/halo_finding/hop/hop_hop.c:690:7: error: ‘NN’ undeclared (first use in this function); did you mean ‘N’?
  690 |       NN = N;
      |       ^~
      |       N
yt_astro_analysis/halo_analysis/halo_finding/hop/hop_hop.c:690:7: note: each undeclared identifier is reported only once for each function it appears in
yt_astro_analysis/halo_analysis/halo_finding/hop/hop_hop.c:696:7: error: ‘KK’ undeclared (first use in this function); did you mean ‘KD’?
  696 |       KK = abs(KFLAG);

This seems to be due to a conflict with the variable "I". The fix (?!) is simply to put it in lower case.