Skip to content
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

ENH, BLD: Fix math feature detection for wasm #21277

Merged
merged 3 commits into from Mar 31, 2022

Commits on Mar 31, 2022

  1. MAINT, BLD Fix math feature detection for wasm

    The web assembly linker is strict about function types, it is unwilling
    to link a function defined with signature say `double f(double, double)`
    to an invocation with signature `void f(void)`. This causes trouble in
    `numpy/core/setup.py` in the functions `check_math_capabilities` and
    `check_mathlib`.
    
    This patch fixes the problem by giving config.try_link the correct
    function signatures for these functions. In particular I added a separate
    header file with all the math declarations. It would be be possible to
    just include 'math.h' but we also need to parse the declarations to figure
    out how to call the functions. If f has arguments type1, type2, type3, we
    want to call it like f((type1)0, (type2)0, (type3)0). Anyways it is easier
    to parse the arguments out of our feature_detection_math.h than to worry
    about the possibility that someone will have a differently formatted system
    math.h. We do a test where we include both math.h and feature_detection_math.h
    to ensure consistency between the signatures.
    
    I also separated out the fcntl functions, backtrace and madvise, and strtold_l.
    This is because they require separate headers. strtold_l requires testing both
    with the locale.h header and with the xlocale.h header (this seems to vary even
    among different linuxes). All of the functions I moved out of OPTIONAL_STDFUNCS
    are absent on windows and some are absent on OSX so separating them out of the
    OPTIONAL_STDFUNCS should mildly improve the speed of feature detection on mac
    and windows (since they have all the functions remaining in OPTIONAL_STDFUNCS).
    hoodmane authored and charris committed Mar 31, 2022
    Copy the full SHA
    f2119f9 View commit details
    Browse the repository at this point in the history
  2. Add upcoming_changes note

    hoodmane authored and charris committed Mar 31, 2022
    Copy the full SHA
    f1c1014 View commit details
    Browse the repository at this point in the history
  3. Use description from mattip

    hoodmane authored and charris committed Mar 31, 2022
    Copy the full SHA
    543e135 View commit details
    Browse the repository at this point in the history