You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
Run into the following linker error on Mac:
```
[ 83%] Linking CXX executable llama_main
ld: warning: -s is obsolete
ld: unknown options: --gc-sections
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [llama_main] Error 1
make[1]: *** [CMakeFiles/llama_main.dir/all] Error 2
make: *** [all] Error 2
```
Env:
`clang --version`
```
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
```
Fix:
It turns out that Apple Clang linker doesn't support the `--gc-sections` options, where it instructs the linker to remove unused sections from the final executable or shared library. Use an equivalent flags `-dead_strip` instead on Mac.
Pull Request resolved: #4473
Reviewed By: cccclai
Differential Revision: D60474232
Pulled By: guangy10
fbshipit-source-id: d1f2745913a49588bdac4e8f5f792dfae4d7c9cd
0 commit comments