[Gambas-user] Possibility to compile old bytecode
chrisml at deganius.de
Fri Jan 24 00:10:23 CET 2020
Am 23.01.20 um 19:00 schrieb Tobias Boege:
> On Thu, 23 Jan 2020, Benoît Minisini wrote:
>> If you know that you don't use new language feature, you can force the
>> compiler to save a specific bytecode version with the GB_PCODE_VERSION
>> environment variable. For example GB_PCODE_VERSION=3.8.
>> Beware that it "does not compile to older bytecode". You need an older
>> compiler for that. So if you use it incorrectly, the interpreter will
>> segfault, abort or have an undefined behaviour.
>> The better being not to use a development version for production code!
Yes, sure. I thought about the time when 3.15 is out and I still have to
deploy to machines running 3.9 or 3.12.
> The easiest proper fix -- I'm not sure if you're aware of it -- is to
> upload the source archive of the project to the production machine,
> force a recompilation of it with the old compiler (`gbx3 -a`) there
> and then run it. This will politely tell you if your Gambas code uses
> features that are too new for the old runtime (no undefined behaviour),
> even if the bytecode version is compatible.
I could do this as I deploy with Debian Apt and there I can control
everything. The Gambas projects are compiled and packed in .deb files by
make and shellscripts and then pushed to the Apt repository. The caveat
is that I had to rewrite the whole process if it should deliver the
sources, test and build on the target machines ... that costs time ...
> There is only a problem if you must distribute a .gambas file without
> the source code to the target.
Great, thank you both for the answer! Now I have an idea what I can do,
so I will find a solution later.
Dies ist keine Signatur
More information about the User