[Solved] Getting OHRRPGCE to run on linux, help needed :-(

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

User avatar
DWRL
Red Slime
Posts: 35
Joined: Wed Jan 15, 2020 2:26 am
Location: Germany
Contact:

[Solved] Getting OHRRPGCE to run on linux, help needed :-(

Post by DWRL »

Hello,
this is my first post here, and a rather long one, so sorry for the text wall, and hello to everybody ;D

In trying to get as much (hopefully helpful) information about my problem together as possible, this post will have a certain length :angel:

I currently try to get ohrrpgcelinux binaries to run, to no avail. At the moment I can run the windows binaries of custom and game using wine, while fortunately the hspeak linux binary works (contrary to the windows hspeak binary), so while I can more or less use it, it all is a bit cumbersome...

My system is current manjaro (i.e., an archlinux derivate).

Using the Linux x86_64 binary tarball from the Download site, hspeak works,
but custom needs libncurses.so.5, while on my system I have libncurses.so.6.
I tried using a link (libncurses.so.5 -> libncurses.so.6), but it seems those are not binary compatible.

Using
objdump -p ohrrpgce-game on the binary gave me libtinfo.so.5, of which I have version 6 installed as well, and libgcc_s.so.1, which I haven't found at all (looks like some gcc thingy, though).


Next I tried compiling from source.
It seems the python scripts are written in python2, and my scons module was versioned for 3.8.
Thus I converted autotest.py, hspeaktest.py, ohrbuild.py and SConsctruct to python3, with the following result:

Code: Select all

~/bin/ohrrpgce/src >>> scons
scons: Reading SConscript files ...
TypeError: cannot use a string pattern on a bytes-like object:
  File "/home/tarl/bin/ohrrpgce/src/SConstruct", line 4:
    SConscript('SConscript', variant_dir = 'build/', duplicate = False)
  File "/usr/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 660:
    return method(*args, **kw)
  File "/usr/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/usr/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/tarl/bin/ohrrpgce/src/SConscript", line 70:
    fbc_binary, fbcversion, fullfbcversion, default_target, default_arch = ohrbuild.get_fb_info(fbc)
  File "/home/tarl/bin/ohrrpgce/src/ohrbuild.py", line 218:
    version, date = re.findall("Version ([0-9.]+) ([0-9()-]+)", fbcinfo)[0]
  File "/usr/lib/python3.8/re.py", line 239:
    return _compile(pattern, flags).findall(string)
I'm not too knowledgable about scons, but I tried quick fixing the code, replacing fbcinfo with str(fbcinfo) in lines 218, 223 and 227 of ohrbuild.py, with the following result:

Code: Select all

~/bin/ohrrpgce/src >>> scons
scons: Reading SConscript files ...
TypeError: a bytes-like object is required, not 'str':
  File "/home/tarl/bin/ohrrpgce/src/SConstruct", line 4:
    SConscript('SConscript', variant_dir = 'build/', duplicate = False)
  File "/usr/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 660:
    return method(*args, **kw)
  File "/usr/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/usr/lib/python3.8/site-packages/SCons/Script/SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/tarl/bin/ohrrpgce/src/SConscript", line 350:
    gccversion = int(fullgccversion.replace('.', ''))  # Convert e.g. 4.9.2 to 492
So, no luck.

Finally, I tried installing python2-scons instead of messing around, but that wouldn't even build, throwing me:

Code: Select all

Exception in thread "main" java.lang.NoSuchMethodError: java.nio.CharBuffer.limit(I)Ljava/nio/CharBuffer;
I have to note python2-scons is from the AUR (i.e., not supported on my distribution), though...
(On a side note, java? ok... :???: )


So in conclusion:
1: Does the scons script(s) need updating?
I am a bit python savvy, but I know jack about scons. If there is not already work behind the scenes regarding this, I could try to have a look at it and port the scripts over to python3 and look what might have changed in current scons to prompt this error (and try to fix it).
But, I usually write in python to not have to worry about things like that, so I am not up to speed on build systems in general.

2: New binaries?
I see how the binaries from the linux tarball might run on debian, and thus on its myriad derivatives (ubuntu and its whole family tree).
But since I have libncurses and libtinfo in version 6 instead of 5 on manjaro, both new versions are down the road for everyone else, too, over the next six to eighteen months.
Maybe a new build linking the preferred versions statically for the time being, or two using the 'debian compatible' library set, and one using the current?

And, finally, does have someone managed to build ohrrpgce on current arch or manjaro, and would feel like sharing the binaries with me? :D
(And, if so, what did you have to do to get it compiling, i.e. do you have already made the aforementioned changes to the build system and feel like sharing?)

So, this was rather long.
Then again, I guess we should address this before debian (and its whole familiy, as well as fedora and suse) finally drop python2 and roll-out the new libraries :)
Thank you for reading (and maybe helping :) )

