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

Author Topic: Using SFML on linux without full privileges  (Read 4793 times)

0 Members and 1 Guest are viewing this topic.

Tosh

  • Newbie
  • *
  • Posts: 3
    • View Profile
Using SFML on linux without full privileges
« on: October 19, 2009, 08:04:08 pm »
I intended on using SFML for a linux project in my university, but this means that I can't use sudo (as the installation tutorial suggests). Is it possible for me to still use SFML in some other way? I have read a little about path environment variables and it sounds like something like that might help, but I don't know if that's correct, nor do I have any idea where to begin even if it is. Any help would be greatly appreciated =]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Using SFML on linux without full privileges
« Reply #1 on: October 19, 2009, 08:38:59 pm »
You just have to install it to a directory where you have write access (maybe /usr/local? oherwise just install it to /home/you/whatever).

Then, if you installed it to a directory that your linker doesn't know, you'll have to pass it to the compile command with "-Lpath/to/sfml".

That's it.
Laurent Gomila - SFML developer

christoph

  • Full Member
  • ***
  • Posts: 102
    • View Profile
    • http://www.christoph-egger.org
Using SFML on linux without full privileges
« Reply #2 on: October 19, 2009, 11:08:02 pm »
You'll need -I for the includes as well and might need some rpath fun for running the result ;)

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Using SFML on linux without full privileges
« Reply #3 on: October 20, 2009, 12:34:03 am »
When starting applications, you can also set the LD_LIBRARY_PATH environment variable so that shared libraries are found in a custom path.

Tosh

  • Newbie
  • *
  • Posts: 3
    • View Profile
Using SFML on linux without full privileges
« Reply #4 on: October 20, 2009, 04:58:22 pm »
Thanks a lot for the help guys, but I still haven't quite been able to get it to work x.x

The include errors are gone, so I think that part works, but it still doesn't seem to be linking properly. This is probably due to some misunderstanding about how things work on my part, but I thought that what I was doing made sense:

Code: [Select]
g++ test.cpp -I"SFML-1.5/include" -L"SFML-1.5/lib"
And the response:

Code: [Select]
/tmp/ccTV6P9l.o: In function `main':
main.cpp:(.text+0x74): undefined reference to `sf::Clock::Clock()'
main.cpp:(.text+0x81): undefined reference to `sf::Clock::GetElapsedTime() const'
main.cpp:(.text+0xae): undefined reference to `sf::Sleep(float)'
main.cpp:(.text+0xb9): undefined reference to `sf::Clock::GetElapsedTime() const'
collect2: ld returned 1 exit status

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Using SFML on linux without full privileges
« Reply #5 on: October 20, 2009, 05:23:00 pm »
You have to link to the SFML libraries. Add "-lsfml-system" (same for all SFML modules that you need).
Laurent Gomila - SFML developer

Tosh

  • Newbie
  • *
  • Posts: 3
    • View Profile
Using SFML on linux without full privileges
« Reply #6 on: October 20, 2009, 06:52:19 pm »
Okay, that was just me being stupid. Unfortunately, now that the bit linking to sfml-system is there, I can confirm that I am hopelessly stumped again:

Code: [Select]
vector38% g++ main.cpp -L"../SFML-1.5/lib" -I"../SFML-1.5/include" -lsfml-system

/usr/bin/ld: cannot find -lsfml-system
collect2: ld returned 1 exit status

vector38% ls ../SFML-1.5/lib
libsfml-audio.so.1.5     libsfml-network.so.1.5  libsfml-window.so.1.5
libsfml-graphics.so.1.5  libsfml-system.so.1.5


As far as I can tell, the files are exactly where it is looking for them. Also, it might be worth noting that the extent of my "installation" was to simply unzip the whole folder. I don't know if the actual install command in the makefile does something smarter than that, and my attempt to change the path it was pointing to just resulted in it telling me that a rule did not exist.

Sorry for wasting so much of your time, I'm just not used to doing things like this in linux, and I am finding it very difficult to find general information to help me using google.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Using SFML on linux without full privileges
« Reply #7 on: October 21, 2009, 12:50:40 am »
ld looks for libraries ending with .so, so you have to create some symlinks, like libsfml-audio.so -> libsfml-audio.so.1.5 (do that with "ln -s libsfml-audio-so.1.5 libsfml-audio.so).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Using SFML on linux without full privileges
« Reply #8 on: October 21, 2009, 08:24:05 am »
The "install" target of the SFML makefiles creates these symbolic links; so I guess that you copied the files manually instead of properly installing it :)
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Using SFML on linux without full privileges
« Reply #9 on: October 21, 2009, 12:57:16 pm »
To make that work "DESTDIR" in src/Makefile must be adjusted. But you're right, that simplifies things, of course.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Using SFML on linux without full privileges
« Reply #10 on: October 21, 2009, 01:37:21 pm »
Quote
To make that work "DESTDIR" in src/Makefile must be adjusted

You can pass your own path:
Code: [Select]
make install DESTDIR=/home/sfml
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Using SFML on linux without full privileges
« Reply #11 on: October 21, 2009, 02:53:23 pm »
That never worked on my side, strange.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Using SFML on linux without full privileges
« Reply #12 on: October 21, 2009, 03:12:12 pm »
Really? I'll test it next time I use my Linux.
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Using SFML on linux without full privileges
« Reply #13 on: October 21, 2009, 03:37:15 pm »
No need to. It works, I guess I've done something wrong before. :)

 

anything