-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetCDF 4.9.0: undefined reference to `ncp_win32_api' on MinGW (libncpoco) #2396
Comments
Maybe
(the compilation succeeds with this option) |
It looks like the file libncpoco/cp_win32.c is not being compiled. |
Indeed, this file is not compiled:
Maybe the build system is confused since we do a cross-compiliation (as |
Ok, the problem is probably the conditional code in libncpoco/Makefile.am.
Btw, the value of ISMSVC and ISMINGW comes from this code in configure.ac
For some reason, this is not working. Does anything stand out to you? |
I believe you are correct that the cross compile is the problem. Not sure how to |
Inside the docker container from the Julia build system, I run these tests on a bash shell:
Maybe we need to test:
|
@Alexander-Barth Out of curiosity, is the Docker container you mentioned one that could be run/used outside of the |
@WardF The build environment (https://binarybuilder.org/) is in fact a julia package which setups the container and the compiler toolchain and it uses the docker image from alpine linux as a base. While on Windows and Mac OS, the docker engine is also used, it seem that on Linux a more lightweight and custom sandbox runtime is used. There is more technical information here: https://docs.binarybuilder.org/dev/rootfs/ The resulting binaries (libraries, executable...) are in fact independent of julia and are just simple tarballs (one per architecture / OS ). I don't know too much about the internals (and maybe @staticfloat can correct me if I misunderstood something), but as a user a lot of things (handling the build chain, injecting software dependencies in the container) happen automatically. If a build fails with, the https://github.com/JuliaPackaging/Yggdrasil/blob/master/U/UDUNITS/build_tarballs.jl Resulting binaries: https://github.com/JuliaBinaryWrappers/UDUNITS_jll.jl/releases/tag/UDUNITS-v2.2.28%2B0 For NetCDF, it is a bit more complicated as there are shared dependencies (libcurl among others) that need to be synchronized between Julia and NetCDF: https://github.com/JuliaPackaging/Yggdrasil/tree/master/N/NetCDF (sadly the platform support of NetCDF is not nearly as large as UDUNITS, but this is mostly due to the fact that HDF5 does not support cross-compilation and some Windows issues) |
Interesting, thank you! That is worth reading through and educating myself; I am not super familiar with Julia, but I see the opportunity to extract chunks of technologies I am much more familiar with. If nothing else, it is a really interesting toolchain to parse, and I quite like the idea of being able to mint cross-platform libraries using docker. Thanks for the comprehensive introduction! |
This seems to be the kind of thing the AC_CANONICAL_HOST
AS_CASE([$host],
[*-*-cygwin], [ISCYGWIN=yes],
[*-*-darwin*], [ISOSX=yes],
[*-*-mingw*], [ISMINGW=yes],
[*-*-msys], [ISMINGW=yes],
[*-*-win*], [ISMSVC=yes],
[]
) using a macro from here and the guesses from here. For some reason, GNU Autoconf doesn't seem to have code for guessing MicroSoft Visual C, so compiling using MSVC and the Autotools build scripts ( (I think one of automake or libtool already pulls in I made this change on my fork, and have seen no new failures on Cygwin or MinGW. |
I tried to update the NetCDF version available to julia users.
However, netCDF 4.9.0 fails to build during cross-compilation for x86_64-w64-mingw32 with the error "undefined reference to `ncp_win32_api'" .
NetCDF 4.9.0
target x86_64-w64-mingw32 (cross compiled from Linux)
With gcc version: x86_64-w64-mingw32-gcc (GCC) 4.8.5
Here are the steps how we compile NetCDF (https://github.com/JuliaPackaging/Yggdrasil/blob/master/N/NetCDF/common.jl#L59)
./configure --prefix=/workspace/destdir --build=x86_64-linux-musl --host=x86_64-w64-mingw32 --enable-shared --disable-static --disable-dap-remote-tests --disable-testsets make LDFLAGS="-L/workspace/destdir/bin -lhdf5-0 -lhdf5_hl-0 -lcurl-4 -lz -no-undefined -Wl,--export-all-symbols" -j8
The build step fails with:
Attached is the file config.log
Thank you for your help.
The text was updated successfully, but these errors were encountered: