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

Doesn't link on macOS #78

Closed
emersion opened this Issue Dec 28, 2018 · 3 comments

Comments

2 participants
@emersion
Copy link
Owner

emersion commented Dec 28, 2018

--version-script is not supported on macOS. Neither --version-script or __attribute__((visibility("visible")) are standard, so I'd rather add some workarounds in Meson.

An attempt to do so is https://github.com/emersion/mrsh/tree/ld-export

It doesn't properly detect -export_symbol support on macOS unfortunately.

Related issues:

@mkhl

This comment has been minimized.

Copy link
Contributor

mkhl commented Jan 8, 2019

I got this working on macOS: https://github.com/mkhl/mrsh/tree/ld-export

The relevant change is mkhl/mrsh@6a31bd9

The problems it solves, as far as I can tell:

  • -export_symbol doesn’t accept wildcards
  • -export_symbol without an argument doesn’t seem to export any symbols, which lets the linker fail because of undefined symbols
  • I couldn’t get ld(1) to accept any arguments to -export_symbol either, it always treated them as filenames…
  • symbol names are generated with leading underscores
@emersion

This comment has been minimized.

Copy link
Owner

emersion commented Jan 8, 2019

Thanks for investigating this! This change looks good to me, both Clang and GCC don't have -export_symbol in their manpages anyway (OTOH, -exported_symbols_list are there). Can you open a pull request?

One annoying thing is that GCC does accept -exported_symbols_lists even if it doesn't support this flag -- it understands it as -e with the value xported_symbols_lists. I wouldn't care too much about it since it'll cause an error later anyway ("cannot find entry symbol xported_symbols_lists").

mkhl added a commit to mkhl/mrsh that referenced this issue Jan 8, 2019

Support clang linker using -exported_symbols_list
Detection for `-exported_symbol` doesn't work,
and it doesn't accept wildcards anyway.
Use `-exported_symbols_list`, which works and is documented.

Fixes emersion#78
@mkhl

This comment has been minimized.

Copy link
Contributor

mkhl commented Jan 8, 2019

Can you open a pull request?

Done: #82

GCC does accept -exported_symbols_lists even if it doesn't support this flag -- it understands it as -e with the value xported_symbols_lists.

Yeah, it’s a pity that the styles for long options diverged and clashes with that for short options…

emersion added a commit that referenced this issue Jan 15, 2019

Support clang linker using -exported_symbols_list
Detection for `-exported_symbol` doesn't work,
and it doesn't accept wildcards anyway.
Use `-exported_symbols_list`, which works and is documented.

Fixes #78

@emersion emersion closed this in 640d1c2 Jan 15, 2019

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