Skip to content

Conversation

agriyakhetarpal
Copy link
Member

@agriyakhetarpal agriyakhetarpal commented Apr 2, 2025

Description

These arguments are inserted by Meson when compiling on a macOS machine on a few occasions; see numpy/numpy#28642 for greater discussion. This PR filters them out, as wasm-ld raises errors if it sees them.

This PR does not address the original issue, i.e., as to why Meson adds these arguments. The apparent cause is the use of shared libraries, libopenblas.so in this case + the fact that we are "mocking" cross compilation in a way through pywasmcross and therefore Meson isn't smart enough to not add them. This PR is not strictly required; however, this PR is useful in its own right, as it helps compilation succeed on macOS on some occasions.

Reference

https://manp.gs/mac/1/ld#dead_strip_dylibs
https://manp.gs/mac/1/ld#headerpad_max_install_names

PR stack

Please review the following PRs in the order listed below:

@agriyakhetarpal agriyakhetarpal changed the title Ignore -headerpad_max_install_names and -dead_strip_dylibs for wasm-ld [DRAFT]: Ignore -headerpad_max_install_names and -dead_strip_dylibs for wasm-ld Apr 2, 2025
agriyakhetarpal added a commit that referenced this pull request Jun 29, 2025
@agriyakhetarpal agriyakhetarpal changed the title [DRAFT]: Ignore -headerpad_max_install_names and -dead_strip_dylibs for wasm-ld Ignore -headerpad_max_install_names and -dead_strip_dylibs for wasm-ld Jun 29, 2025
@agriyakhetarpal agriyakhetarpal marked this pull request as ready for review June 29, 2025 17:28
Copy link
Member

@ryanking13 ryanking13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

# macOS-specific linker flags that wasm-ld doesn't understand
"-headerpad_max_install_names",
"-dead_strip_dylibs",
]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not related to this PR, but I think we can do some micro optimization here:

  1. Let's change the list to a set for fast check
  2. Initialize the set before for loop

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, that makes sense. I'll take that up in a new PR!

@agriyakhetarpal agriyakhetarpal merged commit 201f29a into main Jun 30, 2025
6 checks passed
@agriyakhetarpal agriyakhetarpal deleted the fix/macos-numpy-failure branch June 30, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants