-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix link problem with Xcode 15 #7670
Fix link problem with Xcode 15 #7670
Conversation
CT Test Results 2 files 17 suites 5m 29s ⏱️ Results for commit 94a8615. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts
// Erlang/OTP Github Action Bot |
5a2764d
to
cb16586
Compare
cb16586
to
e3dfb18
Compare
SummaryOne more fix is needed for Xcode 15 to link the wx driver, to suppress undefined error messages during the configuration testing phase, by adding My running environmentMac mini 2013 M2 Pro, macOS 13.5.2, Xcode Command Line Tools 15.0, wxwidgets 3.2.2.1 from Homebrew SynopsisI've applied the patch in this PR to OTP-26.1, but this patch alone didn't solve the following error during running configure:
This error prevents building wxe_driver although this error only generates following warning during configure:
So this error does not stop the build but wxe_driver.so was not built. The error is generated during executing the following test program: Lines 7017 to 7082 in e3dfb18
I've attached a related part of configure error log in lib/wx: The error shows a massive number of undefined symbol errors as in the following excerpt:
I suspect these undefined-symbol errors prevent building wxe_driver.so file. WorkaroundAdding See https://github.com/erlang/otp/compare/OTP-26.1...jj1bdx:otp:jj1bdx-otp-26.1-macOS-wx-fix?expand=1 for the diff with OTP-26.1. With this diff, the wx is successfully built and running with OTP-26.1 on macOS. ThoughtsI am sure that this is not really a fix, and I don't know much about macOS linker issues. I hope Björn and OTP Team would deliver a much better fix than this. |
Thanks! I have pushed a fixup commit. It turns out that the linker test was broken when only dynamic |
The dynamic libraries for the `wx` application would fail to build with the new linker in Xcode 15 for macOS. One workaround is to force the old linker to be used, but that will stop working when the the old linker is eventually retired. It turns out that `wx` uses a very old way to create dynamic libraries. Essentially it asks the linker to accept that there are references to undefined symbols, trusting that they will be defined when the dynamic library is loaded. That is done using the following options: -bundle -flat_namespace -undefined suppress The option `-undefined suppress` is deprecated by the new linker and it will consider undefined symbols to be an error. A more modern approaph to creating dynamic libraries is to use the the `-bundle_loader` option to point out an executable that can be used to satisfy references to undefined symbols: -bundle -bundle_loader $ERL_TOP/bin/aarch64-apple-darwin22.6.0/beam.smp Care must be taken not to include the `-bundler_loader` option in `configure` tests that test linking, because the `beam.smp` executable has not been built at that time and the linker in older Xcode releases will complain if the executable does not exist. It seems that Xcode 15 will check that the executable exists only if there are references to undefined symbols. While at it, update the ancient build instructions for wxWidgets.
bd01a1c
to
94a8615
Compare
* This fix is a backport of the fix for OTP-18768 in OTP-26.1.1. * Reference: erlang#7670
* This fix is a backport of the fix for OTP-18768 in OTP-26.1.1. * Reference: erlang#7670
The dynamic libraries for the
wx
application would fail to build with the new linker in Xcode 15 for macOS. One workaround is to force the old linker to be used, but that will stop working when the the old linker is eventually retired.It turns out that
wx
uses a very old way to create dynamic libraries. Essentially it asks the linker to accept that there are references to undefined symbols, trusting that they will be defined when the dynamic library is loaded. That is done using the following options:The option
-undefined suppress
is deprecated by the new linker and it will consider undefined symbols to be an error.A more modern approaph to creating dynamic libraries is to use the the
-bundle_loader
option to point out an executable that can be used to satisfy references to undefined symbols:Care must be taken not to include the
-bundler_loader
option inconfigure
tests that test linking, because thebeam.smp
executable has not been built at that time and the linker in older Xcode releases will complain if the executable does not exist. It seems that Xcode 15 will check that the executable exists only if there are references to undefined symbols.While at it, update the ancient build instructions for wxWidgets.