dmd
dmd copied to clipboard
Fix issue 20297: ld: warning: building for macOS
What's missing:
- [x] Tests
- [x] Don't hardcode the current SDK
- [x] Don't hardcode the current platform version
I'm guessing we can hardcode the platform for now since DMD doesn't support cross-compiling.
Thanks for your pull request and interest in making D better, @jacob-carlborg! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:
- My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
- My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
- I have provided a detailed rationale explaining my changes
- New or modified functions have Ddoc comments (with
Params:
andReturns:
)
Please see CONTRIBUTING.md for more information.
If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.
Bugzilla references
Auto-close | Bugzilla | Severity | Description |
---|---|---|---|
✓ | 20297 | normal | ld: warning: building for macOS |
Testing this PR locally
If you don't have a local development environment setup, you can use Digger to test this PR:
dub fetch digger
dub run digger -- build "master + dmd#10476"
Not WIP anymore.
Don't know why the tests are failing. They work locally.
What version is the machine ? I doubt it's Catalina.
One machine is running Darwin 13 and one is running Darwin 15. I think Catalina is at least on Darwin 19. One is running Clang 6 which is really old and the other one Clang 8 which is quite old.
I developed this on Mojave so it’s not dependent on Catalina.
Perhaps I can check the version and only add the new load command if it’s recent enough.
Perhaps I can check the version and only add the new load command if it’s recent enough.
Sounds like the way to go.
Seems like the LC_BUILD_VERSION
load command was added in Xcode 10. In previous version there was a LC_VERSION_MIN_MACOSX
load command. I can add support for that as well.
Now handles both LC_BUILD_VERSION
and LC_VERSION_MIN_MACOSX
. Let's see what the CI pipelines say.
That warning is still all over the place :(
Looks like it shows in 2 different ways tho. When compiling DMD:
ld: warning: object file (../generated/osx/release/64/parser.a(array_2c6_60c.o)) was built for newer OSX version (10.11.6) than being linked (10.9)
When compiling the test suite:
ld: warning: object file (../../phobos/{{RESULTS_DIR}}/osx/release/64/libphobos2.a(object_3c_775.o)) was built for newer OSX version (10.11.6) than being linked (10.11)
That’s probably correct. There’s an environment variable I need to take into account as well.
I’ve seen this warning with Clang and LDC as well.
Not sure why it segfaults though on one of the machines.
I still don't know how to debug the segfault in the failing test since it doesn't happen locally.
I still don't know how to debug the segfault in the failing test since it doesn't happen locally.
I had an old VM running a version of macOS where I could reproduce the failure. Hopefully it should be fixed now.
Anyone that understands what the dshell/sameenv.d
test is supposed to do?
It came from this PR: https://github.com/dlang/dmd/pull/8121 and seems to be making sure that dmd -run doesn't pollute the environment.
I assume something in CoreFoundation is setting __CF_USER_TEXT_ENCODING=0x1F6:0:0 in the environment which I think is the only change in env that's causing that test to fail
Needs a rebase
The warnings don't appear anymore. Apple must have changed something. Not sure if it's still interesting to have these load commands.
macOS 13 coverage tests on mainline have suddenly began failing with:
ld: multiple errors: symbol count from symbol table and dynamic symbol table differ in '/Users/runner/work/dmd/dmd/generated/build.o' in '/Users/runner/work/dmd/dmd/generated/build.o'; address=0x0 points to section(2) with no content in '/Users/runner/dlang/dmd-2.107.0/osx/lib/libphobos2.a[3233](config_a98_4c3.o)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1
Error: Process completed with exit code 1.
Time for a rebase?