macOS - saprykin/plibsys GitHub Wiki
Configurations
Version | Compilers | Status | Tests |
---|---|---|---|
Sequoia 15.1.0 (M2) | GCC 14.2.0 (AArch64) | Compiled | Passed |
Sequoia 15.1.0 (M2) | Apple Clang 16.0.0 (AArch64) | Compiled | Passed |
Use DYLD_LIBRARY_PATH
variable instead of LD_LIBRARY_PATH
.
GCC (Apple GCC)
You should not have any problems compiling with GCC.
Clang (Apple Clang)
Apple Clang compiler comes with Xcode, all other required packages can be downloaded (or built) using MacPorts or Homebrew.
On older macOS systems you may have Apple GCC instead of Apple Clang.
Intel
For Intel C/C++ compiler you need to prepare development environment first. Run command like source /opt/intel/bin/iccvars.sh intel64
with appropriate target architecture (or you will risk to get license errors and broken compiler). After that you should pass compiler parameters to CMake: -DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc
.
Note. After Apple moved to Apple Silicon chips, Intel is shutting down support for macOS in its compilers, and as of the second half of 2023, support for classic Intel compilers (ICC) is to be dropped for macOS.
PGI
PGI compiler supports only x86 shared libraries on macOS so you should use either x86 version of the compiler or pass it -m32
flag. You also need the latest CMake version (at least 3.8.0) as PGI support was improved.
Note. Starting from version 17.4 x86 support was removed. It means that you are no longer able to compile shared libraries on macOS with PGI compiler.
Note. In version 18.4 support for x64 shared libraries on macOS is there.
If you are upgrading your Xcode version after PGI installation, you need to either reinstall PGI or adjust include paths to a new version in localrc
file located in PGI's bin
directory. The best way to do that is to run makelocalrc
script located in the PGI's bin
directory, i.e.:
sudo /opt/pgi/osx86/2016/bin/makelocalrc /opt/pgi/osx86/16.10 -l /opt/pgi/license.dat -x
You need to run this for each of the compiler versions installed.
Starting from Xcode 8.3.x there are potential changes which affect PGI 16.10 linking, thus it is recommended to stick with Xcode 8.2.x for PGI compiler.