FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

liblualib50 won't load

 
Post new topic   Reply to topic     Forum Index -> ArcLib
View previous topic :: View next topic  
Author Message
wilsonk



Joined: 21 Apr 2006
Posts: 40

PostPosted: Sat Jun 17, 2006 11:25 pm    Post subject: liblualib50 won't load Reply with quote

Hey clay et al.,

I have been struggling with Arc for an hour here and the liblualib50.so just won't load under Fedora Core 5 for the Asteroids example.

I initially had the problem that liblua50.so wouldn't load (because I had liblua (version 5.1) installed under FC5....it's name is just liblua.so under FC5) but I got it loaded by installing lua-devel-5.0.2 and lua-5.0.2 and creating a symbolic link in the Arc base directory from liblua50.so -> /usr/lib/liblua.so.

Ok, so now I should just be able to create a similar symbolic link from liblualib50.so -> /usr/lib/liblualib.so (or liblualib50.so.5 -> liblualib.so.5 or whatever). This didn't work. I also tried making symlinks from all lua libraries in the Arc base dir and changing the DerelictLoad* functions to load any combination of liblualib.* ----- no worky Sad

It seems that liblualib50 is the Ubuntu/Debian specific lua lib. I don't know if that matters, and since the liblua50 to liblua symlinking worked I don't see how it can matter, and I don't know how to add a Debian/Ubuntu package under FC5 if it does matter.

So, to sum up, I can compile asteroids using 'build asteroids.d -I/`pwd` -L-ldl -debug -Rn -full -cleanup -unittest'. Then when I run the ./asteroids executable I get this at the end of the unittests:

Triangle: Unit Test End...
window: open(Asteroids, 800, 600, false)
Failed to load shared library Failed to load shared library liblualib50.so

And I have tried a dozen different liblualib...combinations for library loading. Any ideas?

Thanks,
K.Wilson
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Sun Jun 18, 2006 6:45 pm    Post subject: Reply with quote

In the arc/io/window.d package, look at the 'loadDerelict' function near line 426. Comment out all the DerelictLua_Load() type functions, there are 3. Recompile and tell me if it works.

I'm thinking about removing lua soon as it is a pain, and my tutorial doesn't use any lua code at all.
Back to top
View user's profile Send private message AIM Address
wilsonk



Joined: 21 Apr 2006
Posts: 40

PostPosted: Sun Jun 18, 2006 10:08 pm    Post subject: Reply with quote

Hey clay,

Sorry, I thought I had said that I tried that in my post. It does compile and bring up a window, but there is no game play or graphics or anything in the window. It is also not possible to close the opened window without a 'killall -9 asteroids' in a terminal!

I assumed that there was no game inside the window because some config was not being read using Lua!?! My bad.

It turns out that my sound card was in use (kindof) and SDL_mixer wouldn't play nice...it just locks up without an error. I comment out the "sound" stuff uder main() and the game plays.

There are still some issues --- like I can see the ship but no keys work sometimes. Or I can start playing after about 6 seconds of just the ship sitting there and everything is cool, but then if I press ctrl RAPIDLY and turn the ship the game sortof goes into auto-fire mode then everything locks up? Check out this picture:

http://pages.cpsc.ucalgary.ca/~wilsonk/snapshot1.png

I will look into debugging things and let you know what I find. The initial problem, when the game is not working upon startup, might just be my computer.

Thanks for the cool 2D gaming stuff,
K.Wilson
Back to top
View user's profile Send private message
wilsonk



Joined: 21 Apr 2006
Posts: 40

PostPosted: Sun Jun 18, 2006 10:51 pm    Post subject: Reply with quote

Hey clay,

OK, here is the backtrace when the program locks up (it is the same when it just starts up and doesn't work....or if I am firing like crazy and it locks up):

[Switching to Thread 1272112 (LWP 13549)]
0x007c7402 in __kernel_vsyscall ()
(gdb) bt
#0 0x007c7402 in __kernel_vsyscall ()
#1 0x008a653d in ___newselect_nocancel () from /lib/libc.so.6
#2 0x048c4b7f in SDL_Delay () from /usr/lib/libSDL.so
#3 0x08054815 in _D3arc3phy4time4Time5delayFkZv ()
#4 0x08058487 in _Dmain ()
#5 0x08062e57 in main ()

Looks like the delay code is the problem, I guess? I'll look into it a little.

Thanks,
K.Wilson

P.S. This is the same error I get whenever I move or otherwise interact (resize or whatever) with the SDL window during game play and I get a lock up. Maybe gdb/dmd aren't quite working correctly here.
Back to top
View user's profile Send private message
wilsonk



Joined: 21 Apr 2006
Posts: 40

PostPosted: Sun Jun 18, 2006 11:31 pm    Post subject: Reply with quote

Hey Clay,

Well, it is definitely the timing code. I commented out

t.delay(40);

under main() and the game doesn't crash at all. Still a problem with the sound stuff if my device is in use (shoudln't SDL be able to handle this situation?). Oh well.

