Freewrap: Windows, Linux, MacOS, Android etc.

324 views
Skip to first unread message

snosniv

unread,
Nov 24, 2022, 10:31:30 AM11/24/22
to
I've successfully converted my 3 Tcl/Tk files (GUI, Tooltips & Calcs) into a Windows exe file for my own use; however, I'd like to share it with some cycling friends, some of which use an OS other than Windows, primarily Android &/or iPad OS.

Is it possible to create a suitable file that can be used on these alternate OS's, and can it be done on my Windows PC? (Some of the people I'd like to share with are less computer conversant than me, hard to believe I know)! :-)

Harald Oehlmann

unread,
Nov 24, 2022, 10:40:32 AM11/24/22
to
Am 24.11.2022 um 16:31 schrieb snosniv:
> I've successfully converted my 3 Tcl/Tk files (GUI, Tooltips & Calcs) into a Windows exe file for my own use; however, I'd like to share it with some cycling friends, some of which use an OS other than Windows, primarily Android &/or iPad OS.
>
> Is it possible to create a suitable file that can be used on these alternate OS's, and can it be done on my Windows PC? (Some of the people I'd like to share with are less computer conversant than me, hard to believe I know)! :-)

Yes, it can. Use the -w option of freewrap.


Luc

unread,
Nov 24, 2022, 2:07:53 PM11/24/22
to
I don't think so, no.

https://freewrap.dengensys.com/wp-content/uploads/2021/04/freeWrapDocs.pdf

You can generate a Windows executable in Linux and vice-versa, but you
have to point to a Freewrap executable with the -w option.

Given that Freewrap only exists in Linux and Windows versions, I am pretty
convinced that you can only generate executables for those two platforms.
I don't see any Mac/iOS version in the downloads section and I really
doubt any of the existing versions will run on Android. You would have to
make an Androwish application for Android.

--
Luc
>>


Michael Niehren

unread,
Nov 25, 2022, 3:14:24 PM11/25/22
to
you can use tclexecomp to create binaries for Windows, Linux and MacOS (but
currently not for the M1). It is based on Freewrap. For Android binaries
you can use Androwisth, but for iPad OS, i don't know a tool.


Torsten Berg

unread,
Nov 26, 2022, 6:53:19 PM11/26/22
to
That's interesting. Can tclexecomp actually "cross-compile"? With freewrap I can make a Linux exe from Windows as far as I remember (log time ago I did this). Can tclexecomp produce Linux and Windows executables when operated from macOS, or does it need to run on the platform for which the code is?

Michael Niehren

unread,
Nov 26, 2022, 7:53:17 PM11/26/22
to
Hi Torsten,

tclexecomp can "cross-compile". You can use it under Windows and produce
Binaries for Linux or MacOS or you can use it under MacOS and produce
Binaries for Linux and Windows.

And you can customize your binaries, which means, that you can delete
unneeded modules in the binariy.

Take a look at https://tclexecomp.sourceforge.net/

best regards
Michael


snosniv

unread,
Dec 1, 2022, 4:33:33 AM12/1/22
to
I'm getting nowhere with tclexecomp at all.
So, this is what I did, what am I doing wrong please? (This is all on a Windows 10 PC)
Downloaded from sourceforge, unzipped to get a bunch of similarly named files in new dir "tclexecomp",
joined my 3 files together into 1 called ZBUILD.tcl & put in sub-dir wrap as per instructions.

(Note:- ZBUILD.tcl converted to ZBUILD.exe with just Freewrap & works fine).

In a command window I did the following:-

compiled using: tclexecomp64 -compile wrap/Zbuild.tcl to wrap/ZBUILD.tbc
Removed the ZBUILD.tcl file & then renamed ZBUILD.tbc to ZBUILD.tcl

