Built on Linux

Post here about modding and contributing code to Goblin Camp

Moderator: Mods&Dev moderators

Re: Built on Linux

Postby snus-mumrik » 06 Nov 2010, 01:58

Edit: problem solved


Seems like I really had one bug in file layout, but it didn't fix the problem. I had goblin-camplib/gcamp_core/mod.dat instead of goblin-camp/lib/gcamp_core/mod.dat, I think it's another "\" instead "/", I just moved the file.
Now the layout is:
Code: Select all
$ ls -AlR dist/debug-x86/
dist/debug-x86/:
total 8
drwxr-xr-x 2 ilya ilya 4096 Nov  5 23:04 bin
drwxr-xr-x 3 ilya ilya 4096 Nov  6 01:00 share

dist/debug-x86/bin:
total 38284
-rwxr-xr-x 1 ilya ilya 39201914 Nov  5 23:04 goblin-camp

dist/debug-x86/share:
total 4
drwxr-xr-x 3 ilya ilya 4096 Nov  5 22:38 goblin-camp

dist/debug-x86/share/goblin-camp:
total 56
-rw-r--r-- 1 ilya ilya 35819 Nov  5 22:36 COPYING.txt
-rw-r--r-- 1 ilya ilya  1695 Nov  5 22:36 LIBTCOD-LICENSE.txt
-rw-r--r-- 1 ilya ilya  7482 Nov  5 22:36 Readme.txt
drwxr-xr-x 4 ilya ilya  4096 Nov  5 22:38 lib
-rw-r--r-- 1 ilya ilya  3150 Nov  5 22:36 terminal.png

dist/debug-x86/share/goblin-camp/lib:
total 272
drwxr-xr-x 2 ilya ilya   4096 Nov  5 22:38 gcamp
drwxr-xr-x 2 ilya ilya   4096 Nov  6 01:00 gcamp_core
-rw-r--r-- 1 ilya ilya 267956 Nov  5 22:38 stdlib.zip

dist/debug-x86/share/goblin-camp/lib/gcamp:
total 20
-rw-r--r-- 1 ilya ilya  863 Nov  5 22:38 __init__.py
-rw-r--r-- 1 ilya ilya 1245 Nov  5 22:38 config.py
-rw-r--r-- 1 ilya ilya 1073 Nov  5 22:38 events.py
-rw-r--r-- 1 ilya ilya 1353 Nov  5 22:38 log.py
-rw-r--r-- 1 ilya ilya 1015 Nov  5 22:38 utils.py

dist/debug-x86/share/goblin-camp/lib/gcamp_core:
total 52
-rw-r--r-- 1 ilya ilya   951 Nov  5 22:38 __init__.py
-rw-r--r-- 1 ilya ilya  5496 Nov  5 22:38 constructions.dat
-rw-r--r-- 1 ilya ilya  9052 Nov  5 22:38 creatures.dat
-rw-r--r-- 1 ilya ilya 12538 Nov  5 22:38 items.dat
-rw-r--r-- 1 ilya ilya   207 Nov  5 23:04 mod.dat
-rw-r--r-- 1 ilya ilya   714 Nov  5 22:38 names.dat
-rw-r--r-- 1 ilya ilya  2183 Nov  5 22:38 wildplants.dat



I had to add explicit flush to logger to make meaningful logfile (it used to be almost empty):
#define LOG_FUNC(x, func) (Logger::Prefix(__FILE__, __LINE__, func) << x << Logger::Suffix()).flush()
Logfile:
Code: Select all
C++ (`Logger.cpp` @ 49), `OpenLogFile`:
   Log opened 2010-Nov-06 01:54:28
================================
C++ (`Paths.cpp` @ 162), `Init`:
   Personal directory: "/home/ilya/.goblincamp"
================================
C++ (`Paths.cpp` @ 163), `Init`:
   Saves directory: "/home/ilya/.goblincamp/saves"
================================
C++ (`Paths.cpp` @ 164), `Init`:
   Screenshots directory: "/home/ilya/.goblincamp/screenshots"
================================
C++ (`Paths.cpp` @ 165), `Init`:
   Mods directory: "/home/ilya/.goblincamp/mods"
================================
C++ (`Paths.cpp` @ 166), `Init`:
   Executable directory: "/home/ilya/Programming/Testing/GoblinCamp/goblin-camp-pl/goblin-camp-pl/build/dist/debug-x86/bin"
================================
C++ (`Paths.cpp` @ 167), `Init`:
   Global data directory: "/home/ilya/Programming/Testing/GoblinCamp/goblin-camp-pl/goblin-camp-pl/build/dist/debug-x86/share/goblin-camp/"
