fitsio icon indicating copy to clipboard operation
fitsio copied to clipboard

Added fixes for compiling with mingw under windows 8

Open MarkusPfundstein opened this issue 11 years ago • 5 comments

Hey guys,

I had to compile the library for windows and found two problems. First mingw must link to libgcc.a as otherwise the linker can't resolve two symbols. I added this to setup.py:

if platform.system()=='Darwin': extra_compile_args=['-arch','i386','-arch','x86_64'] extra_link_args=['-arch','i386','-arch','x86_64'] else: extra_compile_args=[] extra_link_args=['C:\MinGW\lib\gcc\mingw32\4.8.1\libgcc.a', ''] # HACK TO GET IT COMPILE ON MINGW

Second, in drvrfile.c

ifdef HAVE_FTRUNCATE

if defined(unix) || defined(unix) || defined(__unix)

include unistd.h /* needed for getcwd prototype on unix machines */

endif

endif

won't include _ftruncate under windows. i fixed it by removing all the preprocessor statements so that unistd.h will be included under mingw

hope that helps

MarkusPfundstein avatar Jan 14 '14 23:01 MarkusPfundstein

Thank you, this is a good start.

To make it more generic, we should add the check for platform.system() explicitly. What does that function give you?

We should also think of a more generic solution to the _ftruncate. I don't have windows to test though. Do you know what should be define should be checked for on your system?

esheldon avatar Jan 15 '14 00:01 esheldon

Hi esheldon,

it was my first time building a python library so I just "hacked" the changes into it.

if platform.system()=='Darwin': extra_compile_args=['-arch','i386','-arch','x86_64'] extra_link_args=['-arch','i386','-arch','x86_64'] elif platform.system() == "Windows": extra_compile_args=[] extra_link_args=['C:\MinGW\lib\gcc\mingw32\4.8.1\libgcc.a', ''] else: extra_compile_args=[] extra_link_args=[]

This work for me now. But the problem is that the user MUST have installed MinGW to C:\MinGW. Maybe we should add a command line switch to enable the user to specify where precisely MinGW is located.

MarkusPfundstein avatar Jan 15 '14 09:01 MarkusPfundstein

Hi Markus -

Any progress on making this more general? I can't test as I'm without windows.

thanks

esheldon avatar Mar 20 '14 21:03 esheldon

Still need more eyes on the windows front (I have no windows).

esheldon avatar Oct 23 '15 14:10 esheldon

We still have no windows core developers, but are always glad for any help

esheldon avatar Nov 12 '20 14:11 esheldon