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

Latest xcode results in lots of linker warnings #4501

Closed
schveiguy opened this issue Sep 24, 2023 · 8 comments
Closed

Latest xcode results in lots of linker warnings #4501

schveiguy opened this issue Sep 24, 2023 · 8 comments

Comments

@schveiguy
Copy link
Contributor

A sample for when I build a simple app with ldc 1.34.0 with xcode 15.0 (there are a lot of these):

ld: warning: no platform load command found in '/Users/steves/.dub/cache/numbers/~master/build/application-debug-WophZRlX_VEn3wfrspNcCQ/numbers.o', assuming: macOS
ld: warning: no platform load command found in '/Users/steves/ldc2-1.34.0-osx-universal/lib-arm64/libphobos2-ldc.a[2](curl.o)', assuming: macOS
ld: warning: no platform load command found in '/Users/steves/ldc2-1.34.0-osx-universal/lib-arm64/libphobos2-ldc.a[8](zlib.o)', assuming: macOS
ld: warning: no platform load command found in '/Users/steves/ldc2-1.34.0-osx-universal/lib-arm64/libphobos2-ldc.a[9](comparison.o)', assuming: macOS
ld: warning: no platform load command found in '/Users/steves/ldc2-1.34.0-osx-universal/lib-arm64/libphobos2-ldc.a[11](iteration.o)', assuming: macOS

It's unfortunate, Apple seems to change the linker rules every release...

@kinke
Copy link
Member

kinke commented Sep 28, 2023

The apparently common workaround is to use -L-ld_classic:

@drpriver
Copy link
Contributor

-L-w also suppresses the warnings (though it suppresses all linker warnings).

@jacob-carlborg
Copy link
Contributor

Hmm, I thought this would be a thing that LLVM does automatically.

I implemented a fix for a similar warning for DMD a couple of years ago. It was never merged but it shows more or less what needs to be done [1].

[1] dlang/dmd#10476

@JohanEngelen
Copy link
Member

Fixed in #4534

@jacob-carlborg
Copy link
Contributor

Did this not make the 1.36.0 release? I still get these warnings. Actually, with 1.35.0 I get these warnings for both object files from Phobos/druntime and for the object files compiled from my own code. With 1.36.0 I only get warnings for object files from Phobos/druntime.

@JohanEngelen
Copy link
Member

This did make it into the release (and the beta), but indeed I also see linker warnings with the released binary. When building LDC on my own machine, I do not get any warnings. Somehow related to how release packages are built? (on what OS, etc.)

@kinke
Copy link
Member

kinke commented Jan 6, 2024

I assume you guys are talking about arm64, with a potential culprit being

triple="$arch-apple-macos"
, and possibly some more stuff. - One month of beta, still not enough. :(

@jacob-carlborg
Copy link
Contributor

I assume you guys are talking about arm64

Yes.

One month of beta, still not enough. :(

Sorry about that. I tried the beta, I just assumed the fix wasn't included. It's not mentioned in the release notes or in the changelog. But it seems that individual bug fixes are not listed there. I have projects that automatically test all betas and latest versions of the compiler. But it won't catch these kinds of issues, since it builds and runs fine anyway.

I suggested creating a test, a few days after the fix was merged: #4534 (comment).

JohanEngelen pushed a commit that referenced this issue Jan 21, 2024
* CI: Always include macOS version in explicit triples

Wrt. issue #4501.

* macOS universal package: Use `-arch {arm64,x86_64}` instead of `-target …` for clang linker driver

In order not to have to hardcode an explicit macOS version.
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

No branches or pull requests

5 participants