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

Linux... again

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
ndove



Joined: 12 Oct 2004
Posts: 6
Location: Las Vegas

PostPosted: Sat Oct 16, 2004 11:48 pm    Post subject: Linux... again Reply with quote

First off, I'd like to thank you for making it so easy to use SDL within D. SDL is a great library, and D, a great language, and they compliment eachother nicely.

After some modifications to Derelict's SDL (namely those mentioned on the 'Getting Derelict to work on Linux' thread), and some heavy debugging on my part, I've finally got things compiling wonderfully.

But, as no good deed goes unpunished, there's still a snag...

Any program I run calls SDL_Load() just fine, but calling SDL_Init() always creates a segmentation fault, no matter what the situation. This happens in the sdlbitmap test program, as well as all of my own. Even with the simplest code:

Code:

// test.d

import derelict.sdl.sdl;
import std.string;
import std.c.stdio;
import std.c.stdlib;

int main (char[][] args)
{
   SDL_Load();

   if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO) < 0)
   {
        fprintf(stderr, "Unable to init SDL: ?s\n", SDL_GetError());
        exit(1);
   }

   printf("?.*s", "HAI!\n");

   return 0;
}


After compilation, upon running the program, I get this:

ndove@adolescence:~/d$ ./test
Segmentation fault

(very informative)

If I comment out the SDL_Init() block, I get no errors and the program prints "HAI" just fine.

Future answers:
Yes, I am directly linking the program with the SDL library and passing -L-lSDL to the compiler (how else would SDL_Load() work?)
Yes, I downloaded DerelictSDL from the SVN trunk (not the 0.1 release).

Errors or not, you're doing a great job on this. Everything's got its hitches. Can't wait to see what's next.

Any help will be greatly appreciated. Thanks in advance.

-Nick
AIM: ndovelv
Yahoo: ndovelv
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sun Oct 17, 2004 8:19 am    Post subject: Re: Linux... again Reply with quote

ndove wrote:
First off, I'd like to thank you for making it so easy to use SDL within D. SDL is a great library, and D, a great language, and they compliment eachother nicely.


Glad to see another person using both Smile

ndove wrote:

After some modifications to Derelict's SDL (namely those mentioned on the 'Getting Derelict to work on Linux' thread), and some heavy debugging on my part, I've finally got things compiling wonderfully.


This is something I have zero experience with, so I'm happy to hear it works. Clayasaurus has been doing the work with Linux in conjunction with his own Claytek 3D project, and I hope to one day get his fixes in to SVN.

ndove wrote:

Any program I run calls SDL_Load() just fine, but calling SDL_Init() always creates a segmentation fault, no matter what the situation. This happens in the sdlbitmap test program, as well as all of my own.


Just to be clear, the function which loads SDL has been renamed to DerelictSDL_Load. I know you say below you are using the trunk, but just want to make sure we're on the same page here.

ndove wrote:

Future answers:
Yes, I am directly linking the program with the SDL library and passing -L-lSDL to the compiler (how else would SDL_Load() work?)


I think this is your problem. The whole concept behind Derelict, and what separates it from the other SDL, OpenGL, and other bindings out there is that you do not link to any import libraries. When you link to an import libary (such as libSDL.a on Linux), the shared library is loaded implicitly during app startup. DerelictSDL (and all Derelict libs) load the shared library explicitly, function by function. The reason for this is to give you control over what happens if a required shared library is missing or corrupt, as opposed to the user seeing a system error message.

Your linking to the import lib and then calling DerelictSDL_Load is likely creating a conflict that is causing the SEGFAULT. Try building your project without the -lSDL option and see if that solves the problem. If it doesn't, then I'm clueless and someone with more Linux know-how than I is going to have to help you fix it.

ndove wrote:

Errors or not, you're doing a great job on this. Everything's got its hitches. Can't wait to see what's next.


Thanks Smile Python is next if I can ever get around to finishing it.
Back to top
View user's profile Send private message Send e-mail
ndove



Joined: 12 Oct 2004
Posts: 6
Location: Las Vegas

PostPosted: Sun Oct 17, 2004 9:33 am    Post subject: Roger that Reply with quote

You were right.

I was skeptical at first, considering that after I did what you said, I wound up with a buffer full of errors. Closer observation made me realize I forgot to use -ldl when I compiled (all the errors pertained to libdl functions.)

Everything's working perfectly now. Time for some fun Twisted Evil

Thanks again for the help.
_________________
- Nick
- AIM: ndovelv
- Yahoo: ndovelv
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Sun Oct 17, 2004 3:55 pm    Post subject: Reply with quote

So are these changes to the Linux version going to be included in Derelict?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sun Oct 17, 2004 7:41 pm    Post subject: Reply with quote

ndove wrote:

You were right.


Yay! Glad it all worked out.

JJR wrote:


So are these changes to the Linux version going to be included in Derelict?


There isn't really a Linux version of Derelict yet, other than what a couple of people have done on their own and posted here Wink Eventually, yes, Derelict will be Linux-ized. But if I'm the one to do it then it isn't going to be anytime soon. I could incorporate the fixes others have posted here, but I have no way to test anything at the moment, nor do I want to mess with it (Linux and I are not good friends). I barely have time to maintain the Windows version as it is.

What I would really prefer to do is grant commit rights to someone who knows Linux and would be willing to implement and maintain the Linux version.
Back to top
View user's profile Send private message Send e-mail
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Sun Oct 17, 2004 10:28 pm    Post subject: Reply with quote

aldacron wrote:
JJR wrote:


So are these changes to the Linux version going to be included in Derelict?


There isn't really a Linux version of Derelict yet, other than what a couple of people have done on their own and posted here Wink Eventually, yes, Derelict will be Linux-ized. But if I'm the one to do it then it isn't going to be anytime soon. I could incorporate the fixes others have posted here, but I have no way to test anything at the moment, nor do I want to mess with it (Linux and I are not good friends). I barely have time to maintain the Windows version as it is.


Sorry, man. I know I keep needling you on this one. You must be getting tired of it after the 3rd time now Wink. I understand you and linux aren't on great terms. No problem. I was just hoping that the changes that these gentlemen made would be included in the Derelict project somehow. You've done a great work on this, and I was just hoping to see the success continue on with Linux and maybe perhaps Mac OS X eventually too.

aldacron wrote:
What I would really prefer to do is grant commit rights to someone who knows Linux and would be willing to implement and maintain the Linux version.


That would be great. I've been hesitant to help in the past on the linux version because I've had my hands full with several other things. But I think I can manage to help maintain/test the linux side of things if the changes are included. I just have to get my linux operational again (yeah, I messed mine up Sad ). Anybody else interested in lending a hand also?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Mon Oct 18, 2004 5:52 am    Post subject: Reply with quote

JJR wrote:

Sorry, man. I know I keep needling you on this one. You must be getting tired of it after the 3rd time now Wink.


Heh, no harm done. I had forgotten the other two times already Smile

JJR wrote:

aldacron wrote:
What I would really prefer to do is grant commit rights to someone who knows Linux and would be willing to implement and maintain the Linux version.


That would be great. I've been hesitant to help in the past on the linux version because I've had my hands full with several other things. But I think I can manage to help maintain/test the linux side of things if the changes are included. I just have to get my linux operational again (yeah, I messed mine up Sad ). Anybody else interested in lending a hand also?


Okay, this week I will try to get GLee ripped out and then get the posted Linux fixes in - no promises though (I'm trying to get an indie game business started and it takes priority over everything except my regular job right now). From there I'll happily bug Brad about giving you commit rights, along with anyone else who would like to help. I still plan to burn a distro and install it eventually, but I'm in no hurry. What I really want is a Mac port. Of course, that depends on D for Mac along with my getting a Mac in the first place Smile
Back to top
View user's profile Send private message Send e-mail
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sat Oct 23, 2004 8:49 pm    Post subject: Reply with quote

Between cleaning out my Yahoo inboxes and getting my new system up and running, I've managed to lose my login info for svn. One of the disadvantages to letting ToroiseSVN remember my password, I suppose. I've emailed Brad for help, so as soon as he gets back to me I have some stuff to commit.
Back to top
View user's profile Send private message Send e-mail
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Sat Oct 23, 2004 10:11 pm    Post subject: Reply with quote

aldacron wrote:
Between cleaning out my Yahoo inboxes and getting my new system up and running, I've managed to lose my login info for svn. One of the disadvantages to letting ToroiseSVN remember my password, I suppose. I've emailed Brad for help, so as soon as he gets back to me I have some stuff to commit.


Ouch! I tend to lose my passwords quite regularly. If it weren't for my PDA, I'd be in trouble. What I do is store all my online passwords on my Tungsten C within an application appropriately called "keyring." It works great!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict 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