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

Mac OS X linker does not support --version-script #26

Closed

Conversation

willglynn
Copy link
Contributor

Mac OS X's linker is derived from LLVM, not GNU binutils, and it does not support --version-script.

This commit disables that option for APPLE. There are some possible problems with this:

  • It might be too broad, since I understand CMake sets APPLE for all versions of Mac OS. I have no idea what toolchains exist on Mac OS 9 or earlier, so I have no way of knowing if this is correct.
  • Without --version-script, there's nothing to restrict which symbols are visible in the resulting libraries.

I don't know if either of these are important. That said, I do know that Mac OS X is broken with both the current release and the current master:

Linking C shared library libz.dylib
ld: unknown option: --version-script
collect2: ld returned 1 exit status
make[2]: *** [libz.1.2.7.dylib] Error 1
make[1]: *** [CMakeFiles/zlib.dir/all] Error 2

It builds with this change.

Mac OS X's linker (derived from LLVM, not GNU binutils) does not support
--version-script. Don't specify it on this platform.
@madler
Copy link
Owner

madler commented Feb 24, 2013

Incorporated.

@madler madler closed this Feb 24, 2013
@breser
Copy link

breser commented Apr 27, 2013

For what it's worth Apple's linker has -exported_symbols_list which can be used for similar purposes, however you can't do it by versions and anything that isn't listed is not exported. There is also a -unexported_symbols_list.

OS X man page for ld is here:
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/ld.1.html

geoff-nixon referenced this pull request in geoff-nixon/zlib May 6, 2016
Use INCLUDES in root Makefile.in too
simonis pushed a commit to simonis/zlib that referenced this pull request Nov 7, 2022
@Neustradamus Neustradamus mentioned this pull request Jan 1, 2025
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.

3 participants