All the best,
Daniel
Last edited by DWRL on Sun Feb 02, 2020 1:09 pm, edited 1 time in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Welcome! And thank you for the report and writeup.

I'm happy to give you a linux build against libncurses.so.6. (Give me a few minutes.)

Alas, ncurses and tinfo are a big headache for compatibility of binaries between linux distros, including for FreeBasic programs.
And I believe tinfo is a library you're technically not meant to link statically, because it has many (globally installed) data files which are meant to be from the same version.
My own distro, Slackware, includes both libncurses 5 and 6, for compatibility (but it didn't previously do that).

In future, we could compile the OHRRPGCE with a build of FreeBasic compiled without a dependency on ncurses or terminfo, since we don't actually need them.
We try to make our linux binaries work on old systems (which currently means since roughly 2011, I think, but I'd be happy with ~2015).

I'm surprised to see that objdump -p lists libtinfo.so as a dependency, but ldd doesn't.
On systems that have libncurses but not libtinfo, you can just symlink libtinfo to libncurses (of the same version) to fix errors about libtinfo. See, libtinfo is part of ncurses, which can be compiled either as a single .so, or split into two. The ncurses devs very unfortunately left it up to distro maintainers to decide which way to do it.

Hmm, is there actually a need to port our scons-based build system to Python 3? I know Python 2.7 is no longer maintained as of two weeks ago, but every distro will still have python 2.7, right? So I assumed installing scons for python 2.7 wouldn't be a problem. So of course I do want to switch to Python 3 at some point, but I didn't think it was important.

I have no idea what that java error message is. Sconscript has support for building Java programs, so possibly it's doing some test build?

If you want to build it, I suggest you install scons for python 2.7 using pip2 instead of using that AUR package. If you don't want to do it system wide or in a user-local site-packages directory (pip2 install --user scons ... which might clash with your globally installed scons), then you can install it in a virtualenv instead.
Last edited by TMC on Wed Jan 15, 2020 1:06 pm, edited 4 times in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

<s>OK, here's a build of Fufluns. The difference in date is inconsequential.

http://tmc.castleparadox.com/ohr/ohrrpg ... 64.tar.bz2 (8.7MB)
http://tmc.castleparadox.com/ohr/ohrrpg ... x86_64.zip (945KB) - You don't need this, but just in case
</s>

BTW, I see that if you run 'pip3 install --user scons', you end up with a ~/.local/bin/scons script which is identical to the /usr/bin/scons script (if they are the same version); it still has a leading line of "#!/usr/bin/env python`, so you'd have to manually run scons as e.g. python2 ~/.local/bin/scons.


EDIT: Whoops! I forgot that we intentionally link against libncurses.so.5, for portability to old distros, as I mentioned. Let me try again.
Last edited by TMC on Wed Jan 15, 2020 1:20 pm, edited 2 times in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

OK, tried again.
Aside from the ncurses change, I also ran into and fixed an infinite loop. I think that the official linux builds don't have that problem since it occurs only when doing a 'scons release=1 arch=x86_64' build on a machine with very recent glibc version.

http://tmc.castleparadox.com/ohr/ohrrpg ... 64.tar.bz2 (8.7MB)
http://tmc.castleparadox.com/ohr/ohrrpg ... x86_64.zip (945KB) - You don't need this, but just in case
Last edited by TMC on Wed Jan 15, 2020 1:49 pm, edited 1 time in total.
User avatar
DWRL
Red Slime
Posts: 35
Joined: Wed Jan 15, 2020 2:26 am
Location: Germany
Contact:

Post by DWRL »

Thank you for the fast reply, and sorry for the late of mine, I posted before I got off to work -_-

When I tried running your build, I was a bit put off by my system telling me there to be no libncurses.so.6... guess I misread libncursesw.so.6 *facepalm*

But, your idea about pip was right of course. I don't use pip usually (it is a nice way to mess with your package management), so it didn't ever cross my mind, much less installing locally. Worked like a charm :)

All I had to do was changing all instances of "#!/usr/bin/env python" to "#!/usr/bin/env python2", change the permissions of "reloadbasic/reloadbasic.py" to ug+x and run scons with "/usr/bin/env python2 $(which scons)".
Ohrrpgce-custom as well as ohrrpgce-game compiled smoothly :D

Hspeak on the other hand wouldn't compile:

Code: Select all

~/bin/ohrrpgce/ss/fufluns >>> /usr/bin/env python2 $&#40;which scons&#41; hspeak
scons&#58; Reading SConscript files ...
Using target&#58; linux  arch&#58; x86_64  gcc&#58; gcc  cc&#58; gcc  gcctarget&#58; x86_64-pc-linux-gnu  gccversion&#58; 920  fbcversion&#58; 1071
scons&#58; done reading SConscript files.
scons&#58; Building targets ...
scons&#58; *** &#91;hspeak&#93; AttributeError &#58; 'NoneType' object has no attribute 'get_ninfo'
scons&#58; building terminated because of errors.
Funny, seeing how hspeak was the one binary of the release package working out of the box on my machine, so for the time being I'm gonna use this xD


About python 2, at least on manjaro/arch I can feel it getting phased out for quite a while now, with my python env defaulting to python 3 (since at least 2015 I'd guess?), and more and more python 2 packages getting axed / moved to the aur. I guess other distributions will follow suit at least within the next one or two years, but I might be wrong on this.

Explicitly stating python 2 wouldn't hurt, so here is the diff:

Code: Select all

diff -ruN fufluns/autotest.py fufluns3/autotest.py
--- fufluns/autotest.py	2020-01-12 05&#58;21&#58;36.000000000 +0100
+++ fufluns3/autotest.py	2020-01-15 22&#58;16&#58;33.312811655 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 import optparse
 import subprocess
diff -ruN fufluns/hspeaktest.py fufluns3/hspeaktest.py
--- fufluns/hspeaktest.py	2020-01-12 05&#58;21&#58;36.000000000 +0100
+++ fufluns3/hspeaktest.py	2020-01-15 22&#58;16&#58;39.512733610 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 """
 This is a tool for automated testing of HSpeak, specifically checking
diff -ruN fufluns/ohrbuild.py fufluns3/ohrbuild.py
--- fufluns/ohrbuild.py	2020-01-12 05&#58;21&#58;04.000000000 +0100
+++ fufluns3/ohrbuild.py	2020-01-15 22&#58;16&#58;45.292660739 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 """
 Various utility functions used by SConscript while building, but could also be
diff -ruN fufluns/reloadbasic/reloadbasic.py fufluns3/reloadbasic/reloadbasic.py
--- fufluns/reloadbasic/reloadbasic.py	2020-01-12 05&#58;21&#58;28.000000000 +0100
+++ fufluns3/reloadbasic/reloadbasic.py	2020-01-15 22&#58;17&#58;07.282382510 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 import os
 import sys
 import re
diff -ruN fufluns/SConscript fufluns3/SConscript
--- fufluns/SConscript	2020-01-12 05&#58;21&#58;03.000000000 +0100
+++ fufluns3/SConscript	2020-01-15 22&#58;16&#58;50.972589018 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 """Main scons build script for OHRRPGCE
 Run "scons -h" to print help &#40;and "scons -H" for options to scons itself&#41;.
 
I will look into updating to python 3 at the weekend, but for now I'm quite happy, thank you :D
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Help switching the build system to support python 3 and well as 2 would be very welcome! I'll start by applying that 'python2' patch.

I knew that Arch switched 'python' to default to python3 instead of python2 years ago, but I actually had thought it was was very problematic and I pretty much assumed they'd switched back! I actually didn't expect all other distros to ever follow and make 'python' point to python3, but I'm starting to think it could eventually happen.

You don't have a non-wide ('w' suffix) libncurses.so? Sigh. That's another ncurses problem.
I'm going to get rid of the ncurses dependency (in "scons portable=1" builds) by linking to a set of stub functions instead of to libncurses.

To compile HSpeak you need to have Euphoria installed. That error message is thrown from inside SCons and it's a little tricky to figure out where the actual problem is. But I think some function in our SConscript that is meant to return a Node is instead returning None.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I've completely removed the libncurses dependency. I'd like to hear from anyone that had a problem before whether the official nightly builds now run on their system. Especially old Linux systems, which haven't been tested at all.

http://hamsterrepublic.com/ohrrpgce/nig ... 86.tar.bz2
http://hamsterrepublic.com/ohrrpgce/nig ... 64.tar.bz2
User avatar
DWRL
Red Slime
Posts: 35
Joined: Wed Jan 15, 2020 2:26 am
Location: Germany
Contact:

Post by DWRL »

Sorry for replying so late, the week was busy :zombie:

First, the new nightly builds run out of the box on my system :)

>>(...) Arch switched 'python' to default to python3 instead of python2 years ago, [I ... assumed] they'd switched back!
I was running debian until some years ago, and programming in python was always painful, with me often finding deprecation notes on the versions debian had (i.e., making me essentially writing programs straight into obsolescence). Of course, debian now has a faster release cycle.


It seems byte to string conversion is explicit instead of implicit on python3, which was the source of most of the errors I encountered.
I fixed them as they came up at during the build process, which, I admit, is a bit hacky/lazy.

Right now the build fails at the actual building stage, I get a bunch of definition warnings and it terminates.
Since I've only skimmed the scons documentation, I'm at a loss here, maybe you can find the problem, otherwise I will look deeper into this as over the next few days.
Somehow I couldn't upload the zip here, so here is a link to the modified files:

http://www.dwrl.de/misc/p3files.zip

Error Output:

Code: Select all

~/ohrsrc/fufluns >>> scons
scons&#58; Reading SConscript files ...
Using target&#58; linux  arch&#58; x86_64  gcc&#58; gcc  cc&#58; gcc  gcctarget&#58; b'x86_64-pc-linux-gnu'  gccversion&#58; 920  fbcversion&#58; 1071
scons&#58; done reading SConscript files.
scons&#58; Building targets ...
fbc -c build/bmod.rbas.bas -o build/bmod.rbas.o -mt -g -exx -O 2 -target linux -arch x86_64 -gen gcc -Wc -fno-omit-frame-pointer,-no-pie,-Wno-maybe-uninitialized,-Wno-array-bounds,-Wno-format,-Wno-missing-braces -d IS_GAME -m game
fbc -c build/menustuf.rbas.bas -o build/menustuf.rbas.o -mt -g -exx -O 2 -target linux -arch x86_64 -gen gcc -Wc -fno-omit-frame-pointer,-no-pie,-Wno-maybe-uninitialized,-Wno-array-bounds,-Wno-format,-Wno-missing-braces -d IS_GAME -m game
fbc -c build/moresubs.rbas.bas -o build/moresubs.rbas.o -mt -g -exx -O 2 -target linux -arch x86_64 -gen gcc -Wc -fno-omit-frame-pointer,-no-pie,-Wno-maybe-uninitialized,-Wno-array-bounds,-Wno-format,-Wno-missing-braces -d IS_GAME -m game
Generating ver.txt
Falling back to reading svninfo.txt
fbc -c build/savegame.rbas.bas -o build/savegame.rbas.o -mt -g -exx -O 2 -target linux -arch x86_64 -gen gcc -Wc -fno-omit-frame-pointer,-no-pie,-Wno-maybe-uninitialized,-Wno-array-bounds,-Wno-format,-Wno-missing-braces -d IS_GAME -m game
moresubs.rbas&#40;30&#41; error 4&#58; Duplicated definition in 'DECLARE SUB teleporttool_load_map &#40;map as integer, maptiles2&#40;&#41; as TileMap, pass2 as TileMap, tilesets2&#40;&#41; as TilesetData ptr&#41;'
moresubs.rbas&#40;31&#41; error 4&#58; Duplicated definition in 'DECLARE SUB teleporttool_generate_minimap&#40;byref mini as Frame Ptr, maptilesX&#40;&#41; as TileMap, passX as TileMap, tilesetsX&#40;&#41; as TilesetData ptr, byref zoom as integer, byref maxzoom as integer, byref mapsize as XYPair, byref minisize as XYPair, byref offset as XYPair, byref camera as XYPair, dest as XYPair&#41;'
moresubs.rbas&#40;32&#41; error 4&#58; Duplicated definition in 'DECLARE SUB inventory_overflow_handler&#40;byval item_id as integer, byval numitems as integer&#41;'
moresubs.rbas&#40;33&#41; error 4&#58; Duplicated definition in 'DECLARE SUB hero_swap_menu_init&#40;st as OrderTeamState&#41;'
moresubs.rbas&#40;34&#41; error 4&#58; Duplicated definition in 'DECLARE SUB hero_swap_menu_display &#40;st as OrderTeamState&#41;'
moresubs.rbas&#40;35&#41; error 4&#58; Duplicated definition in 'DECLARE SUB hero_swap_menu_mouse_control &#40;st as OrderTeamState&#41;'
moresubs.rbas&#40;40&#41; error 4&#58; Duplicated definition in 'SUB addhero &#40;byval who as integer, byval slot as integer, byval forcelevel as integer=-1&#41;'
moresubs.rbas&#40;152&#41; error 4&#58; Duplicated definition in 'FUNCTION averagelev &#40;&#41; as integer'
moresubs.rbas&#40;162&#41; error 4&#58; Duplicated definition in 'FUNCTION consumeitem &#40;byval invslot as integer&#41; as bool'
moresubs.rbas&#40;165&#41; error 317&#58; Function result assignment outside of the function, found '=' in 'consumeitem = 0'
moresubs.rbas&#40;165&#41; error 133&#58; Too many errors, exiting
scons&#58; *** &#91;build/moresubs.rbas.o&#93; Error 1
menustuf.rbas&#40;28&#41; error 4&#58; Duplicated definition in 'DECLARE SUB buystuff_make_slices&#40;buyst as ShopBuyState&#41;'
menustuf.rbas&#40;29&#41; error 4&#58; Duplicated definition in 'DECLARE SUB buystuff_refresh_menu &#40;buyst as ShopBuyState, menu as MenuDef, st as MenuState&#41;'
menustuf.rbas&#40;30&#41; error 4&#58; Duplicated definition in 'DECLARE SUB buystuff_refresh_selected &#40;buyst as ShopBuyState, byval thing as NodePtr&#41;'
menustuf.rbas&#40;31&#41; error 4&#58; Duplicated definition in 'DECLARE SUB buystuff_refresh_empty &#40;buyst as ShopBuyState&#41;'
menustuf.rbas&#40;32&#41; error 4&#58; Duplicated definition in 'DECLARE SUB buystuff_init_info_menu&#40;buyst as ShopBuyState&#41;'
menustuf.rbas&#40;33&#41; error 4&#58; Duplicated definition in 'DECLARE SUB buystuff_do_purchase&#40;buyst as ShopBuyState, byval thing as NodePtr, byval thing_slot as integer&#41;'
menustuf.rbas&#40;34&#41; error 4&#58; Duplicated definition in 'DECLARE FUNCTION buystuff_can_show&#40;byval slot as NodePtr, buyst as ShopBuyState&#41; as bool'
menustuf.rbas&#40;35&#41; error 4&#58; Duplicated definition in 'DECLARE FUNCTION buystuff_can_buy&#40;byval thing as NodePtr, buyst as ShopBuyState, byval sound_and_alert as bool=NO&#41; as bool'
menustuf.rbas&#40;36&#41; error 4&#58; Duplicated definition in 'DECLARE SUB buystuff_set_alert&#40;buyst as ShopBuyState, alert as string, byval ticks as integer = 18&#41;'
menustuf.rbas&#40;38&#41; error 4&#58; Duplicated definition in 'DECLARE SUB equip_menu_setup &#40;byref st as EquipMenuState&#41;'
menustuf.rbas&#40;38&#41; error 133&#58; Too many errors, exiting
scons&#58; *** &#91;build/menustuf.rbas.o&#93; Error 1
/home/tarl/ohrsrc/fufluns/gglobals.bi&#40;106&#41; error 4&#58; Duplicated definition, battl in 'EXTERN battl as BattleState ptr'
/home/tarl/ohrsrc/fufluns/gglobals.bi&#40;108&#41; error 4&#58; Duplicated definition, bstackstart in 'EXTERN bstackstart as integer'
/home/tarl/ohrsrc/fufluns/gglobals.bi&#40;109&#41; error 4&#58; Duplicated definition, atkq in 'EXTERN atkq&#40;&#41; as AttackQueue'
bmod.rbas&#40;29&#41; error 4&#58; Duplicated definition in 'DECLARE FUNCTION count_dissolving_enemies&#40;bslot&#40;&#41; as BattleSprite&#41; as integer'
bmod.rbas&#40;30&#41; error 4&#58; Duplicated definition in 'DECLARE FUNCTION find_empty_enemy_slot&#40;formdata as Formation&#41; as integer'
bmod.rbas&#40;32&#41; error 4&#58; Duplicated definition in 'DECLARE SUB spawn_on_death&#40;byval deadguy as integer, byval killing_attack as integer, byref bat as BattleState, formdata as Formation, bslot&#40;&#41; as BattleSprite&#41;'
bmod.rbas&#40;33&#41; error 4&#58; Duplicated definition in 'DECLARE SUB enemy_death_sfx&#40;battler as BattleSprite&#41;'
bmod.rbas&#40;34&#41; error 4&#58; Duplicated definition in 'DECLARE SUB check_death&#40;byval deadguy as integer, byval killing_attack as integer, byref bat as BattleState, bslot&#40;&#41; as BattleSprite, formdata as Formation&#41;'
bmod.rbas&#40;36&#41; error 4&#58; Duplicated definition in 'DECLARE SUB checkitemusability&#40;iuse&#40;&#41; as integer, bslot&#40;&#41; as BattleSprite, byval who as integer&#41;'
bmod.rbas&#40;37&#41; error 4&#58; Duplicated definition in 'DECLARE SUB reset_battle_state &#40;byref bat as BattleState&#41;'
bmod.rbas&#40;37&#41; error 133&#58; Too many errors, exiting
/home/tarl/ohrsrc/fufluns/gglobals.bi&#40;17&#41; error 4&#58; Duplicated definition, savedir in 'EXTERN savedir as string'
savegame.rbas&#40;28&#41; error 4&#58; Duplicated definition in 'DECLARE SUB gamestate_to_reload&#40;byval node as Reload.NodePtr&#41;'
savegame.rbas&#40;29&#41; error 4&#58; Duplicated definition in 'DECLARE SUB gamestate_state_to_reload&#40;byval parent as Reload.NodePtr&#41;'
savegame.rbas&#40;30&#41; error 4&#58; Duplicated definition in 'DECLARE SUB gamestate_script_to_reload&#40;byval parent as Reload.NodePtr&#41;'
savegame.rbas&#40;31&#41; error 4&#58; Duplicated definition in 'DECLARE SUB gamestate_strings_to_reload&#40;byval parent as Reload.NodePtr&#41;'
savegame.rbas&#40;32&#41; error 4&#58; Duplicated definition in 'DECLARE FUNCTION script_trigger_from_reload&#40;byval node as Reload.NodePtr&#41; as integer'
savegame.rbas&#40;33&#41; error 4&#58; Duplicated definition in 'DECLARE SUB gamestate_globals_to_reload&#40;byval parent as Reload.NodePtr, byval first as integer=0, byval last as integer=maxScriptGlobals&#41;'
savegame.rbas&#40;34&#41; error 4&#58; Duplicated definition in 'DECLARE SUB gamestate_maps_to_reload&#40;byval parent as Reload.NodePtr&#41;'
savegame.rbas&#40;35&#41; error 4&#58; Duplicated definition in 'DECLARE SUB gamestate_npcs_to_reload&#40;byval parent as Reload.NodePtr, byval map as integer&#41;'
savegame.rbas&#40;36&#41; error 4&#58; Duplicated definition in 'DECLARE SUB gamestate_tags_to_reload&#40;byval parent as Reload.NodePtr&#41;'
savegame.rbas&#40;36&#41; error 133&#58; Too many errors, exiting
scons&#58; *** &#91;build/bmod.rbas.o&#93; Error 1
scons&#58; *** &#91;build/savegame.rbas.o&#93; Error 1
scons&#58; building terminated because of errors.
[/size]
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Thanks!

The compile errors were due to a problem in reloadbasic.py. It produces (for example) build/moresubs.rbas.bas. But the .rbas.bas files it produced contained two copies of the source, concatenated! (Note that the line numbers refer to the .rbas file, not the .rbas.bas file, due to #line directives). I tracked this down easily enough, since I knew where to look, to a bad __del__ method which wasn't getting called by python2, but did in python 3. So I just deleted it.
There were also several instances of / in reloadbasic.py that needed to be replaced with //.

But now it compiles! Thanks, the goal is within sight. 'scons hspeak' doesn't work though. I haven't tried other commandline options or supported OSes yet; there's a lot of different code paths.

Here's my reloadbasic.py: http://tmc.castleparadox.com/ohr/temp/reloadbasic.py
Last edited by TMC on Sun Jan 26, 2020 1:54 pm, edited 1 time in total.
User avatar
DWRL
Red Slime
Posts: 35
Joined: Wed Jan 15, 2020 2:26 am
Location: Germany
Contact:

Post by DWRL »

It seems the first hurdle is taken, I just did a successful "scons ." :D

After another b'-decode it was just a matter of deleting the orange part there (line 1216):

HSPEAK = env.Command (rootdir + 'hspeak' + exe_suffix, source = [EUC, 'hspeak.exw', 'hsspiffy.e'] + Glob('euphoria/*.e'),
action = Action(compile_hspeak, "Compiling hspeak"))

It feels... wrong, to say the least, but it works ¯\_(ツ)_/¯

New files:
https://dwrl.de/misc/SConscript, https://dwrl.de/misc/ohrbuild

Of course, win32 an osx builds are another matter. I have no access to win32, but if macos help is needed, I could visit someone having one of those next weekend.

<edit>
By the way, what exactly is a fufluns :???:
</edit>
Last edited by DWRL on Mon Jan 27, 2020 10:12 pm, edited 2 times in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

This is a fufluns

"[EUC, 'hspeak.exw', 'hsspiffy.e']" is a list of sources (dependencies). It says that hspeak needs to be rebuilt if the euc (Euphoria to C) compiler or the hspeak source code changes. What problem were you getting with it? It probably was nothing to do with Python 3. I admit that that line of code was very kludgy, not how you're meant to write scons scripts, but I had trouble getting scons to do what I wanted.

get_command_output() should decode its output to a str instead of needing to call .decode() all over the place. With this change, building on Windows works too (previously, it was missing decodes). I can test on Mac myself later, so no need to do so.
And I see that compiling with python 2 still works too, great! How do you want to be credited in whatsnew.txt?

Wow, I never noticed that "def to_o((i, obj)):" function signature before. I didn't know that Python 2 allowed destructuring in the argument list!
Last edited by TMC on Tue Jan 28, 2020 2:54 pm, edited 1 time in total.
User avatar
DWRL
Red Slime
Posts: 35
Joined: Wed Jan 15, 2020 2:26 am
Location: Germany
Contact:

Post by DWRL »

>"etween Fufluns and Fanfaronade (...) was decided by rolling a d20. "
I like that ;)

By the sound of it, I guessed a Fuflun would be something like that:
Image
Etruskian religion never occur to me, one does learn something new every day :)

