Skip to content

Instantly share code, notes, and snippets.

@Juke34
Last active April 11, 2020 09:53
Show Gist options
  • Save Juke34/46dcb0ff12bf839243d7fc72ee935591 to your computer and use it in GitHub Desktop.
Save Juke34/46dcb0ff12bf839243d7fc72ee935591 to your computer and use it in GitHub Desktop.
# --- OSX -----
# When following error:
# ld: unknown option: -platform_version
# clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
Here the way to fix it
info=$( ld -v 2>&1 > /dev/null )
platform=$([[ $info =~ ld64-([0-9]*) ]] && echo ${BASH_REMATCH[1]})
add at the end of the compiltaton command: -mlinker-version=$platform
e.g:
clang -O2 -I. -o ncoils ncoils.c read_matrix.c -lm -mlinker-version=$platform
# When following error:
# ld: symbol not found for architecture x86_64
see here how to fix it: https://medium.com/@m.muizzsuddin_25037/error-ld-symbol-not-found-for-architecture-x86-64-a5e5b648ffc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment