Skip to content

Fix the configuration of ZSTD on mingw-w64#12265

Merged
shindere merged 5 commits intoocaml:trunkfrom
dra27:zstd-mingw
May 30, 2023
Merged

Fix the configuration of ZSTD on mingw-w64#12265
shindere merged 5 commits intoocaml:trunkfrom
dra27:zstd-mingw

Conversation

@dra27
Copy link
Copy Markdown
Member

@dra27 dra27 commented May 25, 2023

#12190 means that the mingw-w64 version of ZSTD is correctly detected by configure.ac and HAS_ZSTD is correctly defined in s.h. However, the way that bytecclibs and nativecclibs are declared for the Windows ports means that -lzstd does not get added and consequently the build fails with a linking error.

This PR ultimately unifies the computation of cclibs between Unix and Windows, a side-effect of which is that ZSTD now configures correctly. The PR is best reviewed commit-by-commit. There's no distinction in configure.ac between bytecode and nativecode libraries, so the variables have been merged to cclibs to remove the code duplication.

The important check here is the diff in config.status before and after the PR. There's no relevant change on Unix. On Windows, the only pertinent change is that -latomic gets added for 32-bit mingw-w64 (as for the other 32-bit GCC ports).

dra27 added 5 commits May 24, 2023 15:19
This was needed for caml_print_trace in multicore, but this function was
removed prior to merging. The functions in execinfo.h are used in the
tests for frame pointers, but this is Linux-only and the functions are
implemented in glibc.
$mathlib is unconditionally set later in configure.ac
On mingw-w64, libm.a is a dummy library. The existing link test would
pass, but pointlessly add -lm to the linking list. Use AC_SEARCH_LIBS
instead, so that -lm is only added when strictly needed.
The same libraries are used for each. Distinction kept in
Makefile.config as it's both public and could be overridden in the build
system if needed.
Remove all the special-case code for the Windows ports. Means that the
zstd configuration is now correctly propagated.
@dra27 dra27 added the bug label May 25, 2023
@dra27 dra27 added this to the 5.1 milestone May 25, 2023
@shindere
Copy link
Copy Markdown
Contributor

shindere commented May 30, 2023 via email

@shindere shindere merged commit 224c14c into ocaml:trunk May 30, 2023
@dra27
Copy link
Copy Markdown
Member Author

dra27 commented May 30, 2023

Thanks, @shindere!

@dra27 dra27 deleted the zstd-mingw branch May 30, 2023 13:06
@gasche
Copy link
Copy Markdown
Member

gasche commented Jun 13, 2023

@Octachron this change is placed in the 5.1 section in the trunk branch, but was never backported to 5.1. Should we consider backporting it to 5.1?

For reference, the Changes entry:

- #12265: Stop adding -lexecinfo to cclibs (leftover debugging code from the
  multicore project). Harden the feature probe for -lm in configure so -lm is
  only added if strictly necessary. configure.ac now correctly propagates
  library flags for the Windows ports, allowing Windows OCaml to be configured
  with ZSTD support.
  (David Allsopp, review by Sébastien Hinderer)

This is a ./configure+Makefile change, my gut feeling is that we should backport it. (Our Windows users want 5.1 to work as nicely as possible, and our other users are probably not negatively affected by the change.)

Octachron pushed a commit that referenced this pull request Jun 14, 2023
Fix the configuration of ZSTD on mingw-w64

(cherry picked from commit 224c14c)
@Octachron
Copy link
Copy Markdown
Member

Cherry-picked on 5.1 as 1d7bfeb and I have checked that this was the only forgotten PRs in the 5.1 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants