dlang / dub

Package and build management system for D
MIT License
673 stars 230 forks source link

Unittest linking fails for MacOS 13.4 x86-64 #2649

Closed andrewlalis closed 1 year ago

andrewlalis commented 1 year ago

System information

Bug Description

Running dub test fails in the linking step.

How to reproduce?

  1. Use MacOS 13.4 on an Intel x86-64 architecture
  2. Install the latest DMD compiler.
  3. Install dub via brew install dub
  4. Clone https://github.com/andrewlalis/streams
  5. Run dub test in that project.

Expected Behavior

I would expect the tests to be linked and run without issue. For example, my project's CI is able to run unittests successfully in this job: https://github.com/andrewlalis/streams/actions/runs/5099678155/jobs/9167527072 with MacOS 12.6.5

Logs

andrew.lalis@C02GG1DPMD6T streams % dub test -v              
Using dub registry url 'https://code.dlang.org/'
Determined package version using GIT: streams 2.0.0
             Generating test runner configuration 'streams-test-standard' for 'standard' (library).
Get module name from path: /Users/andrew.lalis/andrewlalis-github/streams/source/streams/functions.d
Get module name from path: /Users/andrew.lalis/andrewlalis-github/streams/source/streams/interfaces.d
Excluding package.d file from test due to https://issues.dlang.org/show_bug.cgi?id=11847
Get module name from path: /Users/andrew.lalis/andrewlalis-github/streams/source/streams/primitives.d
Get module name from path: /Users/andrew.lalis/andrewlalis-github/streams/source/streams/range.d
Get module name from path: /Users/andrew.lalis/andrewlalis-github/streams/source/streams/types/array.d
Get module name from path: /Users/andrew.lalis/andrewlalis-github/streams/source/streams/types/buffered.d
Get module name from path: /Users/andrew.lalis/andrewlalis-github/streams/source/streams/types/chunked.d
Get module name from path: /Users/andrew.lalis/andrewlalis-github/streams/source/streams/types/data.d
Get module name from path: /Users/andrew.lalis/andrewlalis-github/streams/source/streams/types/file.d
Get module name from path: /Users/andrew.lalis/andrewlalis-github/streams/source/streams/types/socket.d
Get module name from path: /Users/andrew.lalis/andrewlalis-github/streams/source/streams/utils.d
Configuring dependent streams, deps:
    Starting Performing "unittest" build using dmd for x86_64.
Target '/Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard' doesn't exist, need rebuild.
    Building streams 2.0.0: building configuration [streams-test-standard]
[cwd=/Users/andrew.lalis/andrewlalis-github/streams] dmd -c -of/Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o -debug -g -unittest -w -version=Have_streams -Isource/ -I../../.dub/cache/streams/2.0.0/code/streams-test-standard-unittest-2pdSlm0X8cUQJFLcXX4oPg ../../.dub/cache/streams/2.0.0/code/streams-test-standard-unittest-2pdSlm0X8cUQJFLcXX4oPg/dub_test_root.d source/streams/functions.d source/streams/interfaces.d source/streams/package.d source/streams/primitives.d source/streams/range.d source/streams/types/array.d source/streams/types/buffered.d source/streams/types/chunked.d source/streams/types/data.d source/streams/types/file.d source/streams/types/package.d source/streams/types/socket.d source/streams/utils.d -vcolumns
     Linking streams-test-standard
[cwd=/Users/andrew.lalis/andrewlalis-github/streams] dmd -of/Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o -g
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: 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: 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 0x1000CC312 ('anon' + 786 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CC32A ('anon' + 810 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CC3E7 ('anon' + 999 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CC4CF ('anon' + 1231 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CC7C3 ('anon' + 1987 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CC93E ('anon' + 2366 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CCBE2 ('anon' + 3042 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CCC97 ('anon' + 3223 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CD453 ('anon' + 5203 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CDA89 ('anon' + 6793 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CDF31 ('anon' + 7985 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CE1DE ('anon' + 8670 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CE396 ('anon' + 9110 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CE931 ('anon' + 10545 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.o)
ld: warning: pointer not aligned at address 0x1000CEAB9 ('anon' + 10937 from /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg/streams-test-standard.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
FAIL /Users/andrew.lalis/.dub/cache/streams/2.0.0/build/streams-test-standard-unittest--sdOFeRx4VH6W5Nd-WkPAg streams-test-standard executable
Error dmd failed with exit code 1.
rikkimax commented 1 year ago

Known compiler issue.

A possible workaround:

https://forum.dlang.org/post/tna5a5$pra$2@digitalmars.com

https://github.com/ldc-developers/ldc/issues/3864

I'm not finding anything for dmd on N.G.

andrewlalis commented 1 year ago

Thanks @rikkimax, for the sake of this issue, I'll note that adding

export MACOSX_DEPLOYMENT_TARGET=12

to my environment solved the issue.