Can't run on Pi any longer
Posted
#1
(In Topic #479)
Enthusiast

when I attempt to run a new verson of the programs I wrote I get this…
ERROR: #2: Cannot load class 'FMain': Bytecode too recent. Please upgrade Gambas.
Gambas is up to date on the pi. Version 3.12.2 When I to the apt-get upgrade Gambas3 it tells me everything is up to date. However attempting to run the program gives the error still. Any Help?
Posted
Regular

Try opening the project in Gambas on the Pi, then menu Project > Compile All. It should now run.
Posted
Enthusiast

Posted
Guru

Is that the case? (initially)
There's an undocumented (and little known about) Environment variable to fix this.
In the project settings on the newer gambas IDE go to "Environment" and add a variable
GB_PCODE_VERSION and set it to 3.8
That will fix the bytecode error when running an app on a lesser gambas runtime and may fix your error too.
If you have compiled the app on the same gambas that it errors on then there must be a conflict somewhere,
ie an older version runtime on the system.
I'd recommend a re-install
or if you have downloaded and compiled gambas then your previous repository install and compilation install will conflict.
Hope this helps
Posted
Enthusiast

Posted
Guru

maybe upgrade the gambas to 3.15?
Posted
Guru

There has to be a way…
Maybe deleting the contents of the .gambas directory in the projects folder could force a rebuild of the app?
Posted
Guru

The PCODE variable should make an app work on anything down do gambas 3.8
are write access permissions okay on the folder/files?
pcode variable set like this…
(attachment removed)
That should work unless the executable has not compiled correctly.
Maybe try compiling the app on another machine, even if has gambas 3.15 using the PCODE variable should make it compatible.
Unless the app has specific modern code that doesn't exist for a lesser gambas.
I have a few apps and none of them compiled on 3.15 fail to work on 3.12 with the GB_PCODE_VERSION=3.8 set in its settings.
Posted
Guru

If yes then it must be the app itself.
If so i'd recommend the best thing to do is open the .gambas folder in the projects directory and delete the FMain (and any other) file in there. then the compiler will re-make it for your gambas.
Posted
Enthusiast

As far as removing fmain that is the program. deleting that would be deleting the program? am I thinking right?
I can write a program on the pi (which is not what I usually do because the program goes many places) and that is ok, but instead of focusing on the program would it not be best to focus on updating gambas runtime? That seems to be the issue and all apt-get says that gambas 3.12 is the most up to date.
Posted
Regular

If you want to be able to open and edit your Gambas projects on your systems (e.g. laptop, Pi & so on) I'd suggest you either upgrade or downgrade so that each system is running the same Gambas version. Although the Pi repository that you are using has an older version, you can usually still upgrade Gambas using another technique. See "Compilation & Installation" at http://gambas.sourceforge.net/en/main.html# …or ask gbWilly who has been the guru for this for many years.
But if you only want to run your Gambas 'exe' on the Pi, then you could try creating an installation package via your 3.15 system, and install this on the Pi. This will probably work as long as there are no other fundamental dependency issues.
Posted
Guru

Posted
Regular

cogier said
I installed Ubuntu Mate on a Pi 4…
That's a good idea Charlie, its probably the Raspbian OS that doesn't have the up-to-date version.
Posted
Guru

sadams54 said
As far as removing fmain that is the program. deleting that would be deleting the program? am I thinking right?
I can write a program on the pi (which is not what I usually do because the program goes many places) and that is ok, but instead of focusing on the program would it not be best to focus on updating gambas runtime? That seems to be the issue and all apt-get says that gambas 3.12 is the most up to date.
No if you have the Gambas IDE than the program is just the source code in the .src dir and a couple of settings files in the main dir.
when you compile and make the executable it makes the FMain file and any other class/form executables in the .gambas folder.
the compiler you are trying to use wont seem to overwrite the FMain you have as the interpreter is still saying a bytecode mismatch.
if you delete the files in the .gambas/ folder manually it should re-create them on the next compile.
That's technically what selecting "Compile All" should do.
I can only assume a folder/file permission/ownership issue is happening there.
It's worth a try.
easy enough to make a backup and then try.
And i'm working on installing 3.15 on raspian. i got wiki up to date with dependencies but the compile failed complaining about PDFDoc problems.
I need to get some help from the folks on the mailing list i think.
Posted
Guru

stevedee said
cogier said
I installed Ubuntu Mate on a Pi 4…
That's a good idea Charlie, its probably the Raspbian OS that doesn't have the up-to-date version.
It's not so much "Raspian" as it is "Debian" I've got Debian Buster on my proper pc and all i get is 3.12 on that too
Although compiling 3.15 was successful on my Debian.
Posted
Enthusiast

I prefer to not compile my own full gambas just for that one. I like to stick to the repositories. Less work keeping things update for me that way.
Thank you all for the help so far. I will let you know how it goes.
Posted
Enthusiast

Posted
Guru

I added sid to my main pc's debian and found Gambas 3.15.2 is there but i do not know if raspian has it's own version as i couldn't add the debian sid to raspian
I understand about thinking the Debian/Raspian distros should be more up to date, it's a shame it's out of the Gambas developers hands.
And fully agree on not wanting to compile. especially on Raspberry, I've spent hours trying to compile gambas and it's still not working.
But for me gambas 3.12 works fine and all my projects load into it and re-compile okay.
I'm convinced your issue must be a folder/file permission/write access type of thing going on.
For gambas to not be able to create the exe's in the .gambas dir is a big issue and i think that the new version will probably have the same issue too.
My questions would be..
Did you copy or unpack the app folder as root?
If it is a permissions thing going on try running the gambas IDE as root (sudo gambas3) and see if app compiles then.
or try a chown on the folder to own it.
sudo chown -hR username projectfolder
Are you remembering to press the "Compile All" option in gambas before pressing the "run" button when moving app from one gambas version to the other.
It's a puzzle for sure
Never say die my friend, we'll crack this
Posted
Guru

That should totally work. !? EVERY app i've compiled on 3.15 has worked for me without recompile on 3.12.
Are you sure you got that bit right?
But again you MUST remember to press "Compile All" to make sure ALL exe's in the .gambas dir get remade.
Post the project if you like. and i'll take a crack at it. i got a fresh Pi here with gambas 3.12 to test it on
hmmm, fresh PI
Posted
Regular

Debian 'stable' releases are typically released every 2 years or so and are very stable. That's the main reason for using Debian and one of the reasons for so many other distros using it as a base. However, if you need a Linux OS with a shorter release interval, there are plenty of others to choose from.
Raspbian is a special Pi version of Debian for Arm processors with a similar release interval. So Raspbian is also very stable, and there are other Pi OS alternatives with shorter release intervals.
Debian has a development branch code-named 'Sid' which is always unstable (think Toy Story). So Sid is generally best avoided. Debian also has a 'testing' branch which is a better bet than Sid (i.e. less likely to have unresolved problems).
Currently;
stable = Buster
testing = Bullseye
unstable = Sid
I hope that helps.
Posted
Enthusiast

I used cut and paste to put the environment variable in. So as long as you typed it correctly in the first reference, it is right on mine. Raspian has not been my favorite distro, I would love to see fedora working reliably on pi3 and 4.
So we all keep it str8, I do not develop on the pi. I use a standard pc with fedora 32 on it. The pi is just in the background performing tasks and just accepts the program updates. That is of course how I ran into the issue of 3.15 vs 3.12.
New ideas welcome
Posted
Regular

sadams54 said
,,,New ideas welcome
OK, so my suggestion is that you zip up your project file and post it here. That will allow us to run it in the IDE on our own Pi hardware.
If you don't want us to see your project, just make a simple "Hello World" program, and as long as it exhibits the same problems, that will be fine for our testing.
Posted
Posted
Enthusiast

Posted
Regular

BruceSteers said
What "should" also be working too is entering the GB_PCODE_VERSION 3.8 Environment variable into your IDE…
I checked this today by making a simple 'hello world' app using v3.15.2 and confirmed it would not run in the IDE when copied to systems running v3.8.4 and v3.12.2.
Back on the v3.15.2 system, I went to menu Project > Properties > Environment and added the variable "GB_PCODE_VERSION" and gave it the value "3.8"
I then did "Compile All" and saved the project, deleted the old folders on the v3.8.4 and 3.12.2 systems before copying the updated project folder to both. The project now runs on all 3 versions of Gambas. The v3.12.2 Gambas is on a Pi running Raspbian Buster.
This 'pcode' feature was added with the introduction of Gambas v3.4. When it has been correctly setup, the .project file should contain the string:-
Environment="GB_PCODE_VERSION=3.8"
1 guest and 0 members have just viewed this.


