-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
macOS: LD version detection is unable to detect linker for compiler gfortran with Xcode CLT 15.0 #12282
Comments
Hmm, weird. What options does (I thought we try both -v and --version, but I'd need to double check.) |
Many thanks for the quick reply! I just updated to Xcode CLT 15.0 again: # /usr/bin/ld -v
@(#)PROGRAM:ld PROJECT:dyld-1015.7
BUILD 18:48:48 Aug 22 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
will use ld-classic for: armv6 armv7 armv7s arm64_32 i386 armv6m armv7k armv7m armv7em
LTO support using: LLVM version 15.0.0 (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 15.0.0 (tapi-1500.0.12.3)
Library search paths:
Framework search paths: and #/usr/bin/ld --version
ld: unknown option: --version |
However, the same with Xcode CLT 14.3.1: # /usr/bin/ld -v
@(#)PROGRAM:ld PROJECT:ld64-857.1
BUILD 23:13:29 May 7 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 14.0.3, (clang-1403.0.22.14.1) (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 14.0.3 (tapi-1403.0.5.1) and
|
This looks like the difference between "PROJECT:ld64" and "PROJECT:dyld" is tripping up the detection. I think there was a recent discussion about this, hold on... |
Yes, but I checked, I have the fix #11958 in my /usr/local/opt/meson/lib/python3.11/site-packages/mesonbuild/linkers/detection.py. elif e.endswith('(use -v to see invocation)\n') or 'macosx_version' in e or 'ld: unknown option:' in e:
if isinstance(comp_class.LINKER_PREFIX, str):
cmd = compiler + [comp_class.LINKER_PREFIX + '-v,-r'] + extra_args
else:
cmd = compiler + comp_class.LINKER_PREFIX + ['-v'] + extra_args
_, newo, newerr = Popen_safe_logged(cmd, msg='Detecting Apple linker via')
for line in newerr.split('\n'):
if 'PROJECT:ld' in line or 'PROJECT:dyld' in line:
v = line.split('-')[1]
break
else:
__failed_to_detect_linker(compiler, check_args, o, e)
linker = linkers.AppleDynamicLinker(compiler, for_machine, comp_class.LINKER_PREFIX, override, version=v) |
Okay then, I'm out of ideas that I can think of and suggest from my phone while I'm on the go. I'll try to investigate in greater depth later today or perhaps on Sunday. |
I am very grateful for any idea, thank you so much for taking the time! |
I have also updated the first post which has minimal instructions to reproduce the error. |
Does it fail if you use Meson from Git trunk? |
I am sorry, but I don't know how to install the most recent git version. I tried:
But now I get:
Is there a guide how I install it properly from git? |
This is a correct implementation of running meson from git. To be sure, you should see that it's reporting a version number of 1.2.99 rather than reporting a version of 1.2.1 My conclusion is that the answer to @jpakkane's question is "no, using the most recent git version still fails, and does not solve the problem -- it is not fixed yet". |
Has this failure been reproduced with gfortran that is not coming from Homebrew? |
On macOS Ventura, Homebrew's gcc is unaffected by the changed linked above (we still build it on CI with Xcode 14). But even when called as
Do you have the output from that test? |
macport seems to have the same issue with the new |
Thanks for the updates, I did some more digging and it seems like the linker issue is a known bug, already reported to Apple, and also in the release notes for XCode 15 (and for me the issue is still there in 15.1. Beta):
Other resources also confirm that the current workaround is to add -ld_classic to linker flags, which forces the older linker to be used. See:
However, how do I do this to my project? Do I set environmental variables or do I change the meson build script? Sorry, I am very new to this and not very experiences in compilations...
before my meson setup command? |
Yes, setting LDFLAGS should work. |
Okay an update that it works, but I am not sure what exactly did it for me.
Interestingly, from now on (even after reboot) I don't have to use |
|
@svillemot proposed to simply use the native file in our case:
I replicated the issue in a clean installed macOS. Using the above native file solves the issue. |
So in a new shell LDFLAGS is not set, yet meson works? |
Yes, very weird... I have this on two macs... Anyways, the native file is the better solution. |
I have done another install in a virtual machine and both the native file solution as well as the export command work and solve the issue. Also the persistence of the export command is not there anymore, so all is good, seems to be something specific to my settings. |
could it be "restore apps and windows" macOS feature playing here? (or perhaps a side effect of it) |
<!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> - Fixes sagemath#36342 - using the fix discussed at mesonbuild/meson#12282 <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36523 Reported by: Matthias Köppe Reviewer(s): John H. Palmieri
<!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If this PR resolves an open issue, please link to it here. For example "Fixes sagemath#12345". --> - Fixes sagemath#36342 - using the fix discussed at mesonbuild/meson#12282 <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [ ] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - sagemath#12345: short description why this is a dependency - sagemath#34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: sagemath#36523 Reported by: Matthias Köppe Reviewer(s): John H. Palmieri
|
Describe the bug
We have recently switched to meson for building dynare, an industry-leading software used by many central banks, economic policy and research institutions as well as universities.
All was good with Xcode Command Line Tools (CLT) 14.3.1, but recently I updated to Xcode CLT 15.0 and now I get an error
ld: unknown options: --version
when detectinglinker for compiler
gfortran -Wl,--version`:Here is the output of
meson-log.txt
:To Reproduce
Update to Xcode Command Line Tools 15.0 and follow the instructions to build for macos, you will get the error. Downgrade to Xcode Command Line Tools 14.3.1 and there is no error.
Here is a minimal version of the build process to replicate:
homebrew-native.ini
looks like this:Expected behavior
No error.
system parameters
The text was updated successfully, but these errors were encountered: