SiegeLord / DAllegro5

D binding to the Allegro5 game development library
Other
42 stars 15 forks source link

segfault ubuntu + ldc2 #30

Closed katastic closed 8 years ago

katastic commented 8 years ago

I just downloaded a fresh LDC2, compiled it, and then tried both DAlleg and DAlleg unstable, and they both compile fine but segfault when running the example program.

Program received signal SIGSEGV, Segmentation fault.

al_create_display (w=500, h=500) at /home/[USER]/Downloads/allegro-5.1.11/src/display.c:47

47 driver = system->vt->get_display_driver();

(gdb) bt

0 al_create_display (w=500, h=500) at /home/[USER]/Downloads/allegro-5.1.11/src/display.c:47

1 0x0000000000402c3a in a5test.main() ()

2 0x0000000000425c1e in allegro5.system.al_run_allegro() ()

3 0x0000000000425bf4 in allegro5.system.al_run_allegro() ()

4 0x0000000000402bee in D main ()

5 0x0000000000414814 in _d_run_main ()

6 0x0000000000409a98 in main ()

---> It appears that al_init() is returning 0 and the example program does not check for this condition. Of course, why it's failing on my system is huge question.

I have a 5.1.11 Allegro 5 program compiling and running just fine on my system. (Just checked again to be sure.)

[edit] I added a version writefln statement. It reports 5.1.11.1. Which is the exact same version I'm compiling my C++ one in.

[edit] Okay, I'm stepping through with gdb and it looks like:

83888641 - version 83954433 - library version

But in my C++ program it reports:

83954433 83954433

Strange indeed...

Perhaps DAlleg has slightly older Allegro headers?

rcorre commented 8 years ago

Perhaps DAlleg has slightly older Allegro headers?

Currently DAllegro has tagged releases for 5.0.10 and 5.1.8. I recently added bindings for 5.1.11-5.1.13, but if you're using dub there's no tagged releases for it to use yet. @SiegeLord, mind pushing tags for these?

An alternative is simply to checkout and build the version of DAllegro you want.

katastic commented 8 years ago

Okay, well it was my fault.

I thought I cloned the 5.1 branch of DAlleg, but it was actually the master twice. Of course, I have Allegro 5.1.11 and when I cloned the DAlleg branch, it's now 5.1.13, so it still would have exploded until I realized what was going on.

Also, since there's so little change between a typical version, it might be worth noting that you can just change the DAlleg base.d file's version numbers to match yours and if they're close enough, they'll work. (Disclaimer: I haven't tested everything, but the test app runs just fine with 5.1.11 and 5.1.13.)

SiegeLord commented 8 years ago

f4916e549ee6b12b3e596cfaa0d3c698c2c92c95 adds an informative check with the expected/actual version printout.