MacOS compilation error: symbol(s) not found for architecture x86_64 || Undefined symbols for architecture x86_64:

1. Problem description

When I compile, I get an error symbol(s) not found for architecture x86_64.

2. Solution

The reason is that the computer is an ARM architecture (Mac with M1 chip), and the specified library is downloaded under the x86 architecture.
So I reused arm's homebrew (I named it abrew to distinguish it from x86's ibrew), downloaded the relevant libraries and specified the path to the netcdf-fortran library, and then recompiled.

abrew install netcdf-fortran

The homebrewde installation path of arm is different from the installation path of x86, which is located under /opt/homebrew/

/opt/homebrew/Cellar/netcdf-fortran/4.6.0/

Guess you like

Origin blog.csdn.net/weixin_44547510/article/details/131244373