01-09-2020, 11:31 AM
Post: #21
 tcab Member Posts: 188 Joined: Dec 2017
That's great news - will try to compile on my Raspberry Pi 4 (4 gig memory version) and watch the CPU temperature go up ! (The Raspberry Pi 4 is fast but has thermal issues).

Might be nice to make the prebuilt executable or .deb available on the Free42 downloads page one day, to save people the trouble of dealing with git, sudo apt install, make etc... if possible.

P.S. Am curious - did you buy a Pi or use a friends? I love my Pi. :-) It even comes with a free version of Wolfram Mathematica.
01-09-2020, 02:19 PM (This post was last modified: 01-09-2020 02:43 PM by Thomas Okken.)
Post: #22
 Thomas Okken Senior Member Posts: 1,726 Joined: Feb 2014
I was thinking of tackling the Raspbian issue using an emulated machine in Qemu, but then I caved and just bought a real one, a Pi 4 with 4GB RAM. I wanted one anyway.

I got one of these sets. It comes with a fan and a few heat sinks, which the setup guide calls optional, but since the machine started getting hot and throttling while installing the OS (the cursor turning into a thermometer to warn me, very cute), I put in the fan, and that helped. I'll add the heat sinks later.

I'm not planning to distribute Linux binaries beyond the basic installer-less x86_64 package that I'm building already. Creating deb or rpm or whatever packages from GitHub, or from my "upstream" source code tarballs, should be a simple and mostly or fully automated process, but I prefer leaving that, and the challenge of complying with the various rules imposed by the various repositories, to other people. Building the five packages that I do build myself is enough of a hassle as far as I'm concerned.

N.B. For Raspbian 10, you really need apt only to install libgtk-3-dev (and libasound2-dev if you want TONE and BEEP to work properly and not just call gdk_display_beep()). Everything else, including git, make, gcc, and all the other required headers and libraries, are part of the initial Raspbian install, at least if you go with the full version.
01-09-2020, 06:06 PM
Post: #23
 John Keith Senior Member Posts: 752 Joined: Dec 2013
I got my Pi model 4 from Adafruit along with this heatsink. It keeps the CPU comfortably cool even when running long Mathematica calculations. They also have a couple of nice aluminum cases which can act as heat sinks but I haven't tried them.
01-09-2020, 06:08 PM
Post: #24
 Bill (Smithville NJ) Senior Member Posts: 447 Joined: Dec 2013
(01-09-2020 02:19 PM)Thomas Okken Wrote:  I got one of these sets. It comes with a fan and a few heat sinks, which the setup guide calls optional, but since the machine started getting hot and throttling while installing the OS (the cursor turning into a thermometer to warn me, very cute), I put in the fan, and that helped. I'll add the heat sinks later.

Congratulations on your new PI4. I've been running PI's since the PI2.
Just a few comments, based on my experience. The PI4 definitely needs
heat sinks AND a fan. I prefer open on the side type cases. Allows for better
cooling of the board. I have about 12 pi's running at present - each doing
a particular application - mostly ham radio related. All are running
headless - no monitor or keyboard. I either ssh or vnc into them.
I'm very impressed with the latest Rasbian OS (which is Debian Buster).
So much so, that I have installed the PC Desktop version on an
older MacBook.

For most people, the 2GB version of the PI4 is all that's required.
I have deliberately tried loading a 4GB version - with three windows
streaming videos and two windows doing compiles, it was only using
a little less than 1 gb of memory. Smooth video and audio.

Bill
Smithville, NJ
01-11-2020, 05:37 AM
Post: #25
 tcab Member Posts: 188 Joined: Dec 2017
I managed to compile Free42 on the Raspberry Pi. As Thomas said, its dead easy:
Code:
sudo apt install libgtk-3-dev git clone https://github.com/thomasokken/free42.git cd free42/gtk make ./free42bin

Not sure whether I should have run the build-gtk script instead?, but the resulting binary free42bin using the steps above seems to have worked OK (though I did get a few compile warnings flying past...)

I then ran Print42 and was able to echo output from Free42 onto my thermal printer - all on the Raspberry Pi.

Print42 was unable to automatically detect the location of the Free42 printout text file (Print42 tries to guess via inspecting the Free42 state file, which it thinks is in /home/pi/.local/share/Free42/state but the Free42 state file is not there - I'll have to find out where the proper location is and tweak that in the next release of Print42). Its no big deal, I just browsed to the location of the Free42 printout text file manually via Print42. For those that haven't tried it yet, you can set the location of the Free42 printout text file to any file you want, in any location, using Free42 preferences.

Here is a photo of my setup. Epson thermal printer in the foreground, Raspberry Pi 4 on the right in the official case, minus the lid. I have some heatsinks installed, and have an USB powered external fan (barely visible behind the screen on the left) running directed at the Pi - the fan is plugged into one of the Pi USB ports.

Now onto what you can see on the screen... Free42 is successfully running on the left of the screen, with the Free42 printout window next to it. Then Print42 on the extreme right of the screen, detecting Free42 printout activity and writing to the thermal printer. The terminal window can be seen in the background, with remnants of the compile that built Free42 on the Pi.

The next step might be to copy both Free42 and Print42 programs to my other Pi, which has its own touchscreen and looks like a calculator - kind of :-) Here is an even older version of my Pi based calc.
01-11-2020, 06:08 AM (This post was last modified: 01-11-2020 06:15 AM by Thomas Okken.)
Post: #26
 Thomas Okken Senior Member Posts: 1,726 Joined: Feb 2014
