digitalmars.D.learn - macOS Sonoma Linker Issue
- confuzzled (13/13) Oct 03 2023 Any known workaround for this most recent issue on macOS Sonoma?
- Tuna Celik (2/15) Oct 04 2023 I'm also suffering from the same problem.
- Paolo Invernizzi (2/5) Oct 04 2023 It seems to be an Xcode 15 issues, everything works fine with 14
- Tuna Celik (4/10) Oct 04 2023 Thank you. I used ldc2 as a compiler and that works. As you said,
- Johan (4/17) Oct 04 2023 Try passing `-ld_classic` to the linker. (`dmd -L-ld_classic`)
- confuzzled (2/5) Oct 04 2023 Thanks. This did the trick.
- Gary Chike (7/8) Oct 18 2023 This works for me as well, thank you! I'm running macOS Sonoma
- Renato (6/24) Dec 13 2023 Thanks, it worked for me as well on MacOS Sonoma! The issue
- Johan (5/32) Dec 17 2023 Release will not be in next weeks, first DMD 2.106.1 should be
- Renato (73/107) Dec 21 2023 This problem is really serious, I think you should consider a
- Guillaume Piolat (6/8) Dec 21 2023 Hello, why not use ldc instead of dmd for macOS?
- Renato (5/14) Dec 21 2023 LDC is slow and makes huge multi-MB binaries (is that normal?).
- Julian Fondren (4/7) Dec 21 2023 On my setup ldc generates small binaries and dmd generates huge
- Renato (53/62) Dec 21 2023 It still doesn't work when I try to run tests with silly and
- Guillaume Piolat (9/10) Dec 22 2023 Make sure you're using the "osx-universal" package in order to
- Renato (36/46) Dec 22 2023 I installed using the script as the downloads page suggests... it
- Renato (53/63) Dec 22 2023 I went to the effort of downloading this universal release,
- Joel (3/8) Dec 17 2023 I've been holding off installing Sonoma, because of this. How
Any known workaround for this most recent issue on macOS Sonoma? The file I'm compiling contains a blank main() without any imports but this error shows up on everything I've attempted to compile since upgrading to Sonoma. (dmd-2.105.2) confuzzled test ~ % dmd add ld: multiple errors: symbol count from symbol table and dynamic symbol table differ in '/Users/confuzzled/add.o' in '/Users/confuzzled/add.o'; address=0x0 points to section(2) with no content in '/Users/confuzzled/dlang/dmd-2.105.2/osx/lib/libphobos2.a[3177](config_a68_4c3.o)' clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: linker exited with status 1
Oct 03 2023
On Tuesday, 3 October 2023 at 23:55:05 UTC, confuzzled wrote:Any known workaround for this most recent issue on macOS Sonoma? The file I'm compiling contains a blank main() without any imports but this error shows up on everything I've attempted to compile since upgrading to Sonoma. (dmd-2.105.2) confuzzled test ~ % dmd add ld: multiple errors: symbol count from symbol table and dynamic symbol table differ in '/Users/confuzzled/add.o' in '/Users/confuzzled/add.o'; address=0x0 points to section(2) with no content in '/Users/confuzzled/dlang/dmd-2.105.2/osx/lib/libphobos2.a[3177](config_a68_4c3.o)' clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: linker exited with status 1I'm also suffering from the same problem.
Oct 04 2023
On Wednesday, 4 October 2023 at 07:43:29 UTC, Tuna Celik wrote:On Tuesday, 3 October 2023 at 23:55:05 UTC, confuzzled wrote:It seems to be an Xcode 15 issues, everything works fine with 14[...]I'm also suffering from the same problem.
Oct 04 2023
On Wednesday, 4 October 2023 at 07:47:05 UTC, Paolo Invernizzi wrote:On Wednesday, 4 October 2023 at 07:43:29 UTC, Tuna Celik wrote:Thank you. I used ldc2 as a compiler and that works. As you said, there is something different with Xcode 15On Tuesday, 3 October 2023 at 23:55:05 UTC, confuzzled wrote:It seems to be an Xcode 15 issues, everything works fine with 14[...]I'm also suffering from the same problem.
Oct 04 2023
On Tuesday, 3 October 2023 at 23:55:05 UTC, confuzzled wrote:Any known workaround for this most recent issue on macOS Sonoma? The file I'm compiling contains a blank main() without any imports but this error shows up on everything I've attempted to compile since upgrading to Sonoma. (dmd-2.105.2) confuzzled test ~ % dmd add ld: multiple errors: symbol count from symbol table and dynamic symbol table differ in '/Users/confuzzled/add.o' in '/Users/confuzzled/add.o'; address=0x0 points to section(2) with no content in '/Users/confuzzled/dlang/dmd-2.105.2/osx/lib/libphobos2.a[3177](config_a68_4c3.o)' clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: linker exited with status 1Try passing `-ld_classic` to the linker. (`dmd -L-ld_classic`) https://github.com/ldc-developers/ldc/issues/4501#issuecomment-1738295459 -Johan
Oct 04 2023
On Wednesday, 4 October 2023 at 11:01:08 UTC, Johan wrote:Try passing `-ld_classic` to the linker. (`dmd -L-ld_classic`) https://github.com/ldc-developers/ldc/issues/4501#issuecomment-1738295459 -JohanThanks. This did the trick.
Oct 04 2023
On Wednesday, 4 October 2023 at 11:01:08 UTC, Johan wrote:Try passing `-ld_classic` to the linker. (`dmd -L-ld_classic`)This works for me as well, thank you! I'm running macOS Sonoma and XCode 15.0 (15A240d). It appears XCode 15's linker errors are wreaking havoc with quite a few other languages as well. I also mess around with Crystal and the solution is similar. D is not alone :-) ```crystal run --link-flags=-Wl,-ld_classic hello.cr```
Oct 18 2023
On Wednesday, 4 October 2023 at 11:01:08 UTC, Johan wrote:On Tuesday, 3 October 2023 at 23:55:05 UTC, confuzzled wrote:Thanks, it worked for me as well on MacOS Sonoma! The issue you've linked has been resolved now. I am completely new to D, so if I may ask, how often do they release? The fix was merged 2 weeks ago, should we expect a release within a few weeks or it's not released that often?Any known workaround for this most recent issue on macOS Sonoma? The file I'm compiling contains a blank main() without any imports but this error shows up on everything I've attempted to compile since upgrading to Sonoma. (dmd-2.105.2) confuzzled test ~ % dmd add ld: multiple errors: symbol count from symbol table and dynamic symbol table differ in '/Users/confuzzled/add.o' in '/Users/confuzzled/add.o'; address=0x0 points to section(2) with no content in '/Users/confuzzled/dlang/dmd-2.105.2/osx/lib/libphobos2.a[3177](config_a68_4c3.o)' clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: linker exited with status 1Try passing `-ld_classic` to the linker. (`dmd -L-ld_classic`) https://github.com/ldc-developers/ldc/issues/4501#issuecomment-1738295459 -Johan
Dec 13 2023
On Wednesday, 13 December 2023 at 18:32:50 UTC, Renato wrote:On Wednesday, 4 October 2023 at 11:01:08 UTC, Johan wrote:Release will not be in next weeks, first DMD 2.106.1 should be released, then probably a few weeks later LDC 1.36 will be released. -JohanOn Tuesday, 3 October 2023 at 23:55:05 UTC, confuzzled wrote:Thanks, it worked for me as well on MacOS Sonoma! The issue you've linked has been resolved now. I am completely new to D, so if I may ask, how often do they release? The fix was merged 2 weeks ago, should we expect a release within a few weeks or it's not released that often?Any known workaround for this most recent issue on macOS Sonoma? The file I'm compiling contains a blank main() without any imports but this error shows up on everything I've attempted to compile since upgrading to Sonoma. (dmd-2.105.2) confuzzled test ~ % dmd add ld: multiple errors: symbol count from symbol table and dynamic symbol table differ in '/Users/confuzzled/add.o' in '/Users/confuzzled/add.o'; address=0x0 points to section(2) with no content in '/Users/confuzzled/dlang/dmd-2.105.2/osx/lib/libphobos2.a[3177](config_a68_4c3.o)' clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: linker exited with status 1Try passing `-ld_classic` to the linker. (`dmd -L-ld_classic`) https://github.com/ldc-developers/ldc/issues/4501#issuecomment-1738295459 -Johan
Dec 17 2023
On Sunday, 17 December 2023 at 12:08:40 UTC, Johan wrote:On Wednesday, 13 December 2023 at 18:32:50 UTC, Renato wrote:This problem is really serious, I think you should consider a release sooner. I am trying to get started with `dub` but this issue keeps popping up. All I did was this: ``` dub init myproject dub add silly dub build ``` silly is a nicer test runner, which is exactly what I wanted... but the build fails with linker issues: ▶ dub build dub build Starting Performing "debug" build using /Library/D/dmd/bin/dmd for x86_64. Building pledged ~master: building configuration [application] Linking pledged ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: alignment (1) of atom 'anon' is too small and may result in unaligned pointers ld: warning: pointer not aligned at address 0x1000741C9 ('anon' + 457 from /Users/renato/.dub/cache/pledged/~master/build/application-debug-lpSnJT5zFAFHM32hZ8QYUw/pledged.o) ld: warning: pointer not aligned at address 0x1000741E6 ('anon' + 486 from /Users/renato/.dub/cache/pledged/~master/build/application-debug-lpSnJT5zFAFHM32hZ8QYUw/pledged.o) ld: warning: pointer not aligned at address 0x1000742C9 ('anon' + 713 from /Users/renato/.dub/cache/pledged/~master/build/application-debug-lpSnJT5zFAFHM32hZ8QYUw/pledged.o) ld: warning: pointer not aligned at address 0x100074311 ('anon' + 785 from /Users/renato/.dub/cache/pledged/~master/build/application-debug-lpSnJT5zFAFHM32hZ8QYUw/pledged.o) ld: warning: pointer not aligned at address 0x100074367 ('anon' + 871 from /Users/renato/.dub/cache/pledged/~master/build/application-debug-lpSnJT5zFAFHM32hZ8QYUw/pledged.o) ld: warning: pointer not aligned at address 0x1000743A2 ('anon' + 930 from /Users/renato/.dub/cache/pledged/~master/build/application-debug-lpSnJT5zFAFHM32hZ8QYUw/pledged.o) ld: warning: pointer not aligned at address 0x1000743BE ('anon' + 958 from /Users/renato/.dub/cache/pledged/~master/build/application-debug-lpSnJT5zFAFHM32hZ8QYUw/pledged.o) ld: warning: pointer not aligned at address 0x1000743FA ('anon' + 1018 from /Users/renato/.dub/cache/pledged/~master/build/application-debug-lpSnJT5zFAFHM32hZ8QYUw/pledged.o) ld: unaligned pointer(s) for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: linker exited with status 1 Error /Library/D/dmd/bin/dmd failed with exit code 1. Unless silly is completely broken, it seems like this is a linker issue again.On Wednesday, 4 October 2023 at 11:01:08 UTC, Johan wrote:Release will not be in next weeks, first DMD 2.106.1 should be released, then probably a few weeks later LDC 1.36 will be released. -JohanOn Tuesday, 3 October 2023 at 23:55:05 UTC, confuzzled wrote:Thanks, it worked for me as well on MacOS Sonoma! The issue you've linked has been resolved now. I am completely new to D, so if I may ask, how often do they release? The fix was merged 2 weeks ago, should we expect a release within a few weeks or it's not released that often?Any known workaround for this most recent issue on macOS Sonoma? The file I'm compiling contains a blank main() without any imports but this error shows up on everything I've attempted to compile since upgrading to Sonoma. (dmd-2.105.2) confuzzled test ~ % dmd add ld: multiple errors: symbol count from symbol table and dynamic symbol table differ in '/Users/confuzzled/add.o' in '/Users/confuzzled/add.o'; address=0x0 points to section(2) with no content in '/Users/confuzzled/dlang/dmd-2.105.2/osx/lib/libphobos2.a[3177](config_a68_4c3.o)' clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: linker exited with status 1Try passing `-ld_classic` to the linker. (`dmd -L-ld_classic`) https://github.com/ldc-developers/ldc/issues/4501#issuecomment-1738295459 -Johan
Dec 21 2023
On Thursday, 21 December 2023 at 18:06:51 UTC, Renato wrote:Unless silly is completely broken, it seems like this is a linker issue again.Hello, why not use ldc instead of dmd for macOS? sudo ln -f -s /path/to/ldc/compiler/bin/ldc2 /usr/local/bin/ldc2 sudo ln -f -s /path/to/ldc/compiler/bin/dub /usr/local/bin/dub You will get multiple targets (dub -a arm64-apple-macos and -a x86_64)
Dec 21 2023
On Thursday, 21 December 2023 at 19:29:31 UTC, Guillaume Piolat wrote:On Thursday, 21 December 2023 at 18:06:51 UTC, Renato wrote:LDC is slow and makes huge multi-MB binaries (is that normal?). DMD seemed much better to me. But at least LDC works :) so will use that for now.Unless silly is completely broken, it seems like this is a linker issue again.Hello, why not use ldc instead of dmd for macOS? sudo ln -f -s /path/to/ldc/compiler/bin/ldc2 /usr/local/bin/ldc2 sudo ln -f -s /path/to/ldc/compiler/bin/dub /usr/local/bin/dub You will get multiple targets (dub -a arm64-apple-macos and -a x86_64)
Dec 21 2023
On Thursday, 21 December 2023 at 22:19:07 UTC, Renato wrote:LDC is slow and makes huge multi-MB binaries (is that normal?). DMD seemed much better to me. But at least LDC works :) so will use that for now.On my setup ldc generates small binaries and dmd generates huge ones. The difference is about dynamically linking Phobos or not. Try ldc with --link-defaultlib-shared
Dec 21 2023
On Thursday, 21 December 2023 at 19:29:31 UTC, Guillaume Piolat wrote:On Thursday, 21 December 2023 at 18:06:51 UTC, Renato wrote:It still doesn't work when I try to run tests with silly and ldc2, and try to use this configuration (for better error messages): ``` configuration "unittest" { dflags "-checkaction=context" } ``` Error: ``` ▶ dub test Generating test runner configuration 'pledged-test-unittest' for 'unittest' (library). Starting Performing "unittest" build using /Users/renato/dlang/ldc-1.35.0/bin/ldc2 for x86_64. Building pledged ~master: building configuration [pledged-test-unittest] Linking pledged-test-unittest Undefined symbols for architecture x86_64: "__D4core8internal7dassert__T14_d_assert_failTPkZQuFNaNbNiNfMxAyaMxPkZAya", referenced from: __D3std3uni__T8CowArrayTSQwQu8GcPolicyZQz17freeThisReferenceMFNaNbNiNfZv in pledged-test-unittest.o "__D4core8internal7dassert__T14_d_assert_failTxkZ__TQxTiZQBcFNaNbNi fMxAyaMKxkMxiZAya", referenced from: __D3std3uni__T9sliceBitsVmi0Vmi8ZQt__T6opCallTwZQkFNaNbNiNfwZk in pledged-test-unittest.o __D3std3uni__T9sliceBitsVmi8Vmi21ZQu__T6opCallTwZQkFNaNbNiNfwZk in pledged-test-unittest.o "__D4core8internal7dassert__T24miniFormatFakeAttributesTmZQB FNaNbNiNfMKxmZAya", referenced from: __D4core8internal7dassert__T14_d_assert_failTmZ__TQwTmZQBbFNaNbN NfMxAyaMKxmMKxmZAya in pledged-test-unittest.o __D4core8internal7dassert__T14_d_assert_failTmZ__TQwTmZQBbFNaNb iNfMxAyaMKxmMxmZAya in pledged-test-unittest.o __D4core8internal7dassert__T14_d_assert_failTmZ__TQwTmZQBbFNaNb iNfMxAyaMxmMKxmZAya in pledged-test-unittest.o __D4core8internal7dassert__T14_d_assert_failTmZ__TQwTiZQBbFNaN NiNfMxAyaMxmMxiZAya in pledged-test-unittest.o __D4core8internal7dassert__T14_d_assert_failTmZ__TQwTiZQBbFNaNb iNfMxAyaMKxmMxiZAya in pledged-test-unittest.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: /usr/bin/cc failed with status: 1 Error /Users/renato/dlang/ldc-1.35.0/bin/ldc2 failed with exit code 1. (ldc-1.35.0) ```Unless silly is completely broken, it seems like this is a linker issue again.Hello, why not use ldc instead of dmd for macOS? sudo ln -f -s /path/to/ldc/compiler/bin/ldc2 /usr/local/bin/ldc2 sudo ln -f -s /path/to/ldc/compiler/bin/dub /usr/local/bin/dub You will get multiple targets (dub -a arm64-apple-macos and -a x86_64)
Dec 21 2023
On Thursday, 21 December 2023 at 23:25:55 UTC, Renato wrote:ld: symbol(s) not found for architecture x86_64Make sure you're using the "osx-universal" package in order to have both arch. https://github.com/ldc-developers/ldc/releases/tag/v1.35.0 That said, for consumer software it may be a good idea to use eg: LDC 1.28 for x86_64 and LDC 1.35 for arm64 builds. You can stich the binaries together, which will give compatibility with all macOS from 10.12 up to Sonoma (well, if you also: codesign, notarize, make a DMG...).
Dec 22 2023
On Friday, 22 December 2023 at 12:49:35 UTC, Guillaume Piolat wrote:On Thursday, 21 December 2023 at 23:25:55 UTC, Renato wrote:I installed using the script as the downloads page suggests... it installed the correct architecture for me: ``` ▶ curl -fsS https://dlang.org/install.sh | bash -s ldc Downloading https://dlang.org/d-keyring.gpg Downloading https://dlang.org/install.sh The latest version of this script was installed as ~/dlang/install.sh. It can be used it to install further D compilers. Run `~/dlang/install.sh --help` for usage information. Downloading and unpacking https://github.com/ldc-developers/ldc/releases/download/v1.35.0/ldc2-1.35.0-osx-x86_64.tar.xz Using dub 1.34.0 shipped with ldc-1.35.0 Run `source ~/dlang/ldc-1.35.0/activate` in your shell to use ldc-1.35.0. This will setup PATH, LIBRARY_PATH, LD_LIBRARY_PATH, DMD, DC, and PS1. Run `deactivate` later on to restore your environment. ``` Are you sure this shouldn't have just worked? I then tried as suggested above to install the universal release: ``` ~/dlang/install.sh install ldc2-1.35.0-osx-universal Downloading and unpacking https://github.com/ldc-developers/ldc/releases/download/v1.35.0-osx-universal/ldc2-1.35.0-osx-universal-osx-x86_64.tar.xz curl: (22) The requested URL returned error: 404 ``` I don't want to just download the binary and unpack it myself because apparently the install script's "activate" command sets up a bunch of environment variables that I will need later. Can't `install.sh` install this universal release?ld: symbol(s) not found for architecture x86_64Make sure you're using the "osx-universal" package in order to have both arch. https://github.com/ldc-developers/ldc/releases/tag/v1.35.0 That said, for consumer software it may be a good idea to use eg: LDC 1.28 for x86_64 and LDC 1.35 for arm64 builds. You can stich the binaries together, which will give compatibility with all macOS from 10.12 up to Sonoma (well, if you also: codesign, notarize, make a DMG...).
Dec 22 2023
On Friday, 22 December 2023 at 12:49:35 UTC, Guillaume Piolat wrote:On Thursday, 21 December 2023 at 23:25:55 UTC, Renato wrote:I went to the effort of downloading this universal release, manually creating the `activate` script with the right paths to avoid issues (as the download didn't include one)... and it still fails. ``` ▶ dub test Generating test runner configuration 'pledged-test-unittest' for 'unittest' (library). Starting Performing "unittest" build using /Users/renato/dlang/ldc2-1.35.0-osx-universal/bin/ldc2 for x86_64. Building pledged ~master: building configuration [pledged-test-unittest] Linking pledged-test-unittest Undefined symbols for architecture x86_64: "__D4core8internal7dassert__T14_d_assert_failTPkZQuFNaNbNiNfMxAyaMxPkZAya", referenced from: __D3std3uni__T8CowArrayTSQwQu8GcPolicyZQz17freeThisReferenceMFNaNbNiNfZv in pledged-test-unittest.o "__D4core8internal7dassert__T14_d_assert_failTxkZ__TQxTiZQBcFNaNbNi fMxAyaMKxkMxiZAya", referenced from: __D3std3uni__T9sliceBitsVmi0Vmi8ZQt__T6opCallTwZQkFNaNbNiNfwZk in pledged-test-unittest.o __D3std3uni__T9sliceBitsVmi8Vmi21ZQu__T6opCallTwZQkFNaNbNiNfwZk in pledged-test-unittest.o "__D4core8internal7dassert__T24miniFormatFakeAttributesTmZQB FNaNbNiNfMKxmZAya", referenced from: __D4core8internal7dassert__T14_d_assert_failTmZ__TQwTmZQBbFNaNbN NfMxAyaMKxmMKxmZAya in pledged-test-unittest.o __D4core8internal7dassert__T14_d_assert_failTmZ__TQwTmZQBbFNaNb iNfMxAyaMKxmMxmZAya in pledged-test-unittest.o __D4core8internal7dassert__T14_d_assert_failTmZ__TQwTmZQBbFNaNb iNfMxAyaMxmMKxmZAya in pledged-test-unittest.o __D4core8internal7dassert__T14_d_assert_failTmZ__TQwTiZQBbFNaN NiNfMxAyaMxmMxiZAya in pledged-test-unittest.o __D4core8internal7dassert__T14_d_assert_failTmZ__TQwTiZQBbFNaNb iNfMxAyaMKxmMxiZAya in pledged-test-unittest.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: /usr/bin/cc failed with status: 1 Error /Users/renato/dlang/ldc2-1.35.0-osx-universal/bin/ldc2 failed with exit code 1. (ldc-1.35.0) ``` You can see it was using the universal release. I even tried setting the LIBRARY_PATH and LD_LIBRARY_PATH to use `lib-arm64` and `lib-ios-x86_64` besides the obvious `lib-x86_64` but nothing worked. I'm afraid I've lost interest to make it work at this point :(ld: symbol(s) not found for architecture x86_64Make sure you're using the "osx-universal" package in order to have both arch. https://github.com/ldc-developers/ldc/releases/tag/v1.35.0 That said, for consumer software it may be a good idea to use eg: LDC 1.28 for x86_64 and LDC 1.35 for arm64 builds. You can stich the binaries together, which will give compatibility with all macOS from 10.12 up to Sonoma (well, if you also: codesign, notarize, make a DMG...).
Dec 22 2023
Some general advice: 1 - use `dub` from LDC's package (this may solve some arm64 vs x86 issues when on Apple Silicon CPU) 2 - when you use a new or different compiler, you have to rebuild _all_ packages. So clear your dub cache. I think point 2 is causing your issues. -Johan
Dec 22 2023
On Friday, 22 December 2023 at 17:50:47 UTC, Johan wrote:Some general advice: 1 - use `dub` from LDC's package (this may solve some arm64 vs x86 issues when on Apple Silicon CPU)``` ▶ which dub /Users/renato/dlang/ldc-1.35.0/bin/dub (ldc-1.35.0) ```2 - when you use a new or different compiler, you have to rebuild _all_ packages. So clear your dub cache. I think point 2 is causing your issues. -JohanNo, I removed `~/.dub/cache` and nothing changes. Unfortunately, nothing makes this work: ``` configuration "unittest" { dflags "-checkaction=context" } ``` If I remove this things work, but then assertion error messages suck.On Friday, 22 December 2023 at 17:45:27 UTC, Renato wrote:That's the first thing I did... without that, LDC still compiles , but logs a huge amount of things like this (it keeps going for a few hundred of these): ``` ld: warning: no platform load command found in '/Users/renato/.dub/cache/pledged/~master/build/pledged-test-unittest-unittest-n8f2nulDuB1X-8Gdil7wKw/pledg d-test-unittest.o', assuming: macOS ld: warning: no platform load command found in '/Users/renato/dlang/ldc-1.35.0/lib/libphobos2-ldc.a[2](curl.o)', assuming: macOS ld: warning: no platform load command found in '/Users/renato/dlang/ldc-1.35.0/lib/libphobos2-ldc.a[8](zlib.o)', assuming: macOS ld: warning: no platform load command found in '/Users/renato/dlang/ldc-1.35.0/lib/libphobos2-ldc.a[9](comparison.o)', assuming: macOS ld: warning: no platform load command found in '/Users/renato/dlang/ldc-1.35.0/lib/libphobos2-ldc.a[11](iteration.o)', assuming: macOS ld: warning: no platform load command found in '/Users/renato/dlang/ldc-1.35.0/lib/libphobos2-ldc.a[12](mutation.o)', assuming: macOS ld: warning: no platform load command found in '/Users/renato/dlang/ldc-1.35.0/lib/libphobos2-ldc.a[14](searching.o)', assuming: macOS ld: warning: no platform load command found in '/Users/renato/dlang/ldc-1.35.0/lib/libphobos2-ldc.a[16](sorting.o)', assuming: macOS ld: warning: no platform load command found in '/Users/renato/dlang/ldc-1.35.0/lib/libphobos2-ldc.a[17](array.o)', assuming: macOS ```I'm afraid I've lost interest to make it work at this point :(Did you add "-L-ld_classic"?
Dec 22 2023
I decided to continue with my struggles after all :). I found out now that this flag is only required on my Mac x86 (Macbook Air with Intel processor), but not on my Mac M1 (ARM), even though I am on the exact same MacOS version in both machines. So I had to do this on my dub file: ``` lflags "-ld_classic" platform="osx-x86_64" ``` That works fine locally. But unfortunately, this is causing my build on GitHub Actions to fail on `macos-latest` (the flag is not recognized: `ld: library not found for -ld_classic`). https://github.com/renatoathaydes/dzipper/actions/runs/7433575723/job/20226754138 I just had a quick look and GH Actions [seems to be using MacOS 12](https://github.blog/changelog/2022-10-03-github-actions-jobs-running-on-macos-latest-are-now-running-on-macos-12/). My laptops are using MacOS Sonoma (14.1.1). Does dub allow specifying not just the OS and architecture, but the OS version?? Probably not , right? This linker issue is such a messy problem to have.On Friday, 22 December 2023 at 17:45:27 UTC, Renato wrote:That's the first thing I did... without that, LDC still compiles , but logs a huge amount of things like this (it keeps going for a few hundred of these):I'm afraid I've lost interest to make it work at this point :(Did you add "-L-ld_classic"?
Jan 06
On Friday, 22 December 2023 at 17:50:47 UTC, Johan wrote:Some general advice: 1 - use `dub` from LDC's package (this may solve some arm64 vs x86 issues when on Apple Silicon CPU) 2 - when you use a new or different compiler, you have to rebuild _all_ packages. So clear your dub cache. I think point 2 is causing your issues. -JohanHi again, I hate to repeat myself, but the linker issues on MacOS keep happening, even after using this in the dub recipe: ``` lflags "-ld_classic" ``` Even though this helps, every now and then I am faced with a horrible error like this (happened on multiple projects): ``` ld: warning: pointer not aligned at address 0x10017FA3A ('anon' + 115 from ../../../.dub/cache/prettyprint/1.0.9/build/library-unittest-zRys5rzGP6krRGvFrhQ1nw/libprettyprint.a(primitives_64_42b.o)) ld: warning: pointer not aligned at address 0x10017FACD ('anon' + 115 from ../../../.dub/cache/prettyprint/1.0.9/build/library-unittest-zRys5rzGP6krRGvFrhQ1nw/libprettyprint.a(primitives_65_55a.o)) .... hundreds of lines just like this ld: warning: pointer not aligned at address 0x100199171 ('anon' + 117 from ../../../.dub/cache/tested/0.9.5/build/library-unittest-GNkuLeNnFlMZmRhvBdmNgA/libtested.a(lifetime_2ae_75b.o)) ld: unaligned pointer(s) for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: linker exited with status 1 Error /Users/renato/dlang/dmd-2.106.1/osx/bin/dmd failed with exit code 1. ``` It doesn't matter if I use LDC or DMD. Both cause the same error. I've tried cleaning the DUB cache like this: ``` rm -rf ~/.dub/cache ``` But it doesn't help. It's very frustrating because I'm close to finishing my project, but this kind of random error really delays me... it seems that as I keep changing code, the linker eventually starts working again! I must be hitting some "bad path" in the compiler. So, if anyone who understands about linking on MacOS could have a look, here's a commit on the project I'm currently working on which shows this problem: https://github.com/renatoathaydes/dzipper/commit/54d1f90f18a17d87d71195df68d02089ca4cf27c If you checkout this commit, just run `dub test` and you should see the problem on MacOS Sonoma. Notice that the current state of my code is "in progress" so some stuff may not even be working properly yet, the tests may not even be passing, that's fine (if I only I could run the tests)... but as the error is on the linker, I believe it's compiling properly and there should never be any linker errors like this.
Jan 20
On Saturday, 20 January 2024 at 20:35:16 UTC, Renato wrote:On Friday, 22 December 2023 at 17:50:47 UTC, Johan wrote:dub might not be passing this flag down to dependencies.. Try this env variable: ``LDFLAGS="$LDFLAGS -Wl,-ld_classic" dub build`` If that doesn't work, try this one: ``MACOSX_DEPLOYMENT_TARGET=11 dub build``Some general advice: 1 - use `dub` from LDC's package (this may solve some arm64 vs x86 issues when on Apple Silicon CPU) 2 - when you use a new or different compiler, you have to rebuild _all_ packages. So clear your dub cache. I think point 2 is causing your issues. -JohanHi again, I hate to repeat myself, but the linker issues on MacOS keep happening, even after using this in the dub recipe: ``` lflags "-ld_classic" ``` Even though this helps, every now and then I am faced with a horrible error like this (happened on multiple projects): ``` ld: warning: pointer not aligned at address 0x10017FA3A ('anon' + 115 from ../../../.dub/cache/prettyprint/1.0.9/build/library-unittest-zRys5rzGP6krRGvFrhQ1nw/libprettyprint.a(primitives_64_42b.o)) ld: warning: pointer not aligned at address 0x10017FACD ('anon' + 115 from ../../../.dub/cache/prettyprint/1.0.9/build/library-unittest-zRys5rzGP6krRGvFrhQ1nw/libprettyprint.a(primitives_65_55a.o)) .... hundreds of lines just like this ld: warning: pointer not aligned at address 0x100199171 ('anon' + 117 from ../../../.dub/cache/tested/0.9.5/build/library-unittest-GNkuLeNnFlMZmRhvBdmNgA/libtested.a(lifetime_2ae_75b.o)) ld: unaligned pointer(s) for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: linker exited with status 1 Error /Users/renato/dlang/dmd-2.106.1/osx/bin/dmd failed with exit code 1. ``` It doesn't matter if I use LDC or DMD. Both cause the same error. I've tried cleaning the DUB cache like this: ``` rm -rf ~/.dub/cache ``` But it doesn't help. It's very frustrating because I'm close to finishing my project, but this kind of random error really delays me... it seems that as I keep changing code, the linker eventually starts working again! I must be hitting some "bad path" in the compiler. So, if anyone who understands about linking on MacOS could have a look, here's a commit on the project I'm currently working on which shows this problem: https://github.com/renatoathaydes/dzipper/commit/54d1f90f18a17d87d71195df68d02089ca4cf27c If you checkout this commit, just run `dub test` and you should see the problem on MacOS Sonoma. Notice that the current state of my code is "in progress" so some stuff may not even be working properly yet, the tests may not even be passing, that's fine (if I only I could run the tests)... but as the error is on the linker, I believe it's compiling properly and there should never be any linker errors like this.
Jan 20
On Saturday, 20 January 2024 at 21:12:12 UTC, ryuukk_ wrote:dub might not be passing this flag down to dependencies.. Try this env variable: ``LDFLAGS="$LDFLAGS -Wl,-ld_classic" dub build``That didn't help.If that doesn't work, try this one: ``MACOSX_DEPLOYMENT_TARGET=11 dub build``This did work! Thanks. Any update on fixing the linker issues so that such workarounds won't be needed?
Jan 21
On Friday, 22 December 2023 at 17:45:27 UTC, Renato wrote:I'm afraid I've lost interest to make it work at this point :(Did you add "-L-ld_classic"?
Dec 22 2023
On Wednesday, 4 October 2023 at 11:01:08 UTC, Johan wrote:On Tuesday, 3 October 2023 at 23:55:05 UTC, confuzzled wrote:I've been holding off installing Sonoma, because of this. How does one use DUB with the linker fix?[...]Try passing `-ld_classic` to the linker. (`dmd -L-ld_classic`) https://github.com/ldc-developers/ldc/issues/4501#issuecomment-1738295459 -Johan
Dec 17 2023