site  contact  subhomenews

The Zig language

October 21, 2024 — BarryK

Back in 2022 when I was looking around for alternatives to BaCon, did briefly look at Zig, but decided on Nim. Here are introductions to BaCon and Nim:

"The BaCon programming language"
https://easyos.org/dev/bacon/index.html

"The Nim language"
https://easyos.org/dev/nim/index.html

Last couple of days, took another look at Zig; it has grown enormously in popularity since 2022. Why?...

Zig is a relativitely young language, started by Andrew Kelley in 2015. It is a complete compiler, generating binary executables, unlike BaCon and Nim that generate C code and then require a C compiler such as gcc to generate the binaries. I've been "kicking the tyres" of Zig...

I compiled the traditional "Hello World" CLI program, and it is only 3KB. Furthermore, that binary is statically-linked. First impression, that is incredible.

But it gets better; out of the box, the Zig compiler cross-compiles. You can choose any target you want, x86_64 or aarch64 for example. Furthermore, you can specify specific CPUs. I specified the Intel "nocona" CPU for my "Hello World".

Right off, I see why this will appeal to people who code for embedded systems.

The Wikipedia has an overview:

https://en.wikipedia.org/wiki/Zig_(programming_language)

The Zig website:

https://ziglang.org/

img1

There are some great getting-started websites:

"Introduction to Zig"
https://pedropark99.github.io/zig-book/
...online, also available as an ebook or printed.

"Zig Guide"
https://zig.guide/

"Getting started with the Zig programming labguage"
https://blog.logrocket.com/getting-started-zig-programming-language/

I have a particular like for associative arrays, and yes, Zig has them in the standard-library; they are called "hash tables". I also want the language to support regular expressions; it seems need an external library for that.

I have a need to create small statically-linked binaries, for use in the initrd. But they are useful anywhere, as no reliance on glibc or any libc library. Developers will have encountered this problem, when linked against a particular version of glibc, the binary won't work with a different version of glibc. Yes, you can statically-link with glibc when compiling, but the binary is enormous. So, I have used musl. Up until now.

Another thing I like is to write little programs with GUI, that is, Graphical User Interface. Most commonly I do this with shell scripting and one of the GUI tools, such as gtkdialog, xdialog and xmessage. BaCon and Nim also have GUI toolkits; I have used HUG with BaCon.

What about GUI toolkits for Zig? There is a website with links to all-things-Zig:

"Awesome Zig"
https://github.com/zigcc/awesome-zig

I like the look of "capy":

https://capy-ui.org/

https://github.com/capy-ui/capy

img2

Here is another GUI toolkit, not in the Awesome-Zig list:

https://github.com/desttinghim/zig-libui-ng

...awhile back, in 2022, did look at the Nim binding for libui-ng and liked its simplicity.

Finally, some Zig reviews:

From the perspective of a Rust programmer:
https://blog.lohr.dev/after-a-day-of-programming-in-zig

This looks like a sales-pitch:
https://leaddev.com/tech/why-zig-one-hottest-programming-languages-learn

From the perspective of a Go programmer:
https://medium.com/@vladimirvivien/things-i-like-about-zig-as-a-go-programmer-75eb02aab00f

Looks good. The intention is that once Easy Daedalus 6.4 is released, will take some time out from Easy development and play with Zig. As an exercise, might rewrite 'debdb2pupdb' in Zig, see how it compares with the Nim code.

EDIT:
Here is another Zig tutorial, very recent:

"Programming with Zig: from basics to mastery"
https://gencmurat.com/en/pages/programming-with-zig/
   

Tags: linux

BookwormDog build script

September 23, 2024 — BarryK

A very great thing about the Puppy Linux Forum is that it has been the home to incredible creativity. There are many derivatives of Puppy Linux, including the *Dog distributions. I use the word "derivative" rather loosely; The *Dog distros are really Debian or Ubuntu or Devuan distributions made to look like Puppy Linux. Which they do very well.

I want to checkout the latest offerings on the Puppy Forum. Apart from the *Dog distros, there are others including FatDog (nothing to do with the *Dogs; a different pedigree), the KL* distros, VanillaDpup. etc.

Starting with DebianDog, there is a build script for Bookworm:

https://forum.puppylinux.com/viewtopic.php?t=5069

I ran the script:

# ./mklive-bookworm -gui

A huge selection to choose from:

img1

...I chose the Jwm minimal. Next-up, ticked some checkboxes:

img5

First error:

img6

...however, the script did download the deboostrap deb and I was able to install it. Had to run the script again from the start. Then it put up another message that package dpkg is missing. I installed that from PKGget, and it required starting the script from start again.

A few more windows came up, all good, and packages got downloaded. I did see some errors flash by on the terminal:

