Missing libclang_rt.osx.a library on OSX

I tried to install the flang-new compiler from Homebrew on Sequoia OSX. Complex division is broken because file divdc3 is missing. This file comes from libclang_rt.osx.a, a standard LLVM library. This library is missing on OSX.

program test integer, parameter :: n=2 complex(kind=8), dimension(n,n) :: V complex(kind=8) :: PER V(1,1)=cmplx(4.0,2.0) V(2,2)=cmplx(5.0,3.0) V(1,2)=0.0 V(2,1)=0.5 PER=cmplx(1.2,1.2) V(:,:)=V(:,:)/PER end program test

alainhebert@Alains-MacBook-Air-2 test_complex % flang-new test.f90

Undefined symbols for architecture arm64:

“___divdc3”, referenced from:

__QQmain in test-fc2bb3.o

ld: symbol(s) not found for architecture arm64

flang-new: error: linker command failed with exit code 1 (use -v to see invocation)

This library is missing on [macOS].

Can you clarify what you mean by mean by “missing”?

A .a file is a static library, which isn’t something we ship on macOS proper. Such libraries usually ship as part of the SDKs or toolchain within Xcode. And that file is in fact present in Xcode 16.1:

% find /Applications/Xcode.app/Contents -name "libclang_rt.osx.a"
…/XcodeDefault.xctoolchain/usr/lib/clang/16/lib/darwin/libclang_rt.osx.a

It even includes the symbol you’re looking for:

% nm "…/XcodeDefault.xctoolchain/usr/lib/clang/16/lib/darwin/libclang_rt.osx.a" | grep "divdc3"
…/XcodeDefault.xctoolchain/usr/lib/clang/16/lib/darwin/libclang_rt.osx.a(divdc3.c.o):
0000000000000000 T ___divdc3

As to why the Flang you installed is missing it — or perhaps it’s failing to find Apple’s one? — you’re more likely to get an answer to that via the support challenge for that tool.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

You are right. The following command is successful:

flang-new *.f90 /System/Volumes/Data/Library/Developer/CommandLineTools/usr/lib/clang/16/lib/darwin/libclang_rt.osx.a

Is there a more simple way to perform the link? I don't see this directory in the default PATH.

Missing libclang_rt.osx.a library on OSX
 
 
Q