-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove -flat_namespace
flag in configure.ac
on Darwin
#10723
Conversation
Incidentally, This occurs in this snippet: Lines 1065 to 1081 in 4c52549
A patch has been sent to Libtool to fix this. |
@damiendoligez @garrigue : what do you think about this change? Thanks. |
Here's an example of what can go wrong if you use Some additional background:
If it helps: I maintain Homebrew, and we package a lot of software on macOS. The only time I'd consider using it is if I'd want to retain support for users running OS X on PowerPC. I don't have access to a PowerPC machine to even check if I can build a recent version of OCaml on it, but MacPorts does, and it doesn't look like they've managed to build OCaml on any version of OS X that can still run on a PowerPC Mac. |
This code is so old I have little idea what changed since then. IIRC, the windows code was originally designed to allow compiling with a hierarchized namespace, but flexdll then emulated a flat namespace. There is a risk behavior on MacOS would diverge with this change, but I don't know enough to see the implications. BTW, I do have a powerPC machine in my office. I do not turn it up often, but if there is something to test I can try. |
We apply two patches: one of our generic Libtool patches, and a patch upstreamed upstreamed at ocaml/ocaml#10723. We embed a patch here to avoid having to regenerate `configure`, which we would need to do to use the upstreamed patch. This is needed for bottling on Monterey.
We apply two patches: one of our generic Libtool patches, and a patch upstreamed upstreamed at ocaml/ocaml#10723. We embed a patch here to avoid having to regenerate `configure`, which we would need to do to use the upstreamed patch. This is needed for bottling on Monterey.
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[edit: wait a minute, configure
is stale, so I don't know whether I tested correctly]
Oops, sorry. I forgot to regenerate it. I've done that now |
Looks like my running |
I think you should use the |
Aha, that's done now. Thanks for your patience! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did test correctly, all OPAM packages (that I can install on my machine) are compatible with this PR.
Apple discourages use of the `-flat_namespace` flag, and it exists only for compatibility with very old versions of OS X. Using `-flat_namespace` can cause various cryptic linker errors (e.g. due to name collisions), so it's best to avoid its use unless needed. This change removes the flag, and also changes `-undefined suppress` to `-undefined dynamic_lookup`. We need to change the argument to `-undefined` because omitting the `-flat_namespace` flag will build shared libraries with a two-level namespace, and this does not support `-undefined suppress`. `dynamic_lookup` means that the dynamic linker will resolve undefined symbols at runtime. This should have no visible impact on any users who do not explicitly exploit the flat namespace, but this is of often only useful for debugging purposes. Users who need this still have alternatives such as setting `DYLD_FORCE_FLAT_NAMESPACE`, which instructs the linker to treat libraries as if they were compiled with a flat namespace.
Thanks for cleaning this up for me. |
The patch was already merged at: - ocaml/ocaml#10723
Apple discourages use of the `-flat_namespace` flag, and it exists only for compatibility with very old versions of OS X. Using `-flat_namespace` can cause various cryptic linker errors (e.g. due to name collisions), so it's best to avoid its use unless needed. This change removes the flag, and also changes `-undefined suppress` to `-undefined dynamic_lookup`. We need to change the argument to `-undefined` because omitting the `-flat_namespace` flag will build shared libraries with a two-level namespace, and this does not support `-undefined suppress`. `dynamic_lookup` means that the dynamic linker will resolve undefined symbols at runtime. This should have no visible impact on any users who do not explicitly exploit the flat namespace, but this is of often only useful for debugging purposes. Users who need this still have alternatives such as setting `DYLD_FORCE_FLAT_NAMESPACE`, which instructs the linker to treat libraries as if they were compiled with a flat namespace. (cherry picked from commit a88c1db)
Apple discourages use of the `-flat_namespace` flag, and it exists only for compatibility with very old versions of OS X. Using `-flat_namespace` can cause various cryptic linker errors (e.g. due to name collisions), so it's best to avoid its use unless needed. This change removes the flag, and also changes `-undefined suppress` to `-undefined dynamic_lookup`. We need to change the argument to `-undefined` because omitting the `-flat_namespace` flag will build shared libraries with a two-level namespace, and this does not support `-undefined suppress`. `dynamic_lookup` means that the dynamic linker will resolve undefined symbols at runtime. This should have no visible impact on any users who do not explicitly exploit the flat namespace, but this is of often only useful for debugging purposes. Users who need this still have alternatives such as setting `DYLD_FORCE_FLAT_NAMESPACE`, which instructs the linker to treat libraries as if they were compiled with a flat namespace. (cherry picked from commit a88c1db)
Apple discourages use of the `-flat_namespace` flag, and it exists only for compatibility with very old versions of OS X. Using `-flat_namespace` can cause various cryptic linker errors (e.g. due to name collisions), so it's best to avoid its use unless needed. This change removes the flag, and also changes `-undefined suppress` to `-undefined dynamic_lookup`. We need to change the argument to `-undefined` because omitting the `-flat_namespace` flag will build shared libraries with a two-level namespace, and this does not support `-undefined suppress`. `dynamic_lookup` means that the dynamic linker will resolve undefined symbols at runtime. This should have no visible impact on any users who do not explicitly exploit the flat namespace, but this is of often only useful for debugging purposes. Users who need this still have alternatives such as setting `DYLD_FORCE_FLAT_NAMESPACE`, which instructs the linker to treat libraries as if they were compiled with a flat namespace. (cherry picked from commit a88c1db)
`-flat_namespace` is effectively deprecated and doesn't really work as expected these days. Omitting the `-flat_namespace` means that binaries are built with a two-level namespace, which don't support `-undefined suppress`. The idiomatic way of telling the linker to look up undefined symbols at runtime is using `-undefined dynamic_lookup`, which is supported by a two-level namespace. See also: ocaml/ocaml#10723 mono/mono#21257
Apple discourages use of the
-flat_namespace
flag, and it exists onlyfor compatibility with very old versions of OS X. Using
-flat_namespace
can cause various cryptic linker errors (e.g. due toname collisions), so it's best to avoid its use unless needed.
This change removes the flag, and also changes
-undefined suppress
to-undefined dynamic_lookup
. We need to change the argument to-undefined
because omitting the-flat_namespace
flag will buildshared libraries with a two-level namespace, and this does not support
-undefined suppress
.dynamic_lookup
means that the dynamic linkerwill resolve undefined symbols at runtime.
This should have no visible impact on any users who do not explicitly
exploit the flat namespace, but this is of often only useful for
debugging purposes. Users who need this still have alternatives such as
setting
DYLD_FORCE_FLAT_NAMESPACE
, which instructs the linker to treatlibraries as if they were compiled with a flat namespace.