================================
C++ (`Paths.cpp` @ 168), `Init`:
   Executable: "/home/ilya/Programming/Testing/GoblinCamp/goblin-camp-pl/goblin-camp-pl/build/dist/debug-x86/bin/goblin-camp"
================================
C++ (`Paths.cpp` @ 169), `Init`:
   Config: "/home/ilya/.goblincamp/config.py"
================================
C++ (`Paths.cpp` @ 170), `Init`:
   Font: "/home/ilya/.goblincamp/terminal.png"
================================
C++ (`Engine.cpp` @ 47), `Init`:
   Initialising engine.
================================
C++ (`Engine.cpp` @ 53), `Init`:
   Python 2.6.5 (release26-maint, Aug 11 2010, 21:56:25)
[GCC 4.4.3]
================================
C++ (`Engine.cpp` @ 77), `Init`:
   sys.path = ['/home/ilya/Programming/Testing/GoblinCamp/goblin-camp-pl/goblin-camp-pl/build/dist/debug-x86/share/goblin-camp/lib', '/home/ilya/Programming/Testing/GoblinCamp/goblin-camp-pl/goblin-camp-pl/build/dist/debug-x86/share/goblin-camp/lib/stdlib.zip']
================================
C++ (`Engine.cpp` @ 85), `Init`:
   Importing utils.
================================



From gdb I see that there is indeed some exception that arises from import("traceback"). Here is some output of 'stepi'-ing through it, but I don't think it will tell much.
Code: Select all
0x00007ffff7a791b8 in PyList_GetItem@plt () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7ab16e0 in PyList_GetItem () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7ab16e4 in PyList_GetItem () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7ab16e8 in PyList_GetItem () from /usr/lib/libpython2.6.so.1.0
(gdb) finish
Run till exit from #0  0x00007ffff7ab16e8 in PyList_GetItem () from /usr/lib/libpython2.6.so.1.0
0x00007ffff7b26839 in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb) stepi
0x00007ffff7b2683c in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b26842 in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b26844 in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b26847 in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b2684a in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b2684c in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7a79aa8 in PyObject_CallFunctionObjArgs@plt () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7a84300 in PyObject_CallFunctionObjArgs () from /usr/lib/libpython2.6.so.1.0
(gdb) finish
Run till exit from #0  0x00007ffff7a84300 in PyObject_CallFunctionObjArgs () from /usr/lib/libpython2.6.so.1.0
0x00007ffff7b26851 in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb) stepi
0x00007ffff7b26854 in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b26857 in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b26808 in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b2680f in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b26812 in ?? () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7a7a3c8 in PyErr_ExceptionMatches@plt () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b221c0 in PyErr_ExceptionMatches () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b221c1 in PyErr_ExceptionMatches () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b221c4 in PyErr_ExceptionMatches () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7a7a3e8 in PyErr_Occurred@plt () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b21150 in PyErr_Occurred () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b21157 in PyErr_Occurred () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b2115a in PyErr_Occurred () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b2115e in PyErr_Occurred () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b221c9 in PyErr_ExceptionMatches () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b221cc in PyErr_ExceptionMatches () from /usr/lib/libpython2.6.so.1.0
(gdb)
0x00007ffff7b221cf in PyErr_ExceptionMatches () from /usr/lib/libpython2.6.so.1.0
(gdb) c
Continuing.
terminate called after throwing an instance of 'boost::python::error_already_set'

Program received signal SIGABRT, Aborted.
0x00007ffff5e1f1b5 in raise () from /lib/libc.so.6
(gdb) c
Continuing.
[Thread 0x7ffff32ee710 (LWP 10830) exited]


Callstack from gdb (put breakpoint at address, not sure if the exception really was at first time I got there):
Code: Select all
Breakpoint 2, 0x00007ffff7a79aa8 in PyObject_CallFunctionObjArgs@plt () from /usr/lib/libpython2.6.so.1.0
(gdb) bt
#0  0x00007ffff7a79aa8 in PyObject_CallFunctionObjArgs@plt () from /usr/lib/libpython2.6.so.1.0
#1  0x00007ffff7b26851 in ?? () from /usr/lib/libpython2.6.so.1.0
#2  0x00007ffff7b26c62 in ?? () from /usr/lib/libpython2.6.so.1.0
#3  0x00007ffff7b29654 in ?? () from /usr/lib/libpython2.6.so.1.0
#4  0x00007ffff7b297b3 in ?? () from /usr/lib/libpython2.6.so.1.0
#5  0x00007ffff7b29df8 in ?? () from /usr/lib/libpython2.6.so.1.0
#6  0x00007ffff7b2ab65 in PyImport_ImportModuleLevel () from /usr/lib/libpython2.6.so.1.0
#7  0x00007ffff7b1091f in ?? () from /usr/lib/libpython2.6.so.1.0
#8  0x00007ffff7a840f2 in PyObject_Call () from /usr/lib/libpython2.6.so.1.0
#9  0x00007ffff7a841e1 in ?? () from /usr/lib/libpython2.6.so.1.0
#10 0x00007ffff7a84de2 in PyObject_CallFunction () from /usr/lib/libpython2.6.so.1.0
#11 0x00007ffff7b2ac9c in PyImport_Import () from /usr/lib/libpython2.6.so.1.0
#12 0x00007ffff7b2ae5c in PyImport_ImportModule () from /usr/lib/libpython2.6.so.1.0
#13 0x00007ffff7609374 in boost::python::import(boost::python::str) ()
   from /home/ilya/Programming/Testing/Boost/boost_1_44_0/Distribution/lib/libboost_python.so.1.44.0
