Skip to content
Tcl Source Code History Of Ticket 92c2169782c2e006
Login

History Of Ticket 92c2169782c2e006

Artifacts Associated With Ticket 92c2169782c2e006

  1. Ticket change [fae8ee65d8] (rid 191468) by anonymous on 2021-01-28 19:21:54:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      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
      
    5. is_private initialized to: "0"
    6. login: "anonymous"
    7. priority initialized to: "5 Medium"
    8. private_contact initialized to: "10e302b1a1ae78d60a0878d87bdb4b5f874b815e"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "anonymous"
    13. subsystem initialized to: "53. Configuration and Build Tools"
    14. title initialized to: "macOS compiling and using Tcl8.7/Tk8.7"
    15. type initialized to: "Bug"
  2. Ticket change [862310422b] (rid 191471) by marc_culler on 2021-01-28 23:10:55:

    1. icomment:
      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
      
    2. login: "marc_culler"
    3. mimetype: "text/plain"
  3. Ticket change [aad25b60aa] (rid 191472) by bll on 2021-01-29 01:38:38:

    1. icomment:
      > 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.
      
    2. login: "bll"
    3. mimetype: "text/plain"
  4. Ticket change [87768e2ffb] (rid 191473) by marc_culler on 2021-01-29 02:49:27:

    1. icomment:
      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.
      
    2. login: "marc_culler"
    3. mimetype: "text/plain"
    4. username: "Marc Culler"
  5. Ticket change [1ff5682c59] (rid 191474) by bll on 2021-01-29 03:16:37:

    1. icomment:
      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.
      
    2. login: "bll"
    3. mimetype: "text/plain"
  6. Ticket change [35ac63f1a0] (rid 191475) by marc_culler on 2021-01-29 03:42:40:

    1. icomment:
      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.
      
    2. login: "marc_culler"
    3. mimetype: "text/plain"
    4. username: "Marc Culler"
  7. Ticket change [cf020b5c17] (rid 191476) by bll on 2021-01-29 03:57:16:

    1. icomment:
      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.
      
    2. login: "bll"
    3. mimetype: "text/plain"
  8. Ticket change [6bab83a81a] (rid 191477) by bll on 2021-01-29 04:48:26:

    1. icomment:
      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$
      
    2. login: "bll"
    3. mimetype: "text/plain"
  9. Ticket change [611781f0c8] (rid 191478) by marc_culler on 2021-01-29 05:31:48:

    1. icomment:
      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.
      
    2. login: "marc_culler"
    3. mimetype: "text/plain"
    4. username: "Marc Culler"
  10. Ticket change [fbebd0f6ba] (rid 191479) by anonymous on 2021-01-29 05:39:36:

    1. icomment:
      thank you for taking care of it.
      
      ++
      nicolas
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
  11. Ticket change [916c0cd1c2] (rid 191480) by jan.nijtmans on 2021-01-29 08:37:40:

    1. assignee changed to: "jan.nijtmans"
    2. icomment:
      > 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.
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/x-fossil-wiki"
  12. Ticket change [bf82df2c36] (rid 191490) by anonymous on 2021-01-29 09:45:46:

    1. icomment:
      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.
      
      ++
      
    2. login: "anonymous"
    3. mimetype: "text/plain"
  13. Ticket change [82463a7828] (rid 191491) by bll on 2021-01-29 09:56:51:

    1. icomment:
      > 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
      
    2. login: "bll"
    3. mimetype: "text/plain"
  14. Ticket change [92b5b430c0] (rid 191499) by marc_culler on 2021-01-29 14:03:22:

    1. icomment:
      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!)
      
    2. login: "marc_culler"
    3. mimetype: "text/plain"
    4. username: "Marc Culler"
  15. Ticket change [537016a4aa] (rid 191500) by marc_culler on 2021-01-29 14:06:44:

    1. icomment:
      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.
      
    2. login: "marc_culler"
    3. mimetype: "text/plain"
    4. username: "Marc Culler"
  16. Ticket change [5b47ff64b4] (rid 191510) by bll on 2021-01-29 20:02:19:

    1. icomment:
      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
      
    2. login: "bll"
    3. mimetype: "text/plain"
  17. Ticket change [20979f1eac] (rid 191830) by jan.nijtmans on 2021-02-16 14:16:33:

    1. closedate changed to: "2459262.09483483"
    2. closer changed to: "jan.nijtmans"
    3. icomment:
      > 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.
      
    4. login: "jan.nijtmans"
    5. mimetype: "text/x-fossil-wiki"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"