【问题标题】:make error in mac clang ld: unknown option: --gc-sections在 mac clang ld 中出错:未知选项:--gc-sections
【发布时间】:2014-09-04 05:51:34
【问题描述】:

我正在尝试编译在这里找到的 admesh

https://github.com/admesh/admesh

我按照他们的安装说明进行操作,基本上是配置和制作。但是当我在我的mac中运行make命令时,它给出了以下错误,

MacBook-Pro:admesh mk$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
CC       connect.lo
CC       normals.lo
CC       shared.lo
CC       stlinit.lo
CC       stl_io.lo
CC       util.lo
CCLD     libadmesh.la
ld: unknown option: --gc-sections
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libadmesh.la] Error 1
make: *** [all] Error 2

MacBook-Pro:admesh mk$ clang -v
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix

谁能帮我解决这个错误。

【问题讨论】:

  • 我猜--gc-sections 与不再支持的垃圾收集有关。您可以尝试删除Makefile 中的选项,但是代码可能无法在非垃圾收集环境中运行。也可以通过使用-mmacosx-version-min=10.X 指定较低版本的 OSX 来修复。
  • @trojanfoe,你能指导我在哪里设置这个 mmacosx-version-min=10.X 吗?我的意思是在 make 文件中还是在命令行中?
  • 看下面的SO问题,好像10.8已经弃用了,所以试试10.7。但是,Apple 可能也删除了对它的运行时支持。 stackoverflow.com/questions/5466899/…

标签: macos gcc compilation clang


【解决方案1】:

我在 admesh 的 hroncok 的帮助下解决了这个问题。

你需要在配置命令之后,在 Makefile.in 中替换行号 351,352 from

-Wl,--gc-sections \
-Wl,--as-needed \

-Wl,-dead_strip \
-Wl,-dead_strip \

并根据您的 hroncok 建议修复错误。更多详情请看这里https://github.com/admesh/admesh/issues/7

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-25
    • 2012-05-29
    • 2013-12-14
    • 1970-01-01
    • 2015-10-06
    相关资源
    最近更新 更多