Xiao-Le Deng

Mac下ifort出现ld: library not found for -lSystem问题

2021-01-11 13:00
#Linux #Skills #Fortran

1. 前言

Mac安装Intel Parallel Studio XE Composer Edition for Fortran中,简介了Mac下安装ifort的过程。

使用ifort时,出现如下错误:

"ld: library not found for -lSystem"

2. 解决方案

系统信息为:

macOS Big Sur 11.0.1

ifort版本为:

$ ifort -V
Intel(R) Fortran Intel(R) 64 Compiler for applications running on 
Intel(R) 64, Version 19.1.2.258 Build 20200623
Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.

短期解决措施:在ifort编译时加上lib的路径:

ifort -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib

长期解决措施:在~/.zshrc~/.bashrc写入:

alias ifort='ifort -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib'

说明:更新后的macOS系统的lib不在默认路径下面,即the lib is now not under the default path.

3. 参考