|
2021-02-16
| ||
| 14:16 | • Closed ticket [92c2169782]: macOS compiling and using Tcl8.7/Tk8.7 plus 6 ot... artifact: 20979f1eac user: jan.nijtmans | |
|
2021-01-29
| ||
| 20:02 | • Ticket [92c2169782]: 3 changes artifact: 5b47ff64b4 user: bll | |
| 14:06 | • Ticket [92c2169782]: 4 changes artifact: 537016a4aa user: marc_culler | |
| 14:03 | • Ticket [92c2169782]: 4 changes artifact: 92b5b430c0 user: marc_culler | |
| 09:56 | • Ticket [92c2169782]: 3 changes artifact: 82463a7828 user: bll | |
| 09:45 | • Ticket [92c2169782]: 3 changes artifact: bf82df2c36 user: anonymous | |
| 08:37 | • Ticket [92c2169782]: 4 changes artifact: 916c0cd1c2 user: jan.nijtmans | |
| 05:39 | • Ticket [92c2169782]: 3 changes artifact: fbebd0f6ba user: anonymous | |
| 05:31 | • Ticket [92c2169782]: 4 changes artifact: 611781f0c8 user: marc_culler | |
| 04:48 | • Ticket [92c2169782]: 3 changes artifact: 6bab83a81a user: bll | |
| 03:57 | • Ticket [92c2169782]: 3 changes artifact: cf020b5c17 user: bll | |
| 03:42 | • Ticket [92c2169782]: 4 changes artifact: 35ac63f1a0 user: marc_culler | |
| 03:16 | • Ticket [92c2169782]: 3 changes artifact: 1ff5682c59 user: bll | |
| 02:49 | • Ticket [92c2169782]: 4 changes artifact: 87768e2ffb user: marc_culler | |
| 01:38 | • Ticket [92c2169782]: 3 changes artifact: aad25b60aa user: bll | |
|
2021-01-28
| ||
| 23:10 | • Ticket [92c2169782]: 3 changes artifact: 862310422b user: marc_culler | |
| 19:21 | • New ticket [92c2169782]. artifact: fae8ee65d8 user: anonymous | |
macOS compiling and using Tcl8.7/Tk8.7
Closed / Fixed92c2169782c2e0068d573dba9eb99d390ade31a7Created 6 years agoUpdated 6 years ago
Descriptionplain2021-01-28 19:21:54
Hi Jan, I'm trying to build and use Tcl8.7 on macOS (macOS11) so here's what I'm doing: I've deleted tclsh8.6 from /usr/local/bin (and Wish also) I compile Tcl8.7 from the latest core-8-branch. compile is fine. at sudo make -C macosx install-deploy stage I've got: Making directory /Library/Frameworks/Tcl.framework/Versions/8.7/PrivateHeaders Installing private header files to /Library/Frameworks/Tcl.framework/Versions/8.7/PrivateHeaders/ ERROR: version conflict for package "Tcl": have 8.5.9, need 8.6- If running this script from 'make html', set the NATIVE_TCLSH environment variable to point to an installed tclsh8.7 (or the equivalent tclsh87.exe on Windows). make[3]: *** [html-tcl] Error 1 make[2]: *** [install-strip] Error 2 make[1]: *** [install-tcl] Error 2 make: *** [install-deploy] Error 2 from my point of view it's strange because I just want to compile Tcl8.7... at this point Tcl.framework is installed in /Library/Frameworks/Tcl.framework, so I assume this is ok. Am I right? next I compile Tk8.7 wiht a custom #ifdef (because of tkMacOSXSysTray.c that does not understand -mmacosx-version-min=10.14). make -C macosx deploy CFLAGS="-O2 -mmacosx-version-min=10.14 -DDONT_BUILD_TARGET_HAS_NOTIFICATION" no complains for Tk now I want to link my app with Tcl.framework and Tk.framework. I use cmake for this stage which works fine with tcl/tk8.6 so when I build my app I got: -- 22/40: fixing up '/Users/nico/daylight/DLight.app/Contents/Frameworks/Tcl.framework/Versions/8.7/Tcl' /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: fatal error: the __LINKEDIT segment does not cover the end of the file (can't be processed) in: /Users/nico/daylight/DLight.app/Contents/Frameworks/Tcl.framework/Versions/8.7/Tcl CMake Error at /usr/local/share/cmake-3.15/Modules/BundleUtilities.cmake:915 (message): Command failed: '/usr/bin/install_name_tool' '-id' '@executable_path/../Frameworks/Tcl.framework/Versions/8.7/Tcl' '/Users/nico/daylight/DLight.app/Contents/Frameworks/Tcl.framework/Versions/8.7/Tcl' Call Stack (most recent call first): /usr/local/share/cmake-3.15/Modules/BundleUtilities.cmake:989 (fixup_bundle_item) cmake_install.cmake:167 (fixup_bundle) so please, can you point me what I'm doing wrong? best regards, Nicolas
marc_cullerplain2021-01-28 23:10:55
Nicolas, I see the error message about html-tcl too. But it is harmless unless you care about installing the html documentation. Please try building without the -mmacosx-version-min=10.14 option. That works fine for me. (I don't understand what you are saying about tkMacOSXSysTray.c but it sounds like a separate bug). The error you are seeing from install-name-tool suggests that some unexpected data was appended to the end of the Tcl library. Try running file /Users/nico/daylight/DLight.app/Contents/Frameworks/Tcl.framework/Versions/8.7/Tcl and otool -l /Users/nico/daylight/DLight.app/Contents/Frameworks/Tcl.framework/Versions/8.7/Tcl
bllplain2021-01-29 01:38:38
> The error you are seeing from install-name-tool suggests that some > unexpected data was > appended to the end of the Tcl library. Yes, the .zip file in 8.7.
marc_culler (claiming to be Marc Culler)plain2021-01-29 02:49:27
What do you mean, "the zip file in 8.7". I have asked before what the conditions are that cause that to happen, but I never got an answer. I have built 8.7 many times. I don't get a zipfile jammed on the end of my Tcl library. How about if someone explains when a zip file gets appended? And, also, appending a zip file to the end of binary is a dangerous hack. Those files have structure. You can't just make any wild assumption that you want about that structure in the hope that it will work. Obviously that is going to lead to instability.
bllplain2021-01-29 03:16:37
Well, from this ticket: https://core.tcl-lang.org/tcl/info/113be1991e726247 I first noticed it on 2018-11-23. I have not built 8.7 many times. Obviously I tried on 2018-11-23. I am afraid I do not know the conditions. --enable-zipfs is the default, it is supposed to always embed the .zip in the current state. > ... make any wild assumption ... Nevertheless, that is what they did. It seems to be (?) relatively safe for windows and linux. Not safe at all on Mac OS. And this is why I want the ability to choose how the .zip file gets packaged in this ticket: https://core.tcl-lang.org/tcl/tktview?name=16e9b297d The packager may not want to use wild assumptions and create a separate .zip file on windows or linux. Much safer to keep it separate in my opinion. The .zip enthusiasts are trying to re-create the tclkit (et. al.) single executable.
marc_culler (claiming to be Marc Culler)plain2021-01-29 03:42:40
Hmmm. Obviously that should not be the default for macOS. Here is my wild guess: this happens when you try to build a standalone macOS app with Tcl 8.7. The technique for building a standalone app on macOS is that you first build the Wish app and then you replace the Info.plist file and create an appinit.tcl. The macOS version of appinit.c checks if the appinit.tcl file exists. If not, it runs as Wish. On macOS the Wish app is an app bundle, of course, and it embeds the Tcl and Tk frameworks within the bundle in the standard way that macOS expects. Since the two frameworks are being relocated from the standard location in /Library/Frameworks to the app bundle it is necessary to use install_name_tool to adjust the id and (for Tk) library load paths. This is exactly the situation where the @executable_path symbol is supposed to be used. At load time that symbol gets replaced by the path to the directory containing the app bundle's main executable, namely <path to app bundle>/Contents/MacOSX . I think the solution to this problem is to *never* append the zip file for standalone macOS apps. The --enable-zipfs should just be completely disabled on macOS. That way it won't matter whether it is the default or not. It should just never happen. MacOS has its own way of handling the "single executable" paradigm and there is no point in trying to "improve" on that by replacing it by the Windows paradigm.
bllplain2021-01-29 03:57:16
I think it would be fine to have something like (this is not possible): --enable-zipfs-library=$INSTALL_ROOT/$prefix/lib/tcl8.zip Or .../Resources/tcl8.zip Unfortunately, as I outlined in the other ticket, --enable-zipfs is overloaded and the only current solution is to disable it completely for Mac OS. Which means the build will work, but there will be no support for zipfs. I think the .zip file also gets appended if you build tcl using: cd macosx ../unix/configure --prefix=wherever make -f Makefile make -f Makefile install bypassing the wonky GNUMakefile.
bllplain2021-01-29 04:48:26
You may have just never noticed it. I believe in 8.7, the .zip file
is always appended.
make -C macosx INSTALL_ROOT=$HOME/t/localD PREFIX="" -j 8
make -k -C macosx INSTALL_ROOT=$HOME/t/localD PREFIX="" install
bll-mac:/Volumes/Users/bll/t/localD$ $HOME/t/localD/bin/tclsh
dyld: Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.7/Tcl
Referenced from: /Volumes/Users/bll/t/localD/bin/tclsh
Reason: image not found
Abort trap: 6
bll-mac:/Volumes/Users/bll/t/localD$ install_name_tool -change \
/Library/Frameworks/Tcl.framework/Versions/8.7/Tcl \
@executable_path/../Library/Frameworks/Tcl.framework/Versions/8.7/Tcl \
$HOME/t/localD/bin/tclsh
bll-mac:/Volumes/Users/bll/t/localD$ $HOME/t/localD/bin/tclsh
% exit
bll-mac:/Volumes/Users/bll/t/localD$ install_name_tool -change \
/Library/Frameworks/Tcl.framework/Versions/8.7/Tcl \
@executable_path/../Library/Frameworks/Tcl.framework/Versions/8.7/Tcl \
$HOME/t/localD/Library/Frameworks/Tcl.framework/Versions/8.7/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: /Volumes/Users/bll/t/localD/Library/Frameworks/Tcl.framework/Versions/8.7/Tcl
bll-mac:/Volumes/Users/bll/t/localD$
marc_culler (claiming to be Marc Culler)plain2021-01-29 05:31:48
You're right. That is totally bizarre. We have made the default be to create a Tcl.framework that cannot be embedded in the app bundle of a macOS app. And, even worse, the rationale for murdering "just drag this app to your Applications folder" is to allow for a "single file executable". That blows my mind. But I guess I finally understand what this ticket is about. Anyway, whatever value one could possibly get by having everything in one file is immediately lost when that one file is required to be part of a framework bundle, which may itself be required to be part of an app bundle. So this option should clearly be disabled for any framework build. It could be useful to have a genuine macOS single file executable that can be run from a command line, but it should not be built by just naively appending a zip file to a compiled and linked mach-O executable.
anonymousplain2021-01-29 05:39:36
thank you for taking care of it. ++ nicolas
jan.nijtmanswiki2021-01-29 08:37:40
> So this option should clearly be disabled for any framework build.
So --enable-framework should imply --disable-zipfs. I'll see what I can do about this.
anonymousplain2021-01-29 09:45:46
Hi Jan, thank you, it works fine, cmake does not complain anymore about the install_name_tool stage. there's still one error I didn't mentioned earlier (at packaging stage) -- 2/40: copying '/Library/Frameworks/Tcl.framework/Versions/8.7/Tcl' Error copying directory from "/Library/Frameworks/Tcl.framework/Versions/8.7/Resources" to "/Users/nico/daylight/DLight.app/Contents/Frameworks/Tcl.framework/Versions/8.7/Resources". -- 3/40: copying '/Library/Frameworks/Tk.framework/Versions/8.7/Tk' Error copying directory from "/Library/Frameworks/Tk.framework/Versions/8.7/Resources" to "/Users/nico/daylight/DLight.app/Contents/Frameworks/Tk.framework/Versions/8.7/Resources". if I remove the Documentation folder from Resources of both Tcl and Tk, it's ok. ++
bllplain2021-01-29 09:56:51
> So --enable-framework should imply --disable-zipfs. I'll see what I can do about this. That's a quick hack to solve the immediate problem. It doesn't solve builds built without frameworks. And now you have the problem that zipfs can't be used. Related tickets: https://core.tcl-lang.org/tcl/info/113be1991e726247 https://core.tcl-lang.org/tcl/tktview?name=16e9b297d
marc_culler (claiming to be Marc Culler)plain2021-01-29 14:03:22
I think there should be two options: * --enable-zipfs which adds support for zip filesystems but does not generate a single file executable by embedding a zip file in the executable. * --single-file which does embed the zip file and, of course, must imply --eneable-zipfs The next question would be how to embed the zip file. One possibility would be to write a temporary header file which defines a char array containing the bytes of the zip file. Yes, the header would be several times larger than the zip if each byte is written out in octal with comma separators. But that probably doesn't matter. Then reading the zip file would require seeking to the offset of the char array. That doesn't seem too march harder than seeking to the end of the original binary file, before the zip was appended. Alternatively, the array could be zeroed and then the zip file could be written into the binary after compilation. (But *before* signing the code!)
marc_culler (claiming to be Marc Culler)plain2021-01-29 14:06:44
A third option would be to write the char array containing the bytes of the zip file to a temp file and use that temp file as the zip filesyastem. Then no offsets need to be computed.
bllplain2021-01-29 20:02:19
Jan has pointed out in my other ticket that --enable-zipfs pertains to whether or not Tcl embeds the .zip file, not whether zipfs support is built. zipfs support is always enabled. Personally, I think that is a poor choice for the option name. --enable-embedded-zipfs and --enable-external-zipfs=<path> or somesuch would be preferable to me. The other ticket has links to a couple of different strategies for embedding data in a mac os library. https://core.tcl-lang.org/tcl/info/113be1991e726247
jan.nijtmanswiki2021-02-16 14:16:33
> The error you are seeing from install-name-tool suggests that some > unexpected data was > appended to the end of the Tcl library.
Well, I think this ticket is fixed now in two ways:
1) --enable-framework builds no longer produce zip-files. 2) other builds, use Mark Culler's "macher" utility now, which also makes sure that the binary is a valid mach-o file on MacOSX.
I'm sure that other details need to be worked out, but there are already other detailed tickets about that. So, closing this one.
Log in (anonymous is fine) to add a comment.