From: Marc C. <mar...@gm...> - 2021-04-12 17:53:49
|
On Mon, Apr 12, 2021 at 12:28 PM Kevan Hashemi <ha...@br...> wrote: > 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? > Because Tcl is normally installed in /Library/Frameworks/Tcl.framework and Tk is normally installed in /Library/Frameworks/Tk.framework. So it is appropriate for them to have absolute LC_ID_DYLIB paths. > 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. > No, that is not what that means. It almost certainly means that there is a zipfile appended to your Tcl library. That breaks the structure of the LINKEDIT segment for the reason that the error message says. That has now been fixed. The macher tool is now being used to put the zipfile into the Tcl library by making the library into a fat binary, the last -arch being an unspecified architecture which can be legally used to hold the zipfile. You need to use the current core-8-branch tip instead of the older source code that you are using. > 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 > That looks correct to me, except for the timestamp. > 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 > Then you need to change the LC_LOAD_DYLIB for X.dylib to be a correct path to the Tcl library, starting with @loader_path if you want it to be relative to the location of X.dylib. (@executable is only for executables, not libraries). Alternatively, you can set an RPATH, which is also allowed to be relative. > 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 > Do you have permission to write to the file? Is it a real Mach-O file (as opposed to a symlink, for example). - Marc |