问题描述
我正在使用 cmake
在 MacOS 中为 ARM
构建一个 *.elf
文件.CMake
正在自动添加标志 -Wl,-search_paths_first -Wl,-headerpad_max_install_name
,这会导致生成无效的 *.elf
文件.我收到错误 warning: cannot find entry symbol arch_paths_first;默认为 00000000080001e0
.
I'm building an *.elf
file for ARM
within MacOS using cmake
. CMake
is adding the flags -Wl,-search_paths_first -Wl,-headerpad_max_install_name
automatically, which leads to produce an invalid *.elf
file. I obtain the error warning: cannot find entry symbol arch_paths_first; defaulting to 00000000080001e0
.
我尝试在没有这些选项的情况下执行 arm gcc 命令,并且它运行良好.
I have tried to execute the arm gcc command without that options and it works perfectly.
如何停止 cmake
添加这些标志?
How can I stop cmake
to add these flags?
推荐答案
我找到了一种方法.
有必要添加以下指令:
set(HAVE_FLAG_SEARCH_PATHS_FIRST 0)
我很确定它必须添加在 project
指令之前.
I'm pretty sure that it must be added before the project
directive.
为了删除标志 -headerpad_max_install_names
,我在 project
指令之后写了以下内容:
For removing the flag -headerpad_max_install_names
, I have written the following after the project
directive:
set(CMAKE_C_LINK_FLAGS "")
我想如果我使用 g++
我应该需要添加
I guess that if I were using g++
I should needed to add
set(CMAKE_CXX_LINK_FLAGS "")
这篇关于避免 cmake 在 MacOS 中添加标志 -search_paths_first 和 -headerpad_max_install_names的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!