Running PureBasic on non Ubuntu based distros
Running PureBasic on non Ubuntu based distros
Hi all,
I've wanted to share this for a long time. I find myself having to run PureBasic on Linux distros which aren't based on Ubuntu. Which as you can imagine makes it hard to get it all working. So I stuffed PureBasic into a Apptainer container. I can now run it anywhere I want to and need to. If anyone is interested on building there own container for it, I can provide my build file. Now you will need to download your own copy of PureBasic and slightly rename the file and then run a build. Now if your wondering why I choose Apptainer for this VS Docker or Podman, then I'll tell you. Docker could do it and I have done, but GUI applications under Docker are a pain. Podman would work a bit better, allowing it to function properly would still require a little trickery. Apptainer, by its very nature is extremely well suited to this without any kind trickery required. Also the programs the compiler spits out run fine on pretty much any distro I've tested them on so they aren't a concern. So if anyone is interested then please let me know I'll probably post it to one of my repos.
I've wanted to share this for a long time. I find myself having to run PureBasic on Linux distros which aren't based on Ubuntu. Which as you can imagine makes it hard to get it all working. So I stuffed PureBasic into a Apptainer container. I can now run it anywhere I want to and need to. If anyone is interested on building there own container for it, I can provide my build file. Now you will need to download your own copy of PureBasic and slightly rename the file and then run a build. Now if your wondering why I choose Apptainer for this VS Docker or Podman, then I'll tell you. Docker could do it and I have done, but GUI applications under Docker are a pain. Podman would work a bit better, allowing it to function properly would still require a little trickery. Apptainer, by its very nature is extremely well suited to this without any kind trickery required. Also the programs the compiler spits out run fine on pretty much any distro I've tested them on so they aren't a concern. So if anyone is interested then please let me know I'll probably post it to one of my repos.
-
- Enthusiast
- Posts: 112
- Joined: Wed May 13, 2009 8:38 am
- Location: Arizona, USA
Re: Running PureBasic on non Ubuntu based distros
I would be interested. Thank You for taking the time to create and share this solution.
Re: Running PureBasic on non Ubuntu based distros
Hi,
Sorry for the delay. I lost this thread a little when I was messing with settings. Anyhow to answer your question. I'm going to go over the steps needed and I'll link the def file I use for apptainer.
1. Get and install apptainer. https://apptainer.org/
2. Download a copy of purebasic and your going to want to put this in the same place you put the .def file that builds the container. You should also rename it to just purebasic.tar.gz as that is what is specified in the def file.
3. Grab the .def file for apptainer. https://urandom.link/purebasic.def
4. Open a terminal in that directory or just cd into it.
5. Run this command
Once that is done just run purebasic.sif. You literally just run by doing a ./purebasic.sif in the directory where apptainer built the container. I currently run purebasic this way under Garuda Linux which is Arch Linux based. It works quite well even with wayland being my graphics server.
Notes
The def file builds a container based off of Ubuntu 22.04. I stuck with that as my attempts to run purebasic directly on a Ubuntu 24.04 install kind of failed at the time. You can also optionally create desktop launcher or menu item for it. Also apptainer will give the IDE full access to your home directory so it will behave pretty much as if you had installed it like any other app on the system. This is partially why I choose apptainer for this because it integrates so well. The purebasic examples are accessible at /opt/purebasic/examples. Just open that path as you normally would in the PureBasic IDE. Of course any changes you make you have to write location where you can save files too. I'm also open to ideas to improve the container. I'm thinking of creating a companion app to make building and integration even simpler.
Sorry for the delay. I lost this thread a little when I was messing with settings. Anyhow to answer your question. I'm going to go over the steps needed and I'll link the def file I use for apptainer.
1. Get and install apptainer. https://apptainer.org/
2. Download a copy of purebasic and your going to want to put this in the same place you put the .def file that builds the container. You should also rename it to just purebasic.tar.gz as that is what is specified in the def file.
3. Grab the .def file for apptainer. https://urandom.link/purebasic.def
4. Open a terminal in that directory or just cd into it.
5. Run this command
Code: Select all
apptainer build purebasic.sif purebasic.def
Notes
The def file builds a container based off of Ubuntu 22.04. I stuck with that as my attempts to run purebasic directly on a Ubuntu 24.04 install kind of failed at the time. You can also optionally create desktop launcher or menu item for it. Also apptainer will give the IDE full access to your home directory so it will behave pretty much as if you had installed it like any other app on the system. This is partially why I choose apptainer for this because it integrates so well. The purebasic examples are accessible at /opt/purebasic/examples. Just open that path as you normally would in the PureBasic IDE. Of course any changes you make you have to write location where you can save files too. I'm also open to ideas to improve the container. I'm thinking of creating a companion app to make building and integration even simpler.
Last edited by kake26 on Fri Sep 20, 2024 9:09 pm, edited 1 time in total.
Re: Running PureBasic on non Ubuntu based distros
how do it handle the dependencies (gtk-dev etc.) ? It should be installed as well ?
Re: Running PureBasic on non Ubuntu based distros
Ubuntu is not a base distribution, Ubuntu is itself based on Debian which is itself the basis of many other distributions. So if you only need to learn and use one, you might as well use Debian.[...] I find myself having to run PureBasic on Linux distros which aren't based on Ubuntu [...]