The game runs good on my machine without the delay. Not too fast or anything. Sorry if I am writing too much, but I just want to make sure others can find an answer to their problems so that they can see what Arc can do Wink

Thanks,
K.Wilson
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Mon Jun 19, 2006 1:04 am    Post subject: Reply with quote

That is weird. All the delay code should be doing is delaying the game if an entire frame took less than 40 milliseconds to render. There is something definitely wrong with that code if it causes your program to freeze.

In arc/phy/time.d in the delay function, try replacing it with this one...

Code:

   void delay(uint argMilli)
   {         
      // force wait if we did not wait 'argMilli' amount of time
      if ( (argMilli - (currTime - prevTime)) > 0)
      {
         SDL_Delay(cast(uint)((argMilli - (currTime - prevTime))));
         prevTime = currTime;
         currTime = SDL_GetTicks();
      }
   }


and then in the main asteroids where t.delay is called use t.delay(20);

After you do this, tell me if the game still locks up or not. Thanks.
~ Clay
Back to top
View user's profile Send private message AIM Address
wilsonk



Joined: 21 Apr 2006
Posts: 40

PostPosted: Mon Jun 19, 2006 12:58 pm    Post subject: Reply with quote

Hey Clay,

Seems to have worked with the new delay function. Everything was working exactly like when I didn't have a timing function...then boom SEGV. I was in auto-fire mode (just press ctrl very rapidly, as I said before) and I was also flying the ship in circles constantly. Then it died --- this is the back trace:

#0 0x080726d1 in _d_delclass ()
#1 0x08054e35 in _D3arc3gfx6sprite6Sprite5_dtorFZv ()
#2 0x08072921 in _d_callfinalizer ()
#3 0x080728f0 in _D3std2gc13new_finalizerFPvPvZv ()
#4 0x08079129 in _D3gcx3Gcx11fullcollectFPvZk ()
#5 0x08078d4e in _D3gcx3Gcx16fullcollectshellFZk ()
#6 0x08077e84 in _D3gcx2GC12mallocNoSyncFkZPv ()
#7 0x08077dcb in _D3gcx2GC6mallocFkZPv ()
#8 0x08072743 in _d_new ()
#9 0x080634cc in _aaKeys ()

That is repeated about 340 times and then _aaRehash() seems to replace _aaKeys():

#3445 0x08063381 in _aaRehash ()
arc3gfx6sprite6Sprite8addFrameFC3arc3gfx7texture7TextureAaiC3arc3snd7soundfx7SoundFXZv ()
D4ship9LaserBeam5_ctorFC3arc3gfx7texture7TextureffffZC4ship9LaserBeam ()
#3448 0x0804fd81 in _D4ship4Ship15processControlsFZv ()
#3449 0x0804feb7 in _D4ship4Ship7processFZv ()
#3450 0x080584e0 in _Dmain ()
#3451 0x08062e9b in main ()


That is it and I was able to replicate it. This doesn't seem to happen if the ship is just standing still in the center of the screen.

Thanks for the patch. Sorry if I am being a pain here.....just tell me to fix it if you get tired of me Wink

K.Wilson

P.S I had to remove line numbering (3446 and 3447) and hex value or two so that phpbb wouldn't die. It shouldn't affect to much unless you read hex Wink
Back to top
View user's profile Send private message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Mon Jun 19, 2006 4:57 pm    Post subject: Reply with quote

Download the arcpkg1.zip and the asteroidspkg.zip files because I've updated them, extract them both to the same directory again, close your audio as you had done, recompile, and tell me if you can still create that same error as above.
Back to top
View user's profile Send private message AIM Address
h3r3tic



Joined: 30 Mar 2004
Posts: 261
Location: Torun, Poland

PostPosted: Mon Jun 19, 2006 6:16 pm    Post subject: Reply with quote

About the multiple shared lib namings... Clay, you might want to check Derelict's new loading system in which the various versions can be specified quite easily either during runtime or in Derelict's code itself Smile
Back to top
View user's profile Send private message MSN Messenger
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Mon Jun 19, 2006 10:39 pm    Post subject: Reply with quote

Cool. Updating derelict to the latest and greatest was next on my todo list.
Back to top
View user's profile Send private message AIM Address
wilsonk



Joined: 21 Apr 2006
Posts: 40

PostPosted: Tue Jun 20, 2006 3:00 pm    Post subject: Reply with quote

Hey Clay,

I re-installed the packages and compiled a new asteroids game. Looks like no crashing now, under the same conditions. The rapid firing sends out less lasers now, but that just makes the game more challenging.

I will try to stress it out some more and see what happens.

Thanks,
K.Wilson
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> ArcLib All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group