4

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.

I have tried to execute the arm gcc command without that options and it works perfectly.

How can I stop cmake to add these flags?

Dan
  • 2,452
  • 20
  • 45

1 Answers1

8

I have found a way to do that.

It's necessary to add the following directive:

set(HAVE_FLAG_SEARCH_PATHS_FIRST 0)

I'm pretty sure that it must be added before the project directive.

For removing the flag -headerpad_max_install_names, I have written the following after the project directive:

set(CMAKE_C_LINK_FLAGS "")

I guess that if I were using g++ I should needed to add

set(CMAKE_CXX_LINK_FLAGS "")
Dan
  • 2,452
  • 20
  • 45