Preparing to unpack debootstrap_1.0.134_all.deb ...
Unpacking debootstrap (1.0.134) ...
dpkg: dependency problems prevent configuration of debootstrap:
debootstrap depends on wget; however:
Package wget is not installed.

dpkg: error processing package debootstrap (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
debootstrap
Setting up debootstrap in bookworm/chroot

...note, wget is installed. Another error:

Reading package lists... Done         
W: GPG error: http://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E88979FB9B30ACF2
E: The repository 'http://dl.google.com/linux/chrome/deb stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://security.debian.org bookworm-security InRelease
Hit:3 http://deb.debian.org/debian bookworm-updates InRelease
Hit:4 http://deb.debian.org/debian bookworm-proposed-updates InRelease
Get:6 http://dl.google.com/linux/chrome/deb stable InRelease [1825 B]
Get:5 https://github.com/doglinux/book-worm/raw/master/amd64 ./ InRelease [2304 B]
Err:6 http://dl.google.com/linux/chrome/deb stable InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E88979FB9B30ACF2
Reading package lists... Done
W: GPG error: http://dl.google.com/linux/chrome/deb stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E88979FB9B30ACF2
E: The repository 'http://dl.google.com/linux/chrome/deb stable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

The script asked a question about squashfs compression and I chose "xz":

Now we will create compressed kernel: k-6.1.0-25-amd64.squashfs and filesystem: '01-filesystem.squashfs'
Please enter your choice, xz compression will give smaller size than gzip,
but xz takes much longer time to compress
Type gzip or xz :

This is where things went wrong, or so it seems. Lots of error messages flashed by, captured some of them:

[===/    ]   690/21205   3%Failed to read file chroot/proc/irq/6/node, creating empty file
[===/ ] 690/21205 3%Failed to read file chroot/proc/irq/6/smp_affinity, creating empty file
[===/ ] 690/21205 3%Failed to read file chroot/proc/irq/6/smp_affinity_list, creating empty file
[===/ ] 690/21205 3%Failed to read file chroot/proc/irq/6/spurious, creating empty file
[===/ ] 690/21205 3%Failed to read file chroot/proc/irq/7/affinity_hint, creating empty file
[===/ ] 690/21205 3%Failed to read file chroot/proc/irq/7/effective_affinity, creating empty file
[===/ ] 690/21205 3%Failed to read file chroot/proc/irq/7/effective_affinity_list, creating empty file
[===/ ] 690/21205 3%Failed to read file chroot/proc/irq/7/node, creating empty file
[===/ ] 690/21205 3%Failed to read file chroot/proc/irq/7/smp_affinity, creating empty file
[===/ ] 690/21205 3%Failed to read file chroot/proc/irq/7/smp_affinity_list, creating empty file
[===/ ] 690/21205 3%Failed to read file chroot/proc/irq/7/spurious, creating empty file

Then it seemed to be stopped, though the hard drive remained very busy. After about 15 minutes, I typed CTRL-C to quit:

[===/    ]   690/21205   3%Failed to read file chroot/proc/keys, creating empty file
[===| ] 690/21205 3%^CUnmounting mount binds in chroot
#

Should I have waited longer? I will ask on the forum.

EDIT:
Forum member fredx181, the creator of the BookwormDog build script, has fixed it for EasyOS:

https://forum.puppylinux.com/viewtopic.php?p=131626#p131626

That's great!     

Tags: linux

Doubts about Linux rolling releases

September 20, 2023 — BarryK

I have stayed away from rolling releases as I consider them to be inherently unstable, or prone to unexpected side-effects. However, have ventured into playing with Void Linux, see post a couple of days ago:

https://bkhome.org/news/202309/first-experiment-creating-a-void-rootfs.html

I even built "easyVoid"; EasyOS built from Void packages, and it works, with some issues. Installed LibreOffice from the Void package repository; works. However, installed Shotcut video editor, and at startup there was a popup window informing that "libjack0" package is missing.

Well, the version of libjack that it wants isn't in the repository. I had to get it from the Debian repo. Then Shotcut worked.

This has reminded me why I don't like rolling releases. Dependency management has to be very rigorous to work properly in a rolling release, and I have just got an indication that it isn't up to scratch in Void Linux. Unless I hit one very rare example.

But other, very serious, problems can occur, that versioned releases avoid. For example, a couple of years ago there was a version bump of the 'pango' package that caused many applications to misbehave. The misbehaviour might only get noticed sometime later, when users complain. A versioned Linux release might not eliminate that particular problem, but will greatly reduce its likelihood of occurrence or the severity.   

Tags: linux

Apps running as spot extra secure in Puppy

March 27, 2023 — BarryK

I watch what Dima (dimkr in the forum) is doing on woof-CE with great interest. In particular, the steps that he has implemented to enhance security for applications running as user 'spot'.

See his summary here:

https://forum.puppylinux.com/viewtopic.php?p=70405#p70405   

Tags: linux

Puppy Linux S15Pup 64- and 32-bit 22.12 released

December 12, 2022 — BarryK

It is over two years since the last official release of Puppy was announced on Distrowatch. There have been plenty of releases since then, and derivatives; however, none has been presented to Distrowatch as the latest "official" Puppy.

There has been lengthy discussion about what will be the next official pup, and finally, peebee's S15Pup was chosen. The discussion thread is here:

https://forum.puppylinux.com/viewtopic.php?t=7204

Here is the announcement on Distrowatch:

https://distrowatch.com/?newsid=11706

Announcement thread, also for feedback:

https://forum.puppylinux.com/viewtopic.php?t=7464

Snapshot:

img1

Feedback is very positive!   

Tags: linux

FydeOS alternative to ChromeOS works on PCs

October 28, 2022 — BarryK

Today I stumbled across someone mentioning FydeOS, and alternative to ChromeOS. Recalled briefly looking at it sometime ago, decided worth another look...

What attracts me to ChromeOS is support for Android and Linux apps, and FydeOS also has this support. A significant difference is that FydeOS can be installed on "Windows" PCs.

ChromeOS is only available on Chromebooks; however, a bit of online reading revealed that Google have ChromeOS Flex, that can be installed on PCs -- unfortunately, it does not run Android apps, and a bit of further reading indicated problems with Linux apps.

FydeOS website:

https://fydeos.io/

There is also an open-source variant:

https://openfyde.io/

Differences between FydeOS and openFyde are explained here:

https://github.com/openFyde/getting-started

...not quite sure if read it correctly, seems to imply that openFyde does not support Android apps.

Very interesting, a 2-in-1 tablet with FydeOS is planned:

https://fydetabduo.com/

The Fydetab Duo has a pretty good SoC:

https://www.cnx-software.com/2022/01/12/rockchip-rk3588s-cost-optimized-cortex-a76-a55-processor/

Reasonable specs:

https://fydetabduo.com/specs

...12.35 inch screen, stylus, weight with keyboard is 1.32Kg -- rather heavy.

It is being offered on Indiegogo:

https://www.indiegogo.com/projects/fydetab-duo--2#/

Interesting. I could buy a Lenovo 2-in-1 Chromebook locally with similar specs, at about the same price.

It would be very interesting to install FydeOS to one of my PCs. They say it can dual-boot.    

Tags: linux

Vanilla Dpup and Upup progress

May 27, 2022 — BarryK

I have posted before that Dima (dimkr) and Mick (01micko) are developing the "testing" branch of woof-CE. In March 2021, I reported on Dima's work on a Puppy without an initrd, using "frugalify":

https://bkhome.org/news/202103/puppy-linux-without-an-initrd.html

They have also been developing a more traditional next-generation Puppy, pre-fixed "Vanilla-"; currently there is Vanilla-Upup and Vanilla-Dpup, based on Ubuntu and Debian packages respectively. These have an initrd.

I decided it is time to have a look how these Vanilla-* pups are coming along. Downloaded Vanilla Dpup 9.2.0 from here:

https://github.com/vanilla-dpup/releases/releases

Forum thread:

https://forum.puppylinux.com/viewtopic.php?t=6002

And downloaded Vanilla Upup 22.04.39 from here:

https://github.com/dimkr/woof-CE/releases

Forum thread:

https://forum.puppylinux.com/viewtopic.php?t=5290

Only did a quick play with each. Impression was, everything I tried worked. Very smooth, nice UIs, easy connection to my wi-fi. Overall: impressed.

Ha ha, I don't use optical media anymore, but for these took a trip down memory lane, burnt the iso's to CD's and booted them. In the case of Dpup, it took almost 2 minutes (117 seconds) to copy the sfs's to RAM. That would have been a few seconds off a USB-stick. So, reminded how clunky and slow CD's are.

One of the reasons that I have looked at these, is I wanted to see if the Puppy traditional PPM package manager and apt & Synaptic "talk" to each other. They are all installed.

Using Synaptic, I installed Scribus, that went smoothly. But the installed packages did not show up in the PPM. So the answer is "no", they don't talk to each other.

I am getting interested in installing apt and maybe Synaptic in Easy Bookworm, but only if can get it to talk with the PPM.

Just an observation: in my brief experience with installing Scribus, Synaptic did not bring anything superior compared to doing it with the PPM. I tested installing Scribus in Easy Bookworm 0.4, with Easy's own PPM, and it went smoothly, and Scribus worked. Just an observation.    

Tags: linux