>(...)What problem were you getting with it?

Code: Select all

>>> scons hspeak
scons&#58; Reading SConscript files ...
Using target&#58; linux  arch&#58; x86_64  gcc&#58; gcc  cc&#58; gcc  gcctarget&#58; b'x86_64-pc-linux-gnu'  gccversion&#58; 920  fbcversion&#58; 1071
scons&#58; done reading SConscript files.
scons&#58; Building targets ...
scons&#58; *** &#91;hspeak&#93; AttributeError &#58; 'NoneType' object has no attribute 'get_ninfo'
scons&#58; building terminated because of errors.
This error is thrown when EUC is None, which means compile_hspeak() isn't called, and thus never shows the error message defined there.
Maybe something in SCons changed?

How I came to do it:
It did compile when euc was in my $PATH, but threw above error when not. Looking at the the documentation and the examples, argument 2 should be only input files for env.Command. Since EUC is no input file, and above error was only thrown when EUC was None, it seemed like [EUC, 'hspeak.exw', 'hsspiffy.e'] shouldn't be there, but maybe be the forth argument?
So I removed it for testing and everything worked (it produces a functional hspeak).
"hspeak.exw" is in an action about ten lines above, so maybe it isn't needed here, but 'hsspiffy.e' isn't referenced anywhere now, so I'm a bit surprised it still works.