Re: Running PureBasic on non Ubuntu based distros
Everything should be in the container. I used the install documentation in the purebasic download to craft and tweak the container as needed. I based it off Ubuntu 22.04 as well as I ran into issues with 24.04. I've had no issues with purebasic running in a apptainer container nor the resulting executables it produces. The programs I've made with it so far have even run just fine under Wayland using Xwayland. I've run the container and the programs I've built under various distros as well. From kubuntu to KDE neon to garuda Linux. Upgrading the ide does require you to rebuild the container though. Also note the container is a bit large, but that is really a small price to pay having purebasic run wherever I want and need it to.Fred wrote: Fri Sep 20, 2024 7:47 am how do it handle the dependencies (gtk-dev etc.) ? It should be installed as well ?
Re: Running PureBasic on non Ubuntu based distros
I am quite aware of that fact. Thank you for reminding me though.Marc56us wrote: Fri Sep 20, 2024 8:06 amUbuntu is not a base distribution, Ubuntu is itself based on Debian which is itself the basis of many other distributions. So if you only need to learn and use one, you might as well use Debian.[...] I find myself having to run PureBasic on Linux distros which aren't based on Ubuntu [...]![]()
Re: Running PureBasic on non Ubuntu based distros
Which size is the container ? How do you run it once downloaded ?
Re: Running PureBasic on non Ubuntu based distros
The size I will have to look to confirm, but 400 ish mb. As far as running it you can run the container in the same fashion you can run any program. A simple ./purebasic.sif from a terminal or you could make a launcher. I added it manually to my KDE menu.
Re: Running PureBasic on non Ubuntu based distros
Thanks for the infos. How do you access the examples file from container ? can you modify them ?
Re: Running PureBasic on non Ubuntu based distros
The examples are easy to access. They will be under /opt/purebasic/examples. So when the IDE is running just do a file open and navigate to that spot. As far as modifying them yes you can, but of course you will have to save the modified copy else where. Technically you could work some wizardry make it seem and feel like you can modify the container, but thats a ways more advanced thing which I not going to go into. Oh there is one more thing I wanted to mention. If you run it on wayland like I do you may see a error like the one below.Fred wrote: Fri Sep 20, 2024 9:06 am Thanks for the infos. How do you access the examples file from container ? can you modify them ?
You can fix it by running./purebasic.sif
(process:18271): Gtk-WARNING **: 14:54:45.368: Locale not supported by C library.
Using the fallback 'C' locale.
Authorization required, but no authorization protocol specified
(purebasic:18271): Gtk-WARNING **: 14:54:45.382: cannot open display: :1
Code: Select all
xhost +local:
- greyhoundcode
- Enthusiast
- Posts: 112
- Joined: Sun Dec 30, 2007 7:24 pm
Re: Running PureBasic on non Ubuntu based distros
I don't know if it will work as you need the -dev packages to compile a new app.
Re: Running PureBasic on non Ubuntu based distros
Well given how a snap works. Yes, it would very likely work. Snaps are based off a common runtime VM. I don't see why flatpak wouldn't work either. I mean they all exist for that purpose. To package apps and all their required bits and pieces.greyhoundcode wrote: Sat Oct 19, 2024 5:18 pm I hope this isn't construed as hijacking the thread, but with essentially the same end-goal in mind ... I wonder if an official Snap (or Flatpak) package would be a viable way to distribute the Purebasic IDE and compiler?![]()
Re: Running PureBasic on non Ubuntu based distros
I just checked the install script I wrote for Fedora for Pure and Spider basic. It still works with the 24.04 ubuntu packages and Fedora 41. It should be near the top of the Linux messages right now.