People arriving here with this error may have a different program intercepting the lookup for build tools, and removing it from your PATH
will allow the preferred build tools to be executed.
I encountered this error because I had paths in my PATH
with their own compiler and linker. Running make
caused these build tools to be run rather than the system defaults.
which ld
/usr/local/fsl/bin/ld
echo $PATH
/home/mike/.nvm/versions/node/v18.19.1/bin:/usr/local/fsl/share/fsl/bin:/usr/local/freesurfer/7.3.2/bin:/usr/local/freesurfer/7.3.2/fsfast/bin:/usr/local/freesurfer/7.3.2/tktools:/usr/local/fsl/bin:/usr/local/fsl/share/fsl/bin:/usr/local/freesurfer/7.3.2/mni/bin:/usr/local/fsl/share/fsl/bin:/usr/local/fsl/share/fsl/bin:/home/mike/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/mike/.local/share/JetBrains/Toolbox/scripts:/home/mike/bin:/usr/local/fsl/bin:/opt/antsbin/ANTS-build/Examples:/home/mike/.config/gems/bin:/opt/workbench/bin_linux64:/home/mike/LocalProjects/jjm_utils/mri:/home/mike/abin
I re-exported my PATH
without any of the clutter that was irrelevant to this project.
export PATH=/home/mike/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
which ld
/usr/bin/ld
In this shell, with the simplified PATH
, the project built perfectly.
-D_XOPEN_SOURCE=600
, too. Also see GCC with -std=c99 complains about not knowing struct timespec. – Hazelwood