From: Kevan H. <ha...@br...> - 2021-04-12 17:28:26
|
Dear Marc, Thank you for your attention, responses to your comments below. For other readers, my question is this: Why does the 8.7a3 Tcl library have an absolute path for its LC_ID_DYLIB rather than a relative path? > To change the LC_ID_DYLIB path with install_name_tool you should use the -id option. That does not work, sadly, I get this error: kevan@KSH5 Tcl % install_name_tool -id \ @executable_path/../Frameworks/Tcl.framework/Versions/8.6/Tcl Tcl /Library/Developer/CommandLineTools/usr/bin/install_name_tool: fatal error: the __LINKEDIT segment does not cover the end of the file (can't be processed) in: Tcl It looks like the text segment that holds the ID path is not large enough to contain the extended string of the relative path. > But the otool -L command does *not* display the LC_ID_DYLIB path of a Mach file. I assumed the first path returned by -L was the same as the LC_ID_DYLIB of -l, because they are the same path. Apologies for confusion caused by my error. But the LC_ID_DYLIB is indeed equal to the absolute path I gave. > So what you need to do is to change (or add) an LC_LOAD_DYLIB path in the main executable of your app so that it will do that. This would be a change to the Wish executable, this being the only executable that is executed. The Wish executable already has LC_LOAD_DYLIB for Tcl: Load command 13 cmd LC_LOAD_DYLIB cmdsize 88 name @executable_path/../Frameworks/Tcl.framework/Versions/8.7/Tcl (offset 24) time stamp 2 Wed Dec 31 19:00:02 1969 current version 8.7.0 compatibility version 8.7.0 When my X.dylib is called, it demands that Wish find the following library, regardless of the LC_LOAD_DYLIB fields present in the Wish executable. /Library/Frameworks/Tcl.framework/Versions/8.7/Tcl > I find it a pain to use otool and install_name_tool and that is why I wrote the utility "macher" Sounds like a useful thing to have on my hard driver, thank you. I downloaded and tried to change the id of my Tcl library: kevan@KSH5 8.7 % ~/Desktop/macher set_id @executable_path/../Frameworks/Tcl.framework/Versions/8.7/Tcl Tcl Could not open mach-o file Tcl Best, Kevan -- Kevan Hashemi, Electrical Engineer Physics Department, Brandeis University http://www.bndhep.net |