Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problems compiling DSFML-C on Linux?  (Read 6833 times)

0 Members and 1 Guest are viewing this topic.

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Problems compiling DSFML-C on Linux?
« on: November 20, 2013, 10:29:24 pm »
This is kind of embarrassing as I am the primary maintainer of the binding, but I am having some issues using this on Linux. I am pretty new to the Linux world, so it could just be my own ignorance. Also, DSFML is still 2.0 based, something I hope to fix soon, so it is possible that it might have something to do with that maybe.

Anyways... I was able to build SFML as static libraries, though when I went to build the DSFML shared libraries I got this error:

/usr/bin/ld: /home/jebbs/Documents/SFML-Statics/lib/libsfml-system-s.a(Err.cpp.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
 

I recompiled the SFML static libraries with the -fPIC switch, and now my DSFML shared libraries are able to compile. Cool. The problem now is that when I try to use the shared libraries in D, I get a bunch of undefined reference errors to all of the C functions.  I use MinGW on Windows and it works fine there, so I'm not sure what's up. Any light that can be shed would be much appreciated.


On a side note, I accidentally built shared SFML libraries first and I got this error during the process:
make[2]: *** No rule to make target `/usr/lib/x86_64-linux-gnu/libGL.so', needed by `lib/libsfml-window.so.2.0'.  Stop.
make[1]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/all] Error 2
make: *** [all] Error 2
 

Any idea what that's all about?


Thanks guys!
DSFML - SFML for the D Programming Language.

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: Problems compiling DSFML-C on Linux?
« Reply #1 on: November 25, 2013, 08:46:17 am »
The problem now is that when I try to use the shared libraries in D, I get a bunch of undefined reference errors to all of the C functions.

Good news and bad news on this. I managed to get a working example, but for some reason it only works if I build using all of the needed source files directly as opposed to building them into a static library and then linking to that.  Weird. I'll post on the D forums tonight and maybe submit a bug report if it is an problem that can't easily be fixed.


Quote

On a side note, I accidentally built shared SFML libraries first and I got this error during the process:
make[2]: *** No rule to make target `/usr/lib/x86_64-linux-gnu/libGL.so', needed by `lib/libsfml-window.so.2.0'.  Stop.
make[1]: *** [src/SFML/Window/CMakeFiles/sfml-window.dir/all] Error 2
make: *** [all] Error 2
 

Any idea what that's all about?

Got this figured out too. Looks like it was an issues with my libGL.so getting renamed somehow, and it broke the link.
DSFML - SFML for the D Programming Language.

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: Problems compiling DSFML-C on Linux?
« Reply #2 on: November 25, 2013, 08:59:19 am »
Got it working!

Apparently linking order matters with GCC(DMD's back end on Linux), but not with DMC(DMD's back end on Windows). I think I'll still post about it on the D forums just to confirm though.

DSFML - SFML for the D Programming Language.