#14 0x00000000005ccb86 in Script::Init (args=...)
    at /home/ilya/Programming/Testing/GoblinCamp/goblin-camp-pl/goblin-camp-pl/Goblin Camp/src/scripting/Engine.cpp:87
#15 0x00000000005a9b6c in GCMain (args=...)
    at /home/ilya/Programming/Testing/GoblinCamp/goblin-camp-pl/goblin-camp-pl/Goblin Camp/src/GCamp.cpp:62
#16 0x0000000000712608 in main (argc=1, argv=0x7fffffffdc88)
    at /home/ilya/Programming/Testing/GoblinCamp/goblin-camp-pl/goblin-camp-pl/Goblin Camp/src/unix/main.cpp:28
Last edited by snus-mumrik on 06 Nov 2010, 19:42, edited 1 time in total.
User avatar
snus-mumrik
 
Posts: 150
Joined: 25 Jun 2010, 16:20

Re: Built on Linux

Postby snus-mumrik » 06 Nov 2010, 19:39

I unpacked stdlib.zip into a subfolder and added it to the path insted stdlib.zip.
It worked.
Then I had some problems with not-found modules (e.g. time), so I had to copy several shared libraries to same subfolder.

At least the game starts now. Thanks Piotr!
User avatar
snus-mumrik
 
Posts: 150
Joined: 25 Jun 2010, 16:20

Re: Built on Linux

Postby apostepriori » 12 Dec 2010, 01:12

i managed to build latest (r1029) goblin-camp on arch-linux. you can see results in comments of respective AUR entries.
for the lazy:
goblincamp-hg
and
libtcod-svn

i'm attaching a patch addressing three issues:

  1. missing "/" placing mod.dat into share/goblin-camplib/foobar (trivial, but though mentioned by snus-mumrik, still not fixed - at least not in official gc repo... only goes to show that linux is barely a priority ;}
  2. <python.interpreter> may have different name, there is probably more elegent fix to be divined by someone who knows his jammedlang weller than me, but that's what i was able to cook up on the spot. it appears to work and i deem it better solution than merely s/python/python2/ as Arch Linux happens to require. there are other places that use bare 'python' name (nsis installer iirc) which may be considered for the same approach in order to make build more python robust...
    and last but the most!
  3. loading python libraries... i think prepending goblin-camp's directories to sys.path will be much better compromise! formatting of the function and the following if is all wrong since my emacs has a bit different ideas about damn indentation, but one can get the gist. there are probably better convenience functions available to avoid the goto clutter and as comment states appending in stead of allocating long enough list from the start may be slightly costly but for my first encounter with Python C API i at least managed to exorcise segfaults in "only" couple of tries and a bit of more concentrated reading.

so, apart from item 1) these are merely strong suggestions as to include patch's ideas upstream - not necessarly in that form, but i would strongly argue that them are good ideas[tm]

a post

P.S. also could you consider using more conservative default config? SDL renderer works best on my feeble machinery and someone with better stuff can modify it easily enough now without the effort of waiting for eternity for the mouse clicks to sneak in between the rendering cycles...
Attachments
archlinux.zip
Arch-Linux 1029-3 PKGBUILD patch
(1.71 KiB) Downloaded 2 times
Last edited by apostepriori on 12 Dec 2010, 19:45, edited 1 time in total.
a post mitotea prioric para site: hug or life!
User avatar
apostepriori
 
Posts: 34
Joined: 12 Jul 2010, 18:32
Location: Poland, EU

Re: Built on Linux

Postby PiotrLegnica » 12 Dec 2010, 18:35

r1007:5fd1a5908e9a

I've added 1. and 2. (though in a bit different way).

I don't agree with 3., as isolating from the standard library that may or may not come with the OS is a deliberate decision (for consistency, and to ensure everything we need is included in the right version), and a step towards sandbox (though full sandboxing is neither possible nor a priority right now).
PiotrLegnica/BasementCat on freenode. Visit #goblincamp!
The pie is a lie
User avatar
PiotrLegnica
 
