esheldon/fitsio

Bug when installing fitsio in one of the new Apple M2 Max

jpratmarti opened this issue · 18 comments

Hi,

I am trying to install fitsio in one of the new Apple M2 Max and I'm getting the following message. Is this a problem on my end or should the code be updated in order to be compatible with ISO C99? (see error message below)

Thanks a lot for your help!
Judit

^ fitsio/fitsio_pywrap.c:4679:10: error: call to undeclared function 'fits_use_standard_strings'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] if ( fits_use_standard_strings() ) { ^ 1 warning and 1 error generated. error: command '/usr/bin/clang' failed with exit code 1

Any of the devs have this type of system?

It seems like the compiler stack which may mean we only need the same os version.

What version of osx are you using Judit?

I'm using Ventura 13.3.1 (a)

Sorry for the delay here. I am on 13.4.1 (c) and do not see this error. Did it print out where that call is? I bet we can put the function in a header and make the compiler happier.

Thanks for checking! I tried again to install fitsio with pip and get this below. Please let me know if it'd be useful that I copy a larger part of the output.

.49.dylib buffers.o cfileio.o checksum.o drvrfile.o drvrmem.o drvrnet.o drvrsmem.o editcol.o edithdu.o eval_l.o eval_y.o eval_f.o fitscore.o getcol.o getcolb.o getcold.o getcole.o getcoli.o getcolj.o getcolk.o getcoll.o getcols.o getcolsb.o getcoluk.o getcolui.o getcoluj.o getkey.o group.o grparser.o histo.o iraffits.o modkey.o putcol.o putcolb.o putcold.o putcole.o putcoli.o putcolj.o putcolk.o putcoluk.o putcoll.o putcols.o putcolsb.o putcolu.o putcolui.o putcoluj.o putkey.o region.o scalnull.o swapproc.o wcssub.o wcsutil.o imcompress.o quantize.o ricecomp.o pliocomp.o fits_hcompress.o fits_hdecompress.o simplerng.o zlib/adler32.o zlib/crc32.o zlib/deflate.o zlib/infback.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o zlib/uncompr.o zlib/zcompress.o zlib/zuncompress.o zlib/zutil.o f77_wrap1.o f77_wrap2.o f77_wrap3.o f77_wrap4.o -lm -Wl,-rpath,/opt/anaconda3/lib -L/opt/anaconda3/lib -lcurl -lbz2
      building 'fitsio._fitsio_wrap' extension
      creating build/temp.macosx-10.9-x86_64-cpython-39/fitsio
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/anaconda3/include -arch x86_64 -I/opt/anaconda3/include -fPIC -O2 -isystem /opt/anaconda3/include -arch x86_64 -I/opt/homebrew/include -I/opt/anaconda3/lib/python3.9/site-packages/numpy/core/include -Ibuild/temp.macosx-10.9-x86_64-cpython-39/cfitsio3490 -I/opt/anaconda3/include/python3.9 -c fitsio/fitsio_pywrap.c -o build/temp.macosx-10.9-x86_64-cpython-39/fitsio/fitsio_pywrap.o
      In file included from fitsio/fitsio_pywrap.c:28:
      In file included from /opt/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:5:
      In file included from /opt/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
      In file included from /opt/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940:
      /opt/anaconda3/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with "          "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
      #warning "Using deprecated NumPy API, disable it with " \
       ^
      fitsio/fitsio_pywrap.c:4678:10: error: call to undeclared function 'fits_use_standard_strings'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          if ( fits_use_standard_strings() ) {
               ^
      1 warning and 1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fitsio
  Running setup.py clean for fitsio
Failed to build fitsio
ERROR: Could not build wheels for fitsio, which is required to install pyproject.toml-based projects

@esheldon I think if we add an additional patch to declare this function in a header file, it should fix things.

I'll give that a go in a PR.

@jpratmarti Can you send me the full output of the pip install with the flags -vv added?

Sure, I just sent it to you via email!

Can you send me any env vars you have defined that effect compilation?

In particular, what is in this directory, -I/opt/homebrew/include?

Sure:

ls /opt/homebrew/include
ares.h			drvrsmem.h		healpix_cxx		lz4frame_static.h	png.h			uv
ares_build.h		eigen3			jconfig.h		lz4hc.h			pngconf.h		uv.h
ares_dns.h		fitsio.h		jerror.h		lzma			pnglibconf.h		webp
ares_nameser.h		fitsio2.h		jmorecfg.h		lzma.h			textstyle		zdict.h
ares_rules.h		freetype2		jpeglib.h		mpdecimal.h		textstyle.h		zstd.h
ares_version.h		gettext-po.h		libintl.h		mpf2mpfr.h		tiff.h			zstd_errors.h
autosprintf.h		gif_lib.h		libpng16		mpfr.h			tiffconf.h
boost			gio-unix-2.0		libsharp		nghttp2			tiffio.h
brotli			glib-2.0		longnam.h		node			tiffio.hxx
chealpix.h		gmp.h			lz4.h			pcre2.h			tiffvers.h
decimal.hh		gmpxx.h			lz4frame.h		pcre2posix.h		turbojpeg.h

Not sure how I know how to find the other env vars, let me know if you need anything else!

Yeah ok. Try uninstalling fitsio from homebrew.

and uninstall cfitsio from any conda environments

Also run this command at the CLI env | grep INCLUDE and send what it spits out. Are you setting paths to extra include dirs in your shell config files?

@jpratmarti, try the version on the main branch. With pip, you can execute

pip install git+https://github.com/esheldon/fitsio

Oh thanks! Sorry last week I stopped having time to look at this and then forgot. I just tried your new command and it has worked! Thanks a lot Matt!

Great! Can you send me the output with -vv? I want to double check things.

Closing this! Thank you!