Oh, and I left a test comment in line 1219, sorry :P

>How do you want to be credited in whatsnew.txt?
Daniel Würl, thank you :)
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Thanks, now I understand and can fix that.

But env.Command doesn't take a fourth argument.
The 'sources' for a build Node (which is usually a produced file, like 'hspeak.exe', but in general are just nodes in the dependency graph) are normally used as input by the build action to build that Node/file (search for $SOURCES in SConscript and you'll see how that happens). But our build action for hspeak is a python function which is hardcoded just to build hspeak, not Euphoria programs in general, so it ignores the sources. The sources only tell scons which other files/Nodes that the build action for hspeak depends upon (including the euc compiler).

Anyway I started trying to convert the hspeak build rules to be less of a hack, by defining a Builder for Euphoria programs. But it's easy to waste a lot of time getting scons build rules to work. If that happens I'll just give up and instead add (another) hack to fix that error when euc isn't installed.
User avatar
DWRL
Red Slime
Posts: 35
Joined: Wed Jan 15, 2020 2:26 am
Location: Germany
Contact:

Post by DWRL »

Ah, I see, the 'fourth argument' is a way of nesting.

> Anyway I started trying to convert the hspeak build rules to be less of a hack, by defining a Builder for Euphoria programs. But it's easy to waste a lot of time getting scons build rules to work. If that happens I'll just give up and instead add (another) hack to fix that error when euc isn't installed.

Hm, sounds to me like using the 'correct' way to do it for this might be a game of diminishing return here. As long as the hack works, I'd probably just document it with more comments and be happy about it. To most people this is invisible anyway ¯\_(ツ)_/¯

Now to get into the intricacies of hamsterspeak. There wouldn't be a way to compile python to hs, so I get to use objects, lists and dynamically typed variables? :devil:

(Joke aside, I just wrote my first graphical menu and it is going swimmingly \( ゚ヮ゚)/ )
Image
(And yes, the graphics are placeholders)
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Oh, I'm very good at working on the wrong thing!

That looks nice... a tactical RPG? Ambitious!

If you want arrays, see Scripts:Fake_arrays and especially Scripts:Slice_arrays

Normally I wouldn't make this suggestion, but since you have already compiled HSpeak yourself and seem competent enough...
I have a modified version of HSpeak plus a preprocessor for HSpeak that lets you use object.member and array[index] syntax. Both of these are just syntactical sugar around "read global"/"write global". Also $"string" syntax which is syntactical sugar for $NS"string" where NS is a script that returns an unused string ID. And a few other things like object allocation/freeing and array.len. But it's complex and messy to use; you have to allocate globals.
You can take a look at the scripts for Carcere Vicis (.hspp files, preprocessed to .hss) and decide whether you want to waste time figuring it out or not.

Of course, I have to implement real types/objects/arrays/strings/floats in HS, but it will be a while.
Last edited by TMC on Mon Feb 03, 2020 12:44 pm, edited 4 times in total.
Post Reply