Posts: 283
Joined: 06 Jul 2010, 15:27
Location: Poland, EU

Re: Built on Linux

Postby apostepriori » 12 Dec 2010, 19:07

PiotrLegnica wrote:r1007:5fd1a5908e9a

I've added 1. and 2. (though in a bit different way).


thx, yeah, i guess the rule thing was wrongheaded as i think it appeared to remake mod.dat everytime it was ran. peek&poke... heh, kinda like 8-bit BASIC.

I don't agree with 3., as isolating from the standard library that may or may not come with the OS is a deliberate decision (for consistency, and to ensure everything we need is included in the right version), and a step towards sandbox (though full sandboxing is neither possible nor a priority right now).


i can understand the motivation and i was guessing at it. but a fix is still needed since you must be doing something wrong or your setup prevents you from seeing it because here on my end goblin-camp runs only after i handhack the following symlinks:

lrwxrwxrwx 1 root root 43 Dec 11 08:10 cStringIO.so -> /usr/lib/python2.7/lib-dynload/cStringIO.so
lrwxrwxrwx 1 root root 44 Dec 11 08:11 _functools.so -> /usr/lib/python2.7/lib-dynload/_functools.so
lrwxrwxrwx 1 root root 38 Dec 11 08:12 time.so -> /usr/lib/python2.7/lib-dynload/time.so
lrwxrwxrwx 1 root root 42 Dec 11 08:12 _weakref.so -> /usr/lib/python2.7/lib-dynload/_weakref.so

into /usr/share/goblin-camp/lib

a post
a post mitotea prioric para site: hug or life!
User avatar
apostepriori
 
Posts: 34
Joined: 12 Jul 2010, 18:32
Location: Poland, EU

Re: Built on Linux

Postby PiotrLegnica » 12 Dec 2010, 19:17

Yeah, Ubuntu's python links those in statically. (insert generic 'I hate developing for Linux' rant). I'll add them to pysupport.

thx, yeah, i guess the rule thing was wrongheaded as i think it appeared to remake mod.dat everytime it was ran.

It should, along with _version.cpp.
PiotrLegnica/BasementCat on freenode. Visit #goblincamp!
The pie is a lie
User avatar
PiotrLegnica
 
Posts: 283
Joined: 06 Jul 2010, 15:27
Location: Poland, EU

Re: Built on Linux

Postby lolbroek » 23 Dec 2010, 14:46

And? Any progress on this?


I tried it in a virtual box with windows 7, but it doesn't work. I starts up but i don't see the asci. only frames. I don't have my 3D graphics card activated in the virtual box. Can that it be? Are you using opengl or SDL?

thanks
lolbroek
 
Posts: 23
Joined: 26 Aug 2010, 16:37

Re: Built on Linux

Postby apostepriori » 23 Dec 2010, 16:43

i think that the default config is to use the GLSL renderer... so it might be the problem.
currently settings are held in '~/.goblincamp/config.py' file. you could edit it outside of the game by hand to read: setCVar('renderer', '2')
if you do get it working i'd be interested to know if you get segmentation fault error on loading a save file...

btw, why are you trying to run goblincamp in a virtualbox if it works nativaly on windows?
a post mitotea prioric para site: hug or life!
User avatar
apostepriori
 
Posts: 34
Joined: 12 Jul 2010, 18:32
Location: Poland, EU

Re: Built on Linux

Postby lolbroek » 24 Dec 2010, 11:44

Because, I'm on linux. :), And it doesn't work in linux for me. wine doesn't work also. But I've a windows7 cd lying around that came with my new laptop, so I tried it in virtual box. Thanks for the tip with setCVar('renderer', '2') I'm going to try it out.

I'm on kubuntu now. But I'm planning to move to chakra in 2 months or so. So It shouldn't be dificult to use your pkgbuild then. (I hope)
lolbroek
 
Posts: 23
Joined: 26 Aug 2010, 16:37

Re: Built on Linux

Postby lolbroek » 24 Dec 2010, 12:01

Hmm, I found out that the problem in virtual box and wine is the same. I'm on intel graphics now (so no fancy 3D graphic stuff, but that shouldnt be a problem with ascii (: )

SO to be sure, I should just add setCVar('renderer', '2') to '~/.goblincamp/config.py' to have sdl? If that's the problem, it doesnt work :(

greetings

edit: put a screenshot in attachement, this is how my goblincamp looks
Attachments
goblincampproblem.png
goblincampproblem.png (15.17 KiB) Viewed 609 times
lolbroek
 
Posts: 23
Joined: 26 Aug 2010, 16:37

PreviousNext

Return to Modding and Development

Who is online

Users browsing this forum: No registered users and 0 guests

cron