7

I need to relink a file with the install_name_tool. The file in question let me change one of the dylib paths, but when I change the second (of 7), I get this error:

install_name_tool: changing install names or rpaths can't be redone for: some/library (for architecture i386) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)

After googling around I found that there simply is not enough room for the new paths within the file, and that I might be able to use the ld tool, or the libtool to fix this. However, I am not able to figure out how. I do not have the source code for this library, so I cannot recompile it.

Is there any way for me to update all the dylib paths for this file? Any help would be very much appreciated!


I am on osx 10.10 The command I am using: install_name_tool -change old/dylib/path.dylib new/dylib/path.dylib file/to/update

Automatico
  • 12,420
  • 9
  • 82
  • 110

1 Answers1

10

The problem is in your binary, not the libraries. Do what the warning suggests. Add -headerpad_max_install_names to the ld flags used to link your binary. If you are using Xcode, you can put it in your target's Other Linker Flags build setting.

Jason
  • 1,612
  • 16
  • 23
  • I build my c++ dynamic lib my.so using make and then correct the paths via install_name_tool. After some changes in the source files I received the message.Where need I do changes to fix it? – ZedZip Jul 12 '18 at 06:11
  • Your makefile will have someway to set compiler flags. You add it there. – Jason Jul 20 '18 at 01:36