www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24122] New: Unable to link with Xcode 15

https://issues.dlang.org/show_bug.cgi?id=24122

          Issue ID: 24122
           Summary: Unable to link with Xcode 15
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: trnsz pobox.com

Using macOS 13.5 (Intel), Darwin 22.6.0, and DMD64 v2.105.0, with Xcode 15
Beta, I am not able to link an executable from DMD compiled modules.

Here's the output as an example - sirtests.o was the object compiled with DMD64
(betterC mode, though regular D runtime things give the same error message):

$ cc --version                                                                  
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir:
/Applications/Xcode-15.0.0-Beta.7.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Note that this command is the exact command the DMD compiler issues to link:

$ cc ../build/bin/sirtests.o -o ../build/bin/sirtests -m64 -Xlinker
-no_compact_unwind -L/usr/local/opt/dmd/lib -lpthread -lm

0  0x10a744f63  __assert_rtn + 64
1  0x10a68019a  ld::atomShouldReplaceExisting(ld::Atom const&, ld::Atom const&,
bool&) + 954
2  0x10a67fc1d  ld::AtomSymbolTable::chooseAtom(ld::Atom const*, ld::Atom
const*) const + 45
3  0x10a68746e  ld::AtomSymbolTable::addAtomByName(ld::Atom const*,
ld::SymbolString const*) + 238
4  0x10a70d189  ___ZN2ld20AtomFileConsolidator10parseFilesEb_block_invoke + 601
5  0x10a673ba0  ld::InputFiles::parseAllFiles(void (ld::AtomFile const*)
block_pointer)::$_7::operator()(unsigned long, ld::FileInfo const&) const + 672
6  0x7ff8071ed066  _dispatch_client_callout2 + 8
7  0x7ff80720018f  _dispatch_apply_invoke_and_wait + 213
8  0x7ff8071ff692  _dispatch_apply_with_attr_f + 1207
9  0x7ff8071ff847  dispatch_apply + 45
10  0x10a70c992  ld::AtomFileConsolidator::parseFiles(bool) + 370
11  0x10a693d87  main + 12263

ld: Assertion failed: (existingFile != newFile && "malformed atom files with
duplicate names"), function atomShouldReplaceExisting, file
AtomSymbolTable.cpp, line 203.

-------

Since I have Xcode 14.3.1 installed also, so switching to it, and now you can
link things:

$ sudo xcode-select -s /Applications/Xcode-14.3.1.app

$ cc --version
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir:
/Applications/Xcode-14.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ cc ../build/bin/sirtests.o -o ../build/bin/sirtests -m64 -Xlinker
-no_compact_unwind -L/usr/local/opt/dmd/lib -lpthread -lm  

$ file ../build/bin/sirtests                                        
../build/bin/sirtests: Mach-O 64-bit executable x86_64

So in short, something changed with Xcode 15 that makes it compatible with DMD.
 This is probably important to fix, because once Xcode 15 is released, 14 will
be EOL quickly and DMD will no longer function on macOS.

--
Aug 30 2023