cgohlke / imagecodecs

Image transformation, compression, and decompression codecs
https://pypi.org/project/imagecodecs
BSD 3-Clause "New" or "Revised" License
111 stars 21 forks source link

Fix cfitsio include path on mingw #18

Closed kmilos closed 3 years ago

kmilos commented 3 years ago

Still no joy even after that fix:

D:\a\_temp\msys\msys64\mingw64\bin/x86_64-w64-mingw32-gcc.exe -shared -Wl,--enable-auto-image-base -pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -march=x86-64 -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -s build/temp.mingw-3.8/imagecodecs/_rcomp.o build/temp.mingw-3.8/imagecodecs/_rcomp-cpython-38.def -LD:/a/_temp/msys/msys64/mingw64/lib/python3.8/config-3.8 -LD:/a/_temp/msys/msys64/mingw64/lib -lcfitsio -lz -lpython3.8 -lm -lversion -lshlwapi -o build/lib.mingw-3.8/imagecodecs/_rcomp-cpython-38.dll
  D:/a/_temp/msys/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/temp.mingw-3.8/imagecodecs/_rcomp.o:_rcomp.c:(.text+0x14079): undefined reference to `fits_rcomp_short'
  D:/a/_temp/msys/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/temp.mingw-3.8/imagecodecs/_rcomp.o:_rcomp.c:(.text+0x14131): undefined reference to `fits_rcomp_byte'
  D:/a/_temp/msys/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/temp.mingw-3.8/imagecodecs/_rcomp.o:_rcomp.c:(.text+0x14241): undefined reference to `fits_rcomp'
  D:/a/_temp/msys/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/temp.mingw-3.8/imagecodecs/_rcomp.o:_rcomp.c:(.text+0x1857e): undefined reference to `fits_rdecomp'
  D:/a/_temp/msys/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/temp.mingw-3.8/imagecodecs/_rcomp.o:_rcomp.c:(.text+0x18acf): undefined reference to `fits_rdecomp_byte'
  D:/a/_temp/msys/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: build/temp.mingw-3.8/imagecodecs/_rcomp.o:_rcomp.c:(.text+0x18bee): undefined reference to `fits_rdecomp_short'
  collect2.exe: error: ld returned 1 exit status
  error: command 'D:\\a\\_temp\\msys\\msys64\\mingw64\\bin/x86_64-w64-mingw32-gcc.exe' failed with exit status 1

mingw currently ships cfitsio 3.48 which does include these in ricecomp.c, but they are for some reason not exported by the dll, so investigating the build and packaging over there first...

kmilos commented 3 years ago

Ah, none of the symbols in fitsio2.h are marked as exportable/public with CFITS_API...

Is this a bug upstream, or are these really private? If the latter, I guess imagecodecs shouldn't be relying on them? @cgohlke

This'll affect all cfitsio Windows builds, i.e. conda-forge, vcpkg...

cgohlke commented 3 years ago

On Windows, link with the static cfitsio.lib or exclude the rcomp extension.

kmilos commented 3 years ago

Thanks. I think we'll be disabling it on mingw until these become part of the public cfitsio API.

cgohlke commented 3 years ago

v2021.6.8 contains a vendored cfitsio/ricecomp.c file that is compiled with the _rcomp extension on Windows.

kmilos commented 3 years ago

Brilliant, builds ootb now, thanks!