[MacPorts] #62426: libc++: using a newer libc++ to build software on older macos systems
MacPorts
noreply at macports.org
Fri Mar 12 02:22:21 UTC 2021
#62426: libc++: using a newer libc++ to build software on older macos systems
--------------------------+----------------------
Reporter: kencu | Owner: kencu
Type: enhancement | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: libcxx |
--------------------------+----------------------
Comment (by kencu):
to use dylib linking, you do it like this:
{{{
/usr/bin/clang++ -std=c++17 -D_LIBCPP_DISABLE_AVAILABILITY
-L/opt/local/libexec/llvm-11/lib/
-Wl,-rpath,/opt/local/libexec/llvm-11/lib/ fstest.cpp
}}}
Then the binary comes with this:
{{{
$ otool -L a.out
a.out:
@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 1252.250.1)
}}}
The @rpath search path is set correctly:
{{{
Load command 12
cmd LC_LOAD_DYLIB
cmdsize 48
name @rpath/libc++.1.dylib (offset 24)
time stamp 2 Wed Dec 31 16:00:02 1969
current version 1.0.0
compatibility version 1.0.0
Load command 13
cmd LC_LOAD_DYLIB
cmdsize 56
name /usr/lib/libSystem.B.dylib (offset 24)
time stamp 2 Wed Dec 31 16:00:02 1969
current version 1252.250.1
compatibility version 1.0.0
Load command 14
cmd LC_RPATH
cmdsize 48
path /opt/local/libexec/llvm-11/lib/ (offset 12)
}}}
and the binary works:
{{{
$ ./a.out
Displaying path info for: "/Users/kencu"
path part: 0 = "/"
path part: 1 = "Users"
path part: 2 = "kencu"
exists() = 1
root_name() = ""
root_path() = "/"
relative_path() = "Users/kencu"
parent_path() = "/Users"
filename() = "kencu"
stem() = "kencu"
extension() = ""
canonical() = "/Users/kencu"
path concat/append:
"C:\\temp/user/data"
"C:\\temp\\userdata"
}}}
--
Ticket URL: <https://trac.macports.org/ticket/62426#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list