Post new topic    
Page 1, 2  »
Red Slime
Send private message
[Solved] Getting OHRRPGCE to run on linux, help needed :-( 
 PostWed Jan 15, 2020 12:05 pm
Send private message Reply with quote
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:
~/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:
~/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:
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... Confused )


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? Grin
(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 Smile
Thank you for reading (and maybe helping Smile )

All the best,
Daniel
Metal King Slime
Send private message
 
 PostWed Jan 15, 2020 12:48 pm
Send private message Reply with quote
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.
Metal King Slime
Send private message
 
 PostWed Jan 15, 2020 1:17 pm
Send private message Reply with quote
OK, here's a build of Fufluns. The difference in date is inconsequential.

http://tmc.castleparadox.com/ohr/ohrrpgce-linux-2020-01-16-fufluns-x86_64.tar.bz2 (8.7MB)
http://tmc.castleparadox.com/ohr/ohrrpgce-player-linux-bin-minimal-2020-01-16-fufluns-x86_64.zip (945KB) - You don't need this, but just in case


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.
Metal King Slime
Send private message
 
 PostWed Jan 15, 2020 1:45 pm
Send private message Reply with quote
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/ohrrpgce-linux-2020-01-16-fufluns-x86_64.tar.bz2 (8.7MB)
http://tmc.castleparadox.com/ohr/ohrrpgce-player-linux-bin-minimal-2020-01-16-fufluns-x86_64.zip (945KB) - You don't need this, but just in case
Red Slime
Send private message
 
 PostWed Jan 15, 2020 9:39 pm
Send private message Reply with quote
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 Smile

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 Grin

Hspeak on the other hand wouldn't compile:
Code:
~/bin/ohrrpgce/ss/fufluns >>> /usr/bin/env python2 $(which scons) hspeak
scons: Reading SConscript files ...
Using target: linux  arch: x86_64  gcc: gcc  cc: gcc  gcctarget: x86_64-pc-linux-gnu  gccversion: 920  fbcversion: 1071
scons: done reading SConscript files.
scons: Building targets ...
scons: *** [hspeak] AttributeError : 'NoneType' object has no attribute 'get_ninfo'
scons: 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:
diff -ruN fufluns/autotest.py fufluns3/autotest.py
--- fufluns/autotest.py   2020-01-12 05:21:36.000000000 +0100
+++ fufluns3/autotest.py   2020-01-15 22:16: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:21:36.000000000 +0100
+++ fufluns3/hspeaktest.py   2020-01-15 22:16: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:21:04.000000000 +0100
+++ fufluns3/ohrbuild.py   2020-01-15 22:16: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:21:28.000000000 +0100
+++ fufluns3/reloadbasic/reloadbasic.py   2020-01-15 22:17: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:21:03.000000000 +0100
+++ fufluns3/SConscript   2020-01-15 22:16: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 (and "scons -H" for options to scons itself).
 


I will look into updating to python 3 at the weekend, but for now I'm quite happy, thank you Grin
Metal King Slime
Send private message
 
 PostFri Jan 17, 2020 4:25 am
Send private message Reply with quote
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.
Metal King Slime
Send private message
 
 PostSun Jan 19, 2020 11:03 pm
Send private message Reply with quote
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/nightly/ohrrpgce-linux-wip-x86.tar.bz2
http://hamsterrepublic.com/ohrrpgce/nightly/ohrrpgce-linux-wip-x86_64.tar.bz2
Red Slime
Send private message
 
 PostSat Jan 25, 2020 9:15 pm
Send private message Reply with quote
Sorry for replying so late, the week was busy Zombie

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

>>(...) 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:
~/ohrsrc/fufluns >>> scons
scons: Reading SConscript files ...
Using target: linux  arch: x86_64  gcc: gcc  cc: gcc  gcctarget: b'x86_64-pc-linux-gnu'  gccversion: 920  fbcversion: 1071
scons: done reading SConscript files.
scons: 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(30) error 4: Duplicated definition in 'DECLARE SUB teleporttool_load_map (map as integer, maptiles2() as TileMap, pass2 as TileMap, tilesets2() as TilesetData ptr)'
moresubs.rbas(31) error 4: Duplicated definition in 'DECLARE SUB teleporttool_generate_minimap(byref mini as Frame Ptr, maptilesX() as TileMap, passX as TileMap, tilesetsX() 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)'
moresubs.rbas(32) error 4: Duplicated definition in 'DECLARE SUB inventory_overflow_handler(byval item_id as integer, byval numitems as integer)'
moresubs.rbas(33) error 4: Duplicated definition in 'DECLARE SUB hero_swap_menu_init(st as OrderTeamState)'
moresubs.rbas(34) error 4: Duplicated definition in 'DECLARE SUB hero_swap_menu_display (st as OrderTeamState)'
moresubs.rbas(35) error 4: Duplicated definition in 'DECLARE SUB hero_swap_menu_mouse_control (st as OrderTeamState)'
moresubs.rbas(40) error 4: Duplicated definition in 'SUB addhero (byval who as integer, byval slot as integer, byval forcelevel as integer=-1)'
moresubs.rbas(152) error 4: Duplicated definition in 'FUNCTION averagelev () as integer'
moresubs.rbas(162) error 4: Duplicated definition in 'FUNCTION consumeitem (byval invslot as integer) as bool'
moresubs.rbas(165) error 317: Function result assignment outside of the function, found '=' in 'consumeitem = 0'
moresubs.rbas(165) error 133: Too many errors, exiting
scons: *** [build/moresubs.rbas.o] Error 1
menustuf.rbas(28) error 4: Duplicated definition in 'DECLARE SUB buystuff_make_slices(buyst as ShopBuyState)'
menustuf.rbas(29) error 4: Duplicated definition in 'DECLARE SUB buystuff_refresh_menu (buyst as ShopBuyState, menu as MenuDef, st as MenuState)'
menustuf.rbas(30) error 4: Duplicated definition in 'DECLARE SUB buystuff_refresh_selected (buyst as ShopBuyState, byval thing as NodePtr)'
menustuf.rbas(31) error 4: Duplicated definition in 'DECLARE SUB buystuff_refresh_empty (buyst as ShopBuyState)'
menustuf.rbas(32) error 4: Duplicated definition in 'DECLARE SUB buystuff_init_info_menu(buyst as ShopBuyState)'
menustuf.rbas(33) error 4: Duplicated definition in 'DECLARE SUB buystuff_do_purchase(buyst as ShopBuyState, byval thing as NodePtr, byval thing_slot as integer)'
menustuf.rbas(34) error 4: Duplicated definition in 'DECLARE FUNCTION buystuff_can_show(byval slot as NodePtr, buyst as ShopBuyState) as bool'
menustuf.rbas(35) error 4: Duplicated definition in 'DECLARE FUNCTION buystuff_can_buy(byval thing as NodePtr, buyst as ShopBuyState, byval sound_and_alert as bool=NO) as bool'
menustuf.rbas(36) error 4: Duplicated definition in 'DECLARE SUB buystuff_set_alert(buyst as ShopBuyState, alert as string, byval ticks as integer = 18)'
menustuf.rbas(38) error 4: Duplicated definition in 'DECLARE SUB equip_menu_setup (byref st as EquipMenuState)'
menustuf.rbas(38) error 133: Too many errors, exiting
scons: *** [build/menustuf.rbas.o] Error 1
/home/tarl/ohrsrc/fufluns/gglobals.bi(106) error 4: Duplicated definition, battl in 'EXTERN battl as BattleState ptr'
/home/tarl/ohrsrc/fufluns/gglobals.bi(108) error 4: Duplicated definition, bstackstart in 'EXTERN bstackstart as integer'
/home/tarl/ohrsrc/fufluns/gglobals.bi(109) error 4: Duplicated definition, atkq in 'EXTERN atkq() as AttackQueue'
bmod.rbas(29) error 4: Duplicated definition in 'DECLARE FUNCTION count_dissolving_enemies(bslot() as BattleSprite) as integer'
bmod.rbas(30) error 4: Duplicated definition in 'DECLARE FUNCTION find_empty_enemy_slot(formdata as Formation) as integer'
bmod.rbas(32) error 4: Duplicated definition in 'DECLARE SUB spawn_on_death(byval deadguy as integer, byval killing_attack as integer, byref bat as BattleState, formdata as Formation, bslot() as BattleSprite)'
bmod.rbas(33) error 4: Duplicated definition in 'DECLARE SUB enemy_death_sfx(battler as BattleSprite)'
bmod.rbas(34) error 4: Duplicated definition in 'DECLARE SUB check_death(byval deadguy as integer, byval killing_attack as integer, byref bat as BattleState, bslot() as BattleSprite, formdata as Formation)'
bmod.rbas(36) error 4: Duplicated definition in 'DECLARE SUB checkitemusability(iuse() as integer, bslot() as BattleSprite, byval who as integer)'
bmod.rbas(37) error 4: Duplicated definition in 'DECLARE SUB reset_battle_state (byref bat as BattleState)'
bmod.rbas(37) error 133: Too many errors, exiting
/home/tarl/ohrsrc/fufluns/gglobals.bi(17) error 4: Duplicated definition, savedir in 'EXTERN savedir as string'
savegame.rbas(28) error 4: Duplicated definition in 'DECLARE SUB gamestate_to_reload(byval node as Reload.NodePtr)'
savegame.rbas(29) error 4: Duplicated definition in 'DECLARE SUB gamestate_state_to_reload(byval parent as Reload.NodePtr)'
savegame.rbas(30) error 4: Duplicated definition in 'DECLARE SUB gamestate_script_to_reload(byval parent as Reload.NodePtr)'
savegame.rbas(31) error 4: Duplicated definition in 'DECLARE SUB gamestate_strings_to_reload(byval parent as Reload.NodePtr)'
savegame.rbas(32) error 4: Duplicated definition in 'DECLARE FUNCTION script_trigger_from_reload(byval node as Reload.NodePtr) as integer'
savegame.rbas(33) error 4: Duplicated definition in 'DECLARE SUB gamestate_globals_to_reload(byval parent as Reload.NodePtr, byval first as integer=0, byval last as integer=maxScriptGlobals)'
savegame.rbas(34) error 4: Duplicated definition in 'DECLARE SUB gamestate_maps_to_reload(byval parent as Reload.NodePtr)'
savegame.rbas(35) error 4: Duplicated definition in 'DECLARE SUB gamestate_npcs_to_reload(byval parent as Reload.NodePtr, byval map as integer)'
savegame.rbas(36) error 4: Duplicated definition in 'DECLARE SUB gamestate_tags_to_reload(byval parent as Reload.NodePtr)'
savegame.rbas(36) error 133: Too many errors, exiting
scons: *** [build/bmod.rbas.o] Error 1
scons: *** [build/savegame.rbas.o] Error 1
scons: building terminated because of errors.
Metal King Slime
Send private message
 
 PostSun Jan 26, 2020 1:52 pm
Send private message Reply with quote
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
Red Slime
Send private message
 
 PostMon Jan 27, 2020 10:10 pm
Send private message Reply with quote
It seems the first hurdle is taken, I just did a successful "scons ." Grin

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 Confused
</edit>
Metal King Slime
Send private message
 
 PostTue Jan 28, 2020 2:48 pm
Send private message Reply with quote
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!
Red Slime
Send private message
 
 PostTue Jan 28, 2020 11:57 pm
Send private message Reply with quote
>"[B]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:

Etruskian religion never occur to me, one does learn something new every day Smile

>(...)What problem were you getting with it?
Code:
>>> scons hspeak
scons: Reading SConscript files ...
Using target: linux  arch: x86_64  gcc: gcc  cc: gcc  gcctarget: b'x86_64-pc-linux-gnu'  gccversion: 920  fbcversion: 1071
scons: done reading SConscript files.
scons: Building targets ...
scons: *** [hspeak] AttributeError : 'NoneType' object has no attribute 'get_ninfo'
scons: 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 Smile
Metal King Slime
Send private message
 
 PostFri Jan 31, 2020 4:11 pm
Send private message Reply with quote
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.
Red Slime
Send private message
 
 PostSun Feb 02, 2020 1:28 pm
Send private message Reply with quote
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 \( ゚ヮ゚)/ )

(And yes, the graphics are placeholders)
Metal King Slime
Send private message
 
 PostMon Feb 03, 2020 12:36 pm
Send private message Reply with quote
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.
Display posts from previous:
Page 1, 2  »