Reputation: 4275
On my MacOS Sonoma I installed CLang-17 with the following command:
sudo port install clang-17
the command printed the following:
admin@son Downloads % sudo port install clang-17
Password:
---> Computing dependencies for clang-17
The following dependencies will be installed:
bzip2
cctools
clang_select
db48
gdbm
gettext-runtime
icu
ld64
ld64-xcode
libcxx
libedit
libffi
libiconv
libomp
libxml2
llvm-17
llvm_select
lz4
ncurses
openssl
openssl3
perl5
perl5.34
readline
xar
xz
zlib
zstd
Continue? [Y/n]:
---> Fetching archive for libcxx
---> Attempting to fetch libcxx-5.0.1_5.any_any.noarch.tbz2 from https://cph.dk.packages.macports.org/libcxx
---> Attempting to fetch libcxx-5.0.1_5.any_any.noarch.tbz2.rmd160 from https://cph.dk.packages.macports.org/libcxx
---> Installing libcxx @5.0.1_5
---> Activating libcxx @5.0.1_5
---> Cleaning libcxx
---> Fetching archive for libomp
---> Attempting to fetch libomp-18.1.2_1.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/libomp
---> Attempting to fetch libomp-18.1.2_1.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/libomp
---> Installing libomp @18.1.2_1
---> Activating libomp @18.1.2_1
---> Cleaning libomp
---> Fetching archive for clang_select
---> Attempting to fetch clang_select-2.3_0.any_any.noarch.tbz2 from https://cph.dk.packages.macports.org/clang_select
---> Attempting to fetch clang_select-2.3_0.any_any.noarch.tbz2.rmd160 from https://cph.dk.packages.macports.org/clang_select
---> Installing clang_select @2.3_0
---> Activating clang_select @2.3_0
---> Cleaning clang_select
---> Fetching archive for cctools
---> Attempting to fetch cctools-949.0.1_3+xcode.darwin_any.noarch.tbz2 from https://cph.dk.packages.macports.org/cctools
---> Attempting to fetch cctools-949.0.1_3+xcode.darwin_any.noarch.tbz2.rmd160 from https://cph.dk.packages.macports.org/cctools
---> Installing cctools @949.0.1_3+xcode
---> Activating cctools @949.0.1_3+xcode
---> Cleaning cctools
---> Fetching archive for libiconv
---> Attempting to fetch libiconv-1.17_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/libiconv
---> Attempting to fetch libiconv-1.17_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/libiconv
---> Installing libiconv @1.17_0
---> Activating libiconv @1.17_0
---> Cleaning libiconv
---> Fetching archive for icu
---> Attempting to fetch icu-74.2_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/icu
---> Attempting to fetch icu-74.2_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/icu
---> Installing icu @74.2_0
---> Activating icu @74.2_0
---> Cleaning icu
---> Fetching archive for zlib
---> Attempting to fetch zlib-1.3.1_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/zlib
---> Attempting to fetch zlib-1.3.1_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/zlib
---> Installing zlib @1.3.1_0
---> Activating zlib @1.3.1_0
---> Cleaning zlib
---> Fetching archive for gettext-runtime
---> Attempting to fetch gettext-runtime-0.22.5_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/gettext-runtime
---> Attempting to fetch gettext-runtime-0.22.5_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/gettext-runtime
---> Installing gettext-runtime @0.22.5_0
---> Activating gettext-runtime @0.22.5_0
---> Cleaning gettext-runtime
---> Fetching archive for xz
---> Attempting to fetch xz-5.4.6_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/xz
---> Attempting to fetch xz-5.4.6_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/xz
---> Installing xz @5.4.6_0
---> Activating xz @5.4.6_0
---> Cleaning xz
---> Fetching archive for libxml2
---> Attempting to fetch libxml2-2.12.6_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/libxml2
---> Attempting to fetch libxml2-2.12.6_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/libxml2
---> Installing libxml2 @2.12.6_0
---> Activating libxml2 @2.12.6_0
---> Cleaning libxml2
---> Fetching archive for libffi
---> Attempting to fetch libffi-3.4.6_1.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/libffi
---> Attempting to fetch libffi-3.4.6_1.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/libffi
---> Installing libffi @3.4.6_1
---> Activating libffi @3.4.6_1
---> Cleaning libffi
---> Fetching archive for ncurses
---> Attempting to fetch ncurses-6.4_1.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/ncurses
---> Attempting to fetch ncurses-6.4_1.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/ncurses
---> Installing ncurses @6.4_1
---> Activating ncurses @6.4_1
---> Cleaning ncurses
---> Fetching archive for libedit
---> Attempting to fetch libedit-20230828-3.1_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/libedit
---> Attempting to fetch libedit-20230828-3.1_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/libedit
---> Installing libedit @20230828-3.1_0
---> Activating libedit @20230828-3.1_0
---> Cleaning libedit
---> Fetching archive for llvm_select
---> Attempting to fetch llvm_select-2_1.any_any.noarch.tbz2 from https://cph.dk.packages.macports.org/llvm_select
---> Attempting to fetch llvm_select-2_1.any_any.noarch.tbz2.rmd160 from https://cph.dk.packages.macports.org/llvm_select
---> Installing llvm_select @2_1
---> Activating llvm_select @2_1
---> Cleaning llvm_select
---> Fetching archive for bzip2
---> Attempting to fetch bzip2-1.0.8_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/bzip2
---> Attempting to fetch bzip2-1.0.8_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/bzip2
---> Installing bzip2 @1.0.8_0
---> Activating bzip2 @1.0.8_0
---> Cleaning bzip2
---> Fetching archive for openssl3
---> Attempting to fetch openssl3-3.2.1_1.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/openssl3
---> Attempting to fetch openssl3-3.2.1_1.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/openssl3
---> Installing openssl3 @3.2.1_1
---> Activating openssl3 @3.2.1_1
---> Cleaning openssl3
---> Fetching archive for openssl
---> Attempting to fetch openssl-3_17.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/openssl
---> Attempting to fetch openssl-3_17.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/openssl
---> Installing openssl @3_17
---> Activating openssl @3_17
---> Cleaning openssl
---> Fetching archive for xar
---> Attempting to fetch xar-1.8.0.498_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/xar
---> Attempting to fetch xar-1.8.0.498_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/xar
---> Installing xar @1.8.0.498_0
---> Activating xar @1.8.0.498_0
---> Cleaning xar
---> Fetching archive for lz4
---> Attempting to fetch lz4-1.9.4_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/lz4
---> Attempting to fetch lz4-1.9.4_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/lz4
---> Installing lz4 @1.9.4_0
---> Activating lz4 @1.9.4_0
---> Cleaning lz4
---> Fetching archive for zstd
---> Attempting to fetch zstd-1.5.6_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/zstd
---> Attempting to fetch zstd-1.5.6_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/zstd
---> Installing zstd @1.5.6_0
---> Activating zstd @1.5.6_0
---> Cleaning zstd
---> Fetching archive for llvm-17
---> Attempting to fetch llvm-17-17.0.6_1.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/llvm-17
---> Attempting to fetch llvm-17-17.0.6_1.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/llvm-17
---> Installing llvm-17 @17.0.6_1
---> Activating llvm-17 @17.0.6_1
---> Cleaning llvm-17
---> Fetching archive for ld64-xcode
---> Attempting to fetch ld64-xcode-2_6.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/ld64-xcode
---> Attempting to fetch ld64-xcode-2_6.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/ld64-xcode
---> Installing ld64-xcode @2_6
---> Activating ld64-xcode @2_6
---> Cleaning ld64-xcode
---> Fetching archive for ld64
---> Attempting to fetch ld64-3_6+ld64_xcode.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/ld64
---> Attempting to fetch ld64-3_6+ld64_xcode.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/ld64
---> Installing ld64 @3_6+ld64_xcode
---> Activating ld64 @3_6+ld64_xcode
---> Cleaning ld64
---> Fetching archive for db48
---> Attempting to fetch db48-4.8.30_5.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/db48
---> Attempting to fetch db48-4.8.30_5.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/db48
---> Installing db48 @4.8.30_5
---> Activating db48 @4.8.30_5
---> Cleaning db48
---> Fetching archive for readline
---> Attempting to fetch readline-8.2.001_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/readline
---> Attempting to fetch readline-8.2.001_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/readline
---> Installing readline @8.2.001_0
---> Activating readline @8.2.001_0
---> Cleaning readline
---> Fetching archive for gdbm
---> Attempting to fetch gdbm-1.23_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/gdbm
---> Attempting to fetch gdbm-1.23_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/gdbm
---> Installing gdbm @1.23_0
---> Activating gdbm @1.23_0
---> Cleaning gdbm
---> Fetching archive for perl5.34
---> Attempting to fetch perl5.34-5.34.3_0.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/perl5.34
---> Attempting to fetch perl5.34-5.34.3_0.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/perl5.34
---> Installing perl5.34 @5.34.3_0
---> Activating perl5.34 @5.34.3_0
---> Cleaning perl5.34
---> Fetching archive for perl5
---> Attempting to fetch perl5-5.34.1_0+perl5_34.any_any.noarch.tbz2 from https://cph.dk.packages.macports.org/perl5
---> Attempting to fetch perl5-5.34.1_0+perl5_34.any_any.noarch.tbz2.rmd160 from https://cph.dk.packages.macports.org/perl5
---> Installing perl5 @5.34.1_0+perl5_34
---> Activating perl5 @5.34.1_0+perl5_34
---> Cleaning perl5
---> Fetching archive for clang-17
---> Attempting to fetch clang-17-17.0.6_1+analyzer.darwin_23.x86_64.tbz2 from https://cph.dk.packages.macports.org/clang-17
---> Attempting to fetch clang-17-17.0.6_1+analyzer.darwin_23.x86_64.tbz2.rmd160 from https://cph.dk.packages.macports.org/clang-17
---> Installing clang-17 @17.0.6_1+analyzer
---> Activating clang-17 @17.0.6_1+analyzer
---> Cleaning clang-17
---> Updating database of binaries
---> Scanning binaries for linking errors
---> No broken files found.
---> No broken ports found.
---> Some of the ports you installed have notes:
db48 has the following notes:
The Java and Tcl bindings are now provided by the db48-java and
db48-tcl subports.
libomp has the following notes:
To use this OpenMP library:
* For clang-3.8+, or clang-3.7 with +openmp variant:
add "-fopenmp" during compilation / linking.
* For clang-3.7 without +openmp variant, use:
"-I/opt/local/include/libomp -L/opt/local/lib/libomp -fopenmp"
but clang
command still runs Clang-15 previously installed with XCode:
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Clang-17 is located in /opt/local/libexec/llvm-17/bin
directory:
cd /opt/local/libexec/llvm-17/bin
./clang --version
clang version 17.0.6
Target: x86_64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-17/bin/.
How do I switch between two Clang versions?
And is it possible to make XCode and CMake work with Clang 17?
Tried
sudo port select --set clang mp-clang-17
Selecting 'mp-clang-17' for 'clang' succeeded. 'mp-clang-17' is now active.
but clang
command is still runs Clang 15:
clang --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Upvotes: 1
Views: 110