How To: New Update of Rebol 3 Scripting Language for ARM Boards
If you are into scripting, like I am, it is super nice to be able to have a variety of tools for different needs. In this article, I'll be going over a few details of the super-lightweight open-source Rebol 3 scripting language which runs on all ARM boards running a Linux OS. The main language is developed by Atronix Engineering, and the GUI dialect component is developed by Saphirion AG. Enter the following into a terminal window on the system you wish to install on:
Enter the following to start Rebol 3:
Depending on the system, additional libraries may need to be installed. If r3 errors out when trying to start it, try the following commands:
Performing other tasks like making sure gcc was the latest version didn't help. So I pulled a newer version of libstdc++.so.6 from an XU4 running "Ubuntu 18.04.1 LTS" (Ubuntu is a close Linux relative of Debian, and the XU4/XU4Q/HC1/HC2/MC1 models are all hardware-compatible), and that resolved the problem. I've placed that library on one of our servers in case you need it. If so, use the following two commands to install it:
sudo mv libstdc++.so.6 /usr/lib/arm-linux/gnueabihf/.
On some versions of Linux, you may have to run the following command in place of the second command above as the target directory is different:
sudo mv libstdc++.so.6 /usr/lib/arm-linux-gnueabihf/.
While trying this out on an ODROID-N2 running "Debian GNU/Linux 9.11 (stretch)", and also on an SOPINE A64 Compute Module, I received the following error:
bash: ./r3: No such file or directory
Run the following commands to correct this:
sudo dpkg --add-architecture armhf
sudo apt update
sudo apt install libc6:armhf libncurses5:armhf libstdc++6:armhf
sudo apt install libxrandr2:armhf libfontconfig1:armhf
sudo apt install libx11-6:armhf libxaw7:armhf libfreetype6:armhf
Note that all the armhf notations above are preceded by a colon (:) and not a period (.).
Once I ran the above, I was able to run r3.
Comment below with details if you run into any other problems and we'll try to help you.
Once at the R3 prompt denoted by >>, enter the following to load the GUI component:
Graphical interfaces can be made as simply as this:
view [title "Test"]
You can save an image of any GUI you create by replacing view with layout/gob and then saving it:
The image will be saved in the format specified by the file extension in the save command.
Like the Lisp programming language, R3 can pass the output of one function directly as a parameter to another function, like this:
save %test.png (to-image (layout/gob [title "Testing"]))
The parentheses are only used to make the grouping more readable to the programmer, so you will usually see experienced Rebol programmers write the above like this instead:
save %test.png to-image layout/gob [title "Testing"]
You can even run R3 examples straight off Github from within the R3 console:
If you want to save the GUI component locally so you don't need to download it from the Internet each time, enter the following:
save %r3-gui.r3 load to-string read http://rebol.atronixengineering.com/r3/r3-gui.r3
Then, instead of typing load-gui, do the following:
You can read a tutorial on the R3 language at http://learnrebol.com/rebol3_book.html
You can read a tutorial on the R3-GUI graphics dialect for R3 at http://development.saphirion.com/rebol/r3gui/
More examples of R3-GUI can be found at https://github.com/saphirion/documentation/tree/master/r3/r3-gui/examples
Leave a comment