SFML community forums

Help => General => Topic started by: aNewHobby on July 04, 2012, 01:35:24 am

Title: Problems compiling an release SFML2 application on linux
Post by: aNewHobby on July 04, 2012, 01:35:24 am
Hi I am trying to compile on linux, (ubuntu) but I am having a problem with static linking. I would like to static link as there isn't a sfml2 pack out people can easily install. Everything compiles fine normally, but if I add the -s to the linker then it all goes haywire.

log - http://ctrlv.it/id/MzAwMzky
(http://www2.picturepush.com/photo/a/8643225/img/8643225.png)
(http://www4.picturepush.com/photo/a/8643227/img/8643227.png)

Maybe static isn't the way to go? But if I remove the -s and the #define it will now compile fine and even play, like in code::blocks when i press the build/run button... the application runs... but then if i go to the file itself.. as in the one I would post and send to people to use, it will not run?

(http://www1.picturepush.com/photo/a/8643279/img/8643279.png)
(http://www3.picturepush.com/photo/a/8643281/img/8643281.png)
Title: Re: Problems compiling an release SFML2 application on linux
Post by: Laurent on July 04, 2012, 07:58:46 am
If you link SFML statically, you must link all its dependencies too.

But you can simply provide the SFML libraries with your application.
Title: Re: Problems compiling an release SFML2 application on linux
Post by: aNewHobby on July 04, 2012, 04:00:20 pm
But you can simply provide the SFML libraries with your application.

ok.. how would I "include" the binaries.. I have tried copying the files into the same dir as the executable. but no luck... can you explain what you mean?
Title: Re: Problems compiling an release SFML2 application on linux
Post by: Laurent on July 04, 2012, 04:07:28 pm
By default, "." (the current directory) is not known by the library loader, so it can't find the SFML libraries if you just copy them there -- unlike what happens on Windows.

You have to add "." to the library loader's paths before launching your executable.

export LD_LIBRARY_PATH=.
./my_program

You should search more information about this, I'm not an expert :)
Title: Re: Problems compiling an release SFML2 application on linux
Post by: aNewHobby on July 05, 2012, 03:47:25 am
still a bit shaky on this but I "think" it runs....

ArkBreker-Linux (http://www.mediafire.com/?l9t0df9mspi60gg)

You may need to run the .sh file... if you can not then sudo chmod +x ArkBreaker.sh first