Then tried to build exe with:- tclexecomp64 wrap/ZBUILD.tcl wrap/* -forcewrap -w tclexecomp64.exe (as per instructions)
This comes back with error saying "Cannot find wrap/* to wrap.

So then tried without the wrap/* bit which did create ZBUILD.exe in the dir above wrap

Clicked on this new exe file &just get error:- (Error sourcing /zvfs/wrap/ZBUILD.tcl: expected integer but got "I )

So, just going round in circles with tclexecomp. :-(
I'm happy with what Freewrap creates for the windows environment, but if I can't get tclexecomp to work for Windows, I expect the Mac version will not work either (and I have no way to test it myself), which is what I'm trying to create for a few friends who use Mac & not Windows.

Any help much appreciated.


snosniv

unread,
Dec 1, 2022, 9:25:27 AM12/1/22
to
UPDATE:
I've now downloaded tclexecomp-V1.2.0 instead of V1.4.0 and behold, we have a working Windows exe file!
I also created a Mac file, so now need a friend to test that for me somehow.

When I download V1.4.0 I gat an extra file over the V1.2.0 version called: .tclexecomp.n.swp
whatever that does?

Regards, Kev P. (snosniv).

snosniv

unread,
Dec 1, 2022, 4:32:10 PM12/1/22
to
I've since read about TclApp, which supposedly can wrap my files AND my image file into one exe file.
I'd prefer this as the current versions I've built, either Freewrap or tclexecomp, seem to need my image.png file to be in same directory.
However, I can't find TclApp anywhere to download; is it still available & where from?

Torsten Berg

unread,
Dec 1, 2022, 4:57:52 PM12/1/22
to

> However, I can't find TclApp anywhere to download; is it still available & where from?

TclApp is a part of the TclDevKit and now on Github: https://github.com/ActiveState/tdk

It hasn't been updated in quite some time and I have never tried to make it run ... so I cannot help with installation unfortunately. As there doesn't seem to be good documentation either I guess you will have to go with trial and error.

snosniv

unread,
Dec 2, 2022, 7:58:12 AM12/2/22
to
OK, thanks for that. A pity that tclexecomp doesn't wrap up the image as well, but still needs to have the image in a dir somewhere (I made it same dir to be simple),
unless anyone can tell me how to wrap my tcl/tk file so the executable includes the image? (Windows & Mac).

Kev P.

Christian Werner

unread,
Dec 2, 2022, 8:30:24 AM12/2/22
to
> ...unless anyone can tell me how to wrap my tcl/tk file so the executable includes the image? (Windows & Mac).

(Shameless plug) Did you try LUCK? Could do the job except for Android and iOS.
See https://wiki.tcl-lang.org/page/LUCK for details.

C.

Manfred Rosenberger

unread,
Dec 12, 2022, 6:20:04 AM12/12/22
to
I can test on linux and mac
Manfred

Andreas Leitgeb

unread,
Dec 13, 2022, 5:52:07 AM12/13/22
to
snosniv <nivpa...@gmail.com> wrote:
> When I download V1.4.0 I gat an extra file over the V1.2.0 version called: .tclexecomp.n.swp
> whatever that does?

That is a temporary file, that appears, while tclexecomp.n is edited
with "vim" editor. You can ignore it, or you could also edit
tclexecomp.n with vim and get a note, that the file is already
being edited, and you are asked whether to restore the other edit,
discard or ignore it.

In a nutshell:
Apparently, the package creator created the package, while still in
the editor for tclexecomp.n .

PS:
I saw that post from Dec 1st only now. Since none of the followups
answered that point, I thought I'd do.

Even if the package may have since been corrected (dunno),
it might be good to know what ".*.swp" (sometimes also ".*.swo")
files mean if they unexpectedly show up somewhere.

Dennis LaBelle

unread,
Dec 23, 2022, 2:48:19 PM12/23/22
to
Hello,
I'm the author of freeWrap upon which tclexecomp is based. Here are a
few suggestions.

It appears that tclexecomp does not expand your wrap/* argument into a
list of files (freeWrap doesn't do that either). Under freeWrap you
would put a list of all your needed files into a text file and use the
-f option on the build command line to read your list of files. Perhaps
tclexecomp supports the same command line argument.

You can also include your image data directly into your source code by
converting the image to a base64 encoded string and using a command like
[image create photo -data $base64string] to load/create the image in TK.

Dennis LaBelle

The Rickster

unread,
Dec 24, 2022, 7:32:49 PM12/24/22
to
On Thursday, November 24, 2022 at 7:31:30 AM UTC-8, snosniv wrote:
> I've successfully converted my 3 Tcl/Tk files (GUI, Tooltips & Calcs) into a Windows exe file for my own use; however, I'd like to share it with some cycling friends, some of which use an OS other than Windows, primarily Android &/or iPad OS.
>
> Is it possible to create a suitable file that can be used on these alternate OS's, and can it be done on my Windows PC? (Some of the people I'd like to share with are less computer conversant than me, hard to believe I know)! :-)
I use tclapp to create exes for commercial purposes.
Install the devkit from the address shown in another reply and you should be good to go.

Michael Niehren

unread,
Jan 3, 2023, 5:14:31 PMJan 3
to
Hi snosiv,

which version of tclexecomp did you use ?

Could you please try to do the following, which run's here.
- create a file called test.tcl with the following content
console show
puts "das ist ein Test"
- put tclexecomp64 and tclexecomp64.exe into the same directory
- create an directory called wrap
- compile the test.tcl with
./tclexecomp64 -compile test.tcl
- copy the test.tbc to the wrap directory
- call ./tclexecomp64 wrap/test.tcl -forcewrap -w tclexecomp64.exe
- try out the test.exe
- call ./tclexecomp64 wrap/test.tcl wrap/* -forcewrap -w tclexecomp64.exe
- try out again the test.exe

both of them runs here without any errors on the upcoming tclexecomp V1.5.0,
which updates to tcl/tk V8.6.13 and also fixes errors on MacOS > V11.

you can also open an issue at codeberg, which will be the new location of
tclexecomp:
https://codeberg.org/karl69/tclexecomp

best regards
Michael

snosniv

unread,
Jan 19, 2023, 10:50:35 AMJan 19
to
I'm now trying to find out if the Mac version works that I created, so far not apparently (a friend is trying to test).
The conversion worked fine for my Windows PC, so will the tclexecomp conversion actually build a Mac executable if done on a a windows PC,
or does it have to be on a Mac itself to convert the Tcl files successfully?

I'd assumed al lwould be well with the PC conversion.

Kev P.

Christian Gollwitzer

unread,
Jan 19, 2023, 3:06:58 PMJan 19
to
Am 19.01.23 um 16:50 schrieb snosniv:
> I'm now trying to find out if the Mac version works that I created, so far not apparently (a friend is trying to test).
> The conversion worked fine for my Windows PC, so will the tclexecomp conversion actually build a Mac executable if done on a a windows PC,
> or does it have to be on a Mac itself to convert the Tcl files successfully?
>
> I'd assumed al lwould be well with the PC conversion.


Hi snosiv,

I've got no experience with Freewrap, instead I use tclkits, but the
result should be the same - in general an application can be
"cross-compiled" if you have the correct Tcl compiled for the other
platform.

However, there is an idiosyncracy on the Mac; Apple has activated a
Firewall-like thing called "Gatekeeper" in recent versions of the OS
which prevents the execution of a binary that you download off the
internet, unless it is signed (costs $$ per year and requires some
knowledge) and even then, it asks for permission of the downloaded
software.

Another thing is that, in order to build a "true" Mac app, one has to
provide a special folder structure then create a compressed DMG image,
which only works on the Mac. Otherwise, the executable cannot be run in
the regular way (dropping it into /Applications etc.) and does not have
icons, associated files etc.

Christian

snosniv

unread,
Jan 20, 2023, 6:59:56 AMJan 20
to
Thanks for the info Christian, sounds like it's going to be difficult to get my code to run on a Mac. 🙁
But going to try once more when Mac owning friend gets back from hols.
Bit of a shame as it was very simple to create the Windows version (which works just fine).
Kev P.

Torsten Berg

unread,
Jan 23, 2023, 9:09:30 AMJan 23
to
Hm,

for a Mac version of my software, I do not use freewrap or other wrapping software. Mac binaries are so-called "bundles" (in fact a special kind of folder with some files inside) and can easily be created starting from an embedded Tcl build. This build is a valid Mac bundle itself already and you just need to provide an init script (AppMain.tcl) and your other stuff to it by copying the files into the bundle (it is a simple copy and paste action). Then, only some other customizations are needed if you want to. See here for a nice description:

https://codebykevin.com/tutorial.html

snosniv

unread,
Feb 2, 2023, 12:53:32 PMFeb 2
to
A friend tried the code I compiled on my Win10PC using tclexecomp, but targeting a Mac,
his Mac recognised it as an app, but it wouldn't open. :-(

Is there another way to build a Mac app from tcl/tk code on a PC,
or will I need to use a Mac and something like Aqua, which I've been told about?
Reply all
Reply to author
Forward
0 new messages