liberfa / erfa

Essential Routines for Fundamental Astronomy. Maintainers: @eteq @mhvk @sergiopasra
Other
128 stars 48 forks source link

Windows release binaries #32

Open kbarbary opened 8 years ago

kbarbary commented 8 years ago

Is there any hope of building and distributing Windows shared library binaries along with the source tarballs for each release? This would make it easier to support Windows in ERFA.jl. Ref: JuliaAstro/ERFA.jl#17

timj commented 8 years ago

The C code in ERFA is extremely standards-compliant and should be trivial to build on Windows. It should not need a Unix environment. Someone who knows about windows and has a Microsoft compiler should find it very easy to do. It's more a case of finding a volunteer.

kbarbary commented 8 years ago

You're right. I was able to cross-compile using

i686-w64-mingw32-gcc -Isrc -o liberfa.dll -O3 -shared -static-libgcc src/*.c  # 32-bit
x86_64-w64-mingw32-gcc -Isrc -o liberfa.dll -O3 -shared -static-libgcc src/*.c  # 64-bit

Posted the binaries here for the time being: https://bintray.com/kbarbary/generic/erfa/1.2.0/view/files#files/

It might be nice to make this part of the release process. My autotools skills are not currently up to the task.

mhvk commented 4 years ago

Am going through old issues to see if they are still relevant. Is this one still an issue given that we have pyerfa which (I think??) would come with the binary if one pip-installs it?

laheller commented 1 year ago

Hi @timj @kbarbary @mhvk @mdboom @phn

I was able to build successfully ERFA and tests using only Visual Studio 2022. Did not use any cygwin, mingw or similar environments. Of course I had to slightly modify two header (erfa.h, erfaextra.h) and one source (erfaversion.c) file to build successfully everything.

I have two questions:

  1. Are you interested in adding Visual Studio build and native Windows OS support to this repo? When yes, maybe you can create a new branch here and I can submit a PR to it.
  2. If I am correct, the Linux build takes ERFA version and SOFA version strings from configure.ac file and provides them as variables in the config.h file. Is that correct? On my current Windows build I created this config.h manually, because there is no autotools directly on Windows.

BR,

Ladislav

mhvk commented 1 year ago

@laheller - I thought we had changed/enabled CMake so that things would work under windows too, but I now see the relevant PR, #75, got stalled. Maybe you can have a look whether that would work for you? If so, all the more reason to actually merge this...

laheller commented 1 year ago

@mhvk I would try it but the PR author's repo/branch does not exist anymore...

mhvk commented 1 year ago

Hmm, hadn't realized that! You can still pull the PR with

git fetch upstream pull/75/head:pr-75
git checkout pr-75

(where upstream points to the liberfa/erfa repository)

(Not sure it won't need a rebase, though...)

laheller commented 1 year ago

@mhvk

OK, thanks for hint. Using this PR I was able to create a new Visual Studio solution and build library + tests. Everything works.

One note, that it only creates a static library (.lib file) but skips shared library (.dll file) creation. When I manually set the created project properties to produce shared library, it however creates but the result .dll file has no export symbols. This is due to missing __declspec(dllexport) keyword in header files at the function signatures.

Otherwise no issues.