(01-11-2020 05:37 AM)tcab Wrote:  I managed to compile Free42 on the Raspberry Pi. As Thomas said, its dead easy:
Code:
sudo apt install libgtk-3-dev git clone https://github.com/thomasokken/free42.git cd free42/gtk make ./free42bin

Not sure whether I should have run the build-gtk script instead?, but the resulting binary free42bin using the steps above seems to have worked OK (though I did get a few compile warnings flying past...)

The difference is that the build-gtk script checks if /usr/include/alsa/asoundlib.h exists, and adds AUDIO_ALSA=1 to the 'make' command line if it does, and it strips the binaries to make them smaller.

Regarding the warnings, those are probably related to GTK. In the later GTK 3 versions, a few APIs were deprecated, but I'm sticking with them in order to be able to continue building in Ubuntu 12.04, which has a rather old version of GTK 3 (3.4.2). I don't know if it's possible to suppress those warnings, but they are harmless at any rate.

(01-11-2020 05:37 AM)tcab Wrote:  Print42 was unable to automatically detect the location of the Free42 printout text file (Print42 tries to guess via inspecting the Free42 state file, which it thinks is in /home/pi/.local/share/Free42/state but the Free42 state file is not there - I'll have to find out where the proper location is and tweak that in the next release of Print42).

The location of the directory containing the state file is hard-coded in gtk/shell_main.cc, line 408, and the state, print-out, and keymap file names, which include the Free42 directory name, are hard coded starting at line 421, six lines in total. Search for /.free42/ to make sure you find all occurrences.

I guess it's a bit ugly but I didn't anticipate people wanting to store those files somewhere other than $HOME/.free42 (01-11-2020 05:37 AM)tcab Wrote: Here is a photo of my setup. Cool! (01-09-2020 06:08 PM)Bill (Smithville NJ) Wrote: Enjoy your new little computer. I'm liking it so far! It has already helped me fix a bug that I hadn't been able to reproduce in my other Linux environments. Although that bug is caused by bad behavior in GTK or in the display driver, so that is a mixed blessing, I guess. I have had dropped WiFi connections a couple of times, although I'm not 100% sure the Pi is at fault there. It could also be a problem in my router (Netgear WNDR4300 running a not-very-recent version of DD-WRT) or in the MacBook Air I'm using to VNC into the Pi. I haven't noticed WiFi flakiness before, but I don't usually VNC between machines at home for long periods of time, either, so that will require some investigation. 01-11-2020, 04:36 PM Post: #27  Thomas Okken Senior Member Posts: 1,726 Joined: Feb 2014 RE: Print42 - thermal printer software for Free42 (01-11-2020 06:08 AM)Thomas Okken Wrote: The location of the directory containing the state file is hard-coded in gtk/shell_main.cc, line 408, and the state, print-out, and keymap file names, which include the Free42 directory name, are hard coded starting at line 421, six lines in total. Search for /.free42/ to make sure you find all occurrences. I guess it's a bit ugly but I didn't anticipate people wanting to store those files somewhere other than$HOME/.free42

Fixed. The location of the .free42 directory can now be customized by changing only line 408.
01-12-2020, 12:03 PM (This post was last modified: 01-12-2020 01:33 PM by Thomas Okken.)
Post: #28
 Thomas Okken Senior Member Posts: 1,726 Joined: Feb 2014
(01-11-2020 06:08 AM)Thomas Okken Wrote:  Regarding the warnings, those are probably related to GTK. In the later GTK 3 versions, a few APIs were deprecated, but I'm sticking with them in order to be able to continue building in Ubuntu 12.04, which has a rather old version of GTK 3 (3.4.2). I don't know if it's possible to suppress those warnings, but they are harmless at any rate.

I removed the -DGDK_DISABLE_DEPRECATED and -DGTK_DISABLE_DEPRECATED options, and put in -DGDK_DISABLE_DEPRECATION_WARNINGS instead. The build runs without warnings now in Ubuntu 12.04, 18.04, 19.10, and in Raspbian 10.

I originally put in the -DGDK_DISABLE_DEPRECATED and -DGTK_DISABLE_DEPRECATED options when I started work on the transition to GTK 3, but now that that code is stable, those options (which serve to flush out GTK-2-isms) are no longer needed. The -DGDK_DISABLE_DEPRECATION_WARNINGS option gets rid of the warnings about API changes in GTK 3.24, which I don't care about (yet).
01-12-2020, 12:34 PM
Post: #29
 SammysHP Member Posts: 151 Joined: Jul 2018
(01-11-2020 04:36 PM)Thomas Okken Wrote:
(01-11-2020 06:08 AM)Thomas Okken Wrote:  The location of the directory containing the state file is hard-coded in gtk/shell_main.cc, line 408, and the state, print-out, and keymap file names, which include the Free42 directory name, are hard coded starting at line 421, six lines in total. Search for /.free42/ to make sure you find all occurrences.

I guess it's a bit ugly but I didn't anticipate people wanting to store those files somewhere other than $HOME/.free42 Fixed. The location of the .free42 directory can now be customized by changing only line 408. Another way would be to use the XDG Base Directory Specification (reading some environment variables to determine the correct location; only if ~/.free42 does not exist for backwards compatibility). 01-13-2020, 02:11 AM Post: #30  KF6GPE Member Posts: 61 Joined: Jun 2017 RE: Print42 - thermal printer software for Free42 This is really cool! I'm getting it set up on the family PC now. Whiny question from the one guy on the forums with an ARM-based Windows PC --- any chance of a 32-bit build for Windows, so it'll run under emulation on Windows 10 on ARM? I'd love it for my Surface Pro X. I'm willing to make a PayPal donation, if it helps, for the work. Nice work, and thanks for making the Pi printer-enabled version free. I am very tempted to get another Pi and one of the Epson printers and do a build next month after I wrap up the current project on my desk. 01-13-2020, 03:21 AM Post: #31  Thomas Okken Senior Member Posts: 1,726 Joined: Feb 2014 RE: Print42 - thermal printer software for Free42 (01-12-2020 12:34 PM)SammysHP Wrote: (01-11-2020 04:36 PM)Thomas Okken Wrote: Fixed. The location of the .free42 directory can now be customized by changing only line 408. Another way would be to use the XDG Base Directory Specification (reading some environment variables to determine the correct location; only if ~/.free42 does not exist for backwards compatibility). Yes, that does sound like a good idea. I hadn't realized there was an actual standard for this kind of thing now! I haven't used modern Linux desktops in years and it shows. I guess while I'm at it, I might as well steal your patch and add support for looking for skins under$XDG_DATA_DIRS/free42/skins, too.
01-13-2020, 07:02 AM
Post: #32
 SammysHP Member Posts: 151 Joined: Jul 2018
(01-13-2020 03:21 AM)Thomas Okken Wrote:  I hadn't realized there was an actual standard for this kind of thing now! I haven't used modern Linux desktops in years and it shows.

That specification is around for more than 15 years or so.

(01-13-2020 03:21 AM)Thomas Okken Wrote:  I guess while I'm at it, I might as well steal your patch and add support for looking for skins under $XDG_DATA_DIRS/free42/skins, too. Awesome! 01-13-2020, 04:03 PM Post: #33  Thomas Okken Senior Member Posts: 1,726 Joined: Feb 2014 RE: Print42 - thermal printer software for Free42 (01-13-2020 07:02 AM)SammysHP Wrote: (01-13-2020 03:21 AM)Thomas Okken Wrote: I hadn't realized there was an actual standard for this kind of thing now! I haven't used modern Linux desktops in years and it shows. That specification is around for more than 15 years or so. Really? Dang! Maybe I should also mention that even when I have been using Linux desktops in the last 15 years, it was either an ancient CentOS install that I VNCed into from a Mac, running only Eclipse on the Linux box while doing all desktop-type stuff on the Mac... or it was one of my Ubuntu VMs that I pretty much use for nothing else than building and debugging the GTK version of Free42. (01-13-2020 07:02 AM)SammysHP Wrote: (01-13-2020 03:21 AM)Thomas Okken Wrote: I guess while I'm at it, I might as well steal your patch and add support for looking for skins under$XDG_DATA_DIRS/free42/skins, too.

Awesome!

OK, I'll do that sometime this week, and contact you by email in case you want to preview my changes before I create a new Linux release.
01-13-2020, 04:17 PM
Post: #34
 SammysHP Member Posts: 151 Joined: Jul 2018
You could do the work in a new branch, submit a pull request to your own repository and mention me (@SammysHP) in the PR at GitHub. That way I can easily write inline comments.
03-05-2020, 01:43 AM
Post: #35
 tcab Member Posts: 188 Joined: Dec 2017
 [Desktop Entry] Version=1.1 Type=Application Encoding=UTF-8 Name=Free42 Comment=Free42 Calculator Icon=/home/pi/Devel/free42/util/icon/HP-42S.lighter.transparent.png Exec=/home/pi/Devel/free42/gtk/free42bin Terminal=false Categories=Graphics