-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the bug
We have recently switched to meson for building dynare, an industry-leading software used by many central banks, economic policy and research institutions as well as universities.
All was good with Xcode Command Line Tools (CLT) 14.3.1, but recently I updated to Xcode CLT 15.0 and now I get an error ld: unknown options: --version when detecting linker for compiler gfortran -Wl,--version`:
The Meson build system
Version: 1.2.1
Source dir: /Users/wmutschl/dynare/irf-matching/irf-matching
Build dir: /Users/wmutschl/dynare/irf-matching/irf-matching/build-matlab
Build type: native build
Project name: dynare
Project version: 6-unstable
meson.build:12:0: ERROR: Unable to detect linker for compiler `gfortran -Wl,--version -L/var/folders/b0/t0gqszsj5qg8mvpk7fqy0f7h0000gn/T/tmp.cH3j0LwS`
stdout:
stderr: collect2 version 13.2.0
/usr/bin/ld -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/ -dynamic -arch x86_64 -platform_version macos 13.0.0 0.0 -o a.out -L/var/folders/b0/t0gqszsj5qg8mvpk7fqy0f7h0000gn/T/tmp.cH3j0LwS -L/usr/local/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13 -L/usr/local/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc -L/usr/local/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13/../../.. --version -lemutls_w -lgcc -lSystem -no_compact_unwind -rpath @loader_path -rpath /usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc/x86_64-apple-darwin22/13 -rpath /usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc -rpath /usr/local/Cellar/gcc/13.2.0/lib/gcc/current
ld: unknown options: --version
collect2: error: ld returned 1 exit status
Here is the output of meson-log.txt:
# cat /Users/wmutschl/dynare/unstable/build-matlab/meson-logs/meson-log.txt
Build started at 2023-09-21T08:24:25.638781
Main binary: /usr/local/opt/[email protected]/bin/python3.11
Build Options: -Dmatlab_path=/Applications/MATLAB/x86_64/MATLAB_R2023a.app -Dbuildtype=debugoptimized '-Dfortran_args=['"'"'-B'"'"','"'"'/Users/wmutschl/dynare/slicot/lib'"'"']' --native-file=scripts/homebrew-native.ini
Python system: Darwin
The Meson build system
Version: 1.2.1
Source dir: /Users/wmutschl/dynare/unstable
Build dir: /Users/wmutschl/dynare/unstable/build-matlab
Build type: native build
Project name: dynare
Project version: 6-unstable
-----------
Detecting compiler via: `gfortran --version` -> 0
stdout:
GNU Fortran (Homebrew GCC 13.2.0) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------
Running command: gfortran -E -dM -
-----
-----------
Detecting linker via: `gfortran -Wl,--version` -> 1
stderr:
collect2 version 13.2.0
/usr/bin/ld -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/ -dynamic -arch x86_64 -platform_version macos 13.0.0 0.0 -o a.out -L/usr/local/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13 -L/usr/local/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc -L/usr/local/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13/../../.. --version -lemutls_w -lgcc -lSystem -no_compact_unwind -rpath @loader_path -rpath /usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc/x86_64-apple-darwin22/13 -rpath /usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc -rpath /usr/local/Cellar/gcc/13.2.0/lib/gcc/current
ld: unknown options: --version
collect2: error: ld returned 1 exit status
-----------
meson.build:12:0: ERROR: Unable to detect linker for compiler `gfortran -Wl,--version`
stdout:
stderr: collect2 version 13.2.0
/usr/bin/ld -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/ -dynamic -arch x86_64 -platform_version macos 13.0.0 0.0 -o a.out -L/usr/local/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13 -L/usr/local/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc -L/usr/local/Cellar/gcc/13.2.0/bin/../lib/gcc/current/gcc/x86_64-apple-darwin22/13/../../.. --version -lemutls_w -lgcc -lSystem -no_compact_unwind -rpath @loader_path -rpath /usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc/x86_64-apple-darwin22/13 -rpath /usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc -rpath /usr/local/Cellar/gcc/13.2.0/lib/gcc/current
ld: unknown options: --version
collect2: error: ld returned 1 exit status
To Reproduce
Update to Xcode Command Line Tools 15.0 and follow the instructions to build for macos, you will get the error. Downgrade to Xcode Command Line Tools 14.3.1 and there is no error.
Here is a minimal version of the build process to replicate:
# brew packages
brew install meson bison flex boost gcc gsl libmatio veclibfort octave sphinx-doc docutils wget pkg-config git-lfs
# compile Dynare from source
git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git $HOME/dynare/unstable
cd $HOME/dynare/unstable
meson setup --native-file scripts/homebrew-native.ini -Dbuild_for=octave -Dbuildtype=debugoptimized -Dfortran_args="['-B']" build-octavehomebrew-native.ini looks like this:
[binaries]
cpp = 'g++-13'
flex = '/usr/local/opt/flex/bin/flex'
bison = '/usr/local/opt/bison/bin/bison'
Expected behavior
No error.
system parameters
- MacOS Ventura 13.5.2 or 13.6
- Python 3.11.5
- meson 1.2.1
- ninja 1.11.1