#67686 closed defect (fixed)

clang-16 @16.0.6_0: links to compiler runtime libraries using wrong path

Reported by: chrstphrchvz (Christopher Chavez) Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: mascguy (Christopher Nielsen), cjones051073 (Chris Jones)
Port: clang-16

Description

Observed on macOS 10.13 and macOS 12. Example: running a program compiled with clang-mp-16 -fsanitize=address will error:

dyld: Library not loaded: /opt/local/libexec/llvm-16/lib/libclang_rt.asan_osx_dynamic.dylib
  Referenced from: a.out
  Reason: image not found

because the library is actually located here:

/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.asan_osx_dynamic.dylib

Change History (12)

comment:1 Changed 17 months ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:2 Changed 17 months ago by jmroot (Joshua Root)

Cc: cjones051073 added

comment:3 Changed 17 months ago by cjones051073 (Chris Jones)

Can you please report this upstream, as it looks like a LLVM bug to me. In the port file we do nothing special with the sanitizers, other than turn them off for OSX10.11 and older. Of course, we *could* work around it in the port file, in a post-destroot block, but I would prefer not to unless there is no other option.

comment:4 Changed 17 months ago by cjones051073 (Chris Jones)

Small update. Issue is only with clang-16. clang-15 works fine

Oberon ~/cernbox/MacPorts/c++17 > clang++-mp-15 --std=c++17 -fsanitize=address ./test.cpp
Oberon ~/cernbox/MacPorts/c++17 > ./a.out                                                
a.out(15346,0x10fa0a600) malloc: nano zone abandoned due to inability to preallocate reserved vm space.
variant<int> = 42
test_variant: bad_variant_access
optional i = 321
i: 1
d: 3.14
b: 1
PKc: FooBar
▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─
▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─
▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄
▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀
▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─▀▄─
▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─▄▀─
all types in pack are T
not all types in pack are T
1 2.3
-2 2.3
-2147483648 0
2147483647 -1
Oberon ~/cernbox/MacPorts/c++17 > otool -L ./a.out                                       
./a.out:
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
	@rpath/libclang_rt.asan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)

So clang-15 use @rpath , whilst clang-16 a hardocded fixed path.

Both ports files for llvm 15 and 16 do exactly the same thing w.r.t. rpath.

( b.t.w. the output above from a.out is what I expect, this is a small standalone test I have for numerous c++17 features. )

Last edited 17 months ago by cjones051073 (Chris Jones) (previous) (diff)

comment:5 Changed 17 months ago by chrstphrchvz (Christopher Chavez)

Would also note that clang-devel @20230321-54ab9541_1 does not have this issue.

comment:6 Changed 17 months ago by cjones051073 (Chris Jones)

clang-devel is a little behind at the moment, so likely older than the latest 16.0.x release.

Did you happen to notice if older 16.0.x versions had the issue or not ?

comment:7 in reply to:  6 Changed 17 months ago by chrstphrchvz (Christopher Chavez)

Replying to cjones051073:

clang-devel is a little behind at the moment, so likely older than the latest 16.0.x release.

Did you happen to notice if older 16.0.x versions had the issue or not ?

I am not certain whether it was present in earlier versions, except for 16.0.5 which did have the issue.

comment:8 Changed 17 months ago by kencu (Ken)

llvm seems to have the proper @rpath links:

% port contents llvm-16 | grep dylib | xargs otool -L
/opt/local/libexec/llvm-16/lib/LLVMPolly.dylib:
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libLLVM.dylib:
	@rpath/libLLVM.dylib (compatibility version 1.0.0, current version 16.0.6)
	/opt/local/lib/libffi.8.dylib (compatibility version 10.0.0, current version 10.2.0)
	/opt/local/lib/libedit.0.dylib (compatibility version 1.0.0, current version 1.70.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.13)
	/opt/local/lib/libzstd.1.dylib (compatibility version 1.0.0, current version 1.5.5)
	/opt/local/lib/libncurses.6.dylib (compatibility version 6.0.0, current version 6.0.0)
	/opt/local/lib/libxml2.2.dylib (compatibility version 13.0.0, current version 13.4.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
/opt/local/libexec/llvm-16/lib/libLTO.dylib:
	@rpath/libLTO.dylib (compatibility version 1.0.0, current version 16.0.6)
	@rpath/libLLVM.dylib (compatibility version 1.0.0, current version 16.0.6)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libRemarks.dylib:
	@rpath/libRemarks.dylib (compatibility version 1.0.0, current version 16.0.6)
	@rpath/libLLVM.dylib (compatibility version 1.0.0, current version 16.0.6)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)

but for clang's libs, only some of them are using @rpath, which is on the face of it a bit odd. All the clang libraries in the clang runtime are using full pathnames instead.

% port contents clang-16 | grep dylib | xargs otool -L
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.asan_osx_dynamic.dylib (architecture x86_64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.asan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.asan_osx_dynamic.dylib (architecture x86_64h):
	/opt/local/libexec/llvm-16/lib/libclang_rt.asan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.asan_osx_dynamic.dylib (architecture arm64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.asan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.lsan_osx_dynamic.dylib (architecture x86_64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.lsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.lsan_osx_dynamic.dylib (architecture x86_64h):
	/opt/local/libexec/llvm-16/lib/libclang_rt.lsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.lsan_osx_dynamic.dylib (architecture arm64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.lsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.stats_osx_dynamic.dylib (architecture x86_64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.stats_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0, weak)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.stats_osx_dynamic.dylib (architecture x86_64h):
	/opt/local/libexec/llvm-16/lib/libclang_rt.stats_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0, weak)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.stats_osx_dynamic.dylib (architecture arm64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.stats_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0, weak)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib (architecture x86_64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.tsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib (architecture x86_64h):
	/opt/local/libexec/llvm-16/lib/libclang_rt.tsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib (architecture arm64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.tsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_minimal_osx_dynamic.dylib (architecture x86_64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.ubsan_minimal_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_minimal_osx_dynamic.dylib (architecture x86_64h):
	/opt/local/libexec/llvm-16/lib/libclang_rt.ubsan_minimal_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_minimal_osx_dynamic.dylib (architecture arm64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.ubsan_minimal_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib (architecture x86_64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.ubsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib (architecture x86_64h):
	/opt/local/libexec/llvm-16/lib/libclang_rt.ubsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib (architecture arm64):
	/opt/local/libexec/llvm-16/lib/libclang_rt.ubsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libClangdXPCLib.dylib:
	@rpath/libClangdXPCLib.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libLLVM.dylib (compatibility version 1.0.0, current version 16.0.6)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libc++.1.0.dylib:
	@rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/libexec/llvm-16/lib/libc++.1.dylib:
	@rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/libexec/llvm-16/lib/libc++.dylib:
	@rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/libexec/llvm-16/lib/libc++abi.1.0.dylib:
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libc++abi.1.dylib:
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libc++abi.dylib:
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libclang-cpp.dylib:
	@rpath/libclang-cpp.dylib (compatibility version 0.0.0, current version 0.0.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1228.0.0)
	@rpath/libLLVM.dylib (compatibility version 1.0.0, current version 16.0.6)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1971.0.0)
/opt/local/libexec/llvm-16/lib/libclang.dylib:
	@rpath/libclang.dylib (compatibility version 1.0.0, current version 16.0.6)
	@rpath/libLLVM.dylib (compatibility version 1.0.0, current version 16.0.6)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)

perhaps this commit here is culprit:

https://github.com/llvm/llvm-project/commit/b98da4c71edda3df0a0555b1ab63ec52e92252b4

comment:9 Changed 17 months ago by cjones051073 (Chris Jones)

Thanks Ken. If I compare the sanitiser libs specifically, between clang 15 and 16 I see

Oberon ~/Projects/MacPorts/ports > port contents clang-15 | grep dylib | grep san_osx | xargs otool -L
/opt/local/libexec/llvm-15/lib/clang/15.0.7/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:
	@rpath/libclang_rt.asan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.23.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1300.23.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
/opt/local/libexec/llvm-15/lib/clang/15.0.7/lib/darwin/libclang_rt.lsan_osx_dynamic.dylib:
	@rpath/libclang_rt.lsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.23.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1300.23.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
/opt/local/libexec/llvm-15/lib/clang/15.0.7/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib:
	@rpath/libclang_rt.tsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.23.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1300.23.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/opt/local/libexec/llvm-15/lib/clang/15.0.7/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib:
	@rpath/libclang_rt.ubsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.23.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1300.23.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
Oberon ~/Projects/MacPorts/ports > port contents clang-16 | grep dylib | grep san_osx | xargs otool -L
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.asan_osx_dynamic.dylib:
	/opt/local/libexec/llvm-16/lib/libclang_rt.asan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1300.36.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.lsan_osx_dynamic.dylib:
	/opt/local/libexec/llvm-16/lib/libclang_rt.lsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1300.36.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib:
	/opt/local/libexec/llvm-16/lib/libclang_rt.tsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1300.36.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib:
	/opt/local/libexec/llvm-16/lib/libclang_rt.ubsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1300.36.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)

so clang-15 uses rpath, clang 16 does not.

That in itself would be OK, if the paths where actually correct, but they aren't as per the original issue reported here.

That LLVM commit is for sure fiddling in the right sort of area..

Last edited 17 months ago by cjones051073 (Chris Jones) (previous) (diff)

comment:10 Changed 17 months ago by kencu (Ken)

the commit I mentioned seems to be a bit later on than our clang 16.0.6 sources.

just reverting the first bit of it was needed.

I know you said you wanted it discussed upstream, but I'm not prepared to take on that task, so I'll just generate a PR with the reversion I used and you can use that if you like, or take it upstream if you want to (that will be a messy discussion).

% port contents clang-16 | grep dylib | xargs otool -L
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.asan_osx_dynamic.dylib (architecture x86_64):
	@rpath/libclang_rt.asan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.asan_osx_dynamic.dylib (architecture x86_64h):
	@rpath/libclang_rt.asan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.asan_osx_dynamic.dylib (architecture arm64):
	@rpath/libclang_rt.asan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.lsan_osx_dynamic.dylib (architecture x86_64):
	@rpath/libclang_rt.lsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.lsan_osx_dynamic.dylib (architecture x86_64h):
	@rpath/libclang_rt.lsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.lsan_osx_dynamic.dylib (architecture arm64):
	@rpath/libclang_rt.lsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.stats_osx_dynamic.dylib (architecture x86_64):
	@rpath/libclang_rt.stats_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0, weak)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.stats_osx_dynamic.dylib (architecture x86_64h):
	@rpath/libclang_rt.stats_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0, weak)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.stats_osx_dynamic.dylib (architecture arm64):
	@rpath/libclang_rt.stats_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0, weak)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib (architecture x86_64):
	@rpath/libclang_rt.tsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib (architecture x86_64h):
	@rpath/libclang_rt.tsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib (architecture arm64):
	@rpath/libclang_rt.tsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_minimal_osx_dynamic.dylib (architecture x86_64):
	@rpath/libclang_rt.ubsan_minimal_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_minimal_osx_dynamic.dylib (architecture x86_64h):
	@rpath/libclang_rt.ubsan_minimal_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_minimal_osx_dynamic.dylib (architecture arm64):
	@rpath/libclang_rt.ubsan_minimal_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib (architecture x86_64):
	@rpath/libclang_rt.ubsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib (architecture x86_64h):
	@rpath/libclang_rt.ubsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/clang/16/lib/darwin/libclang_rt.ubsan_osx_dynamic.dylib (architecture arm64):
	@rpath/libclang_rt.ubsan_osx_dynamic.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libClangdXPCLib.dylib:
	@rpath/libClangdXPCLib.dylib (compatibility version 0.0.0, current version 0.0.0)
	@rpath/libLLVM.dylib (compatibility version 1.0.0, current version 16.0.6)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libc++.1.0.dylib:
	@rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/libexec/llvm-16/lib/libc++.1.dylib:
	@rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/libexec/llvm-16/lib/libc++.dylib:
	@rpath/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/libexec/llvm-16/lib/libc++abi.1.0.dylib:
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libc++abi.1.dylib:
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libc++abi.dylib:
	@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
/opt/local/libexec/llvm-16/lib/libclang-cpp.dylib:
	@rpath/libclang-cpp.dylib (compatibility version 0.0.0, current version 0.0.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1228.0.0)
	@rpath/libLLVM.dylib (compatibility version 1.0.0, current version 16.0.6)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1971.0.0)
/opt/local/libexec/llvm-16/lib/libclang.dylib:
	@rpath/libclang.dylib (compatibility version 1.0.0, current version 16.0.6)
	@rpath/libLLVM.dylib (compatibility version 1.0.0, current version 16.0.6)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)

comment:11 Changed 17 months ago by kencu (Ken)

https://github.com/macports/macports-ports/pull/19293

% clang-mp-16 -fsanitize=address hello.c

% ./a.out                               
a.out(53915,0x1e3a89e00) malloc: nano zone abandoned due to inability to reserve vm space.
Hello, World
Last edited 17 months ago by kencu (Ken) (previous) (diff)

comment:12 Changed 17 months ago by kencu (Ken)

Owner: set to kencu
Resolution: fixed
Status: newclosed

In 591281e65e78a032c11b8d39bf1e82a617ad2ab5/macports-ports (master):

clang-16: revert change that breaks rpath linkages in clang runtime

closes: #67686

Note: See TracTickets for help on using tickets.