Help => General => Topic started by: mvl on July 31, 2013, 05:00:36 pm
Title: running program uitside code::blocks in linux(ubuntu)
Post by: mvl on July 31, 2013, 05:00:36 pm
hello i installed sfml on my ubuntu (had some troubles but eventually worked) and everything was fine I made stuff compiled it and run it inside code blocks but when I tried running it outside code blocks first by double flicking the output file nothing happened so I tried to run it via the console ./name_of_program but then it gives me the error
error while loading shared libraries: libsfml-graphics.so.2: cannot open shared object file: No such file or directory
i really don't get it
Title: Re: running program uitside code::blocks in linux(ubuntu)
Post by: FRex on July 31, 2013, 05:03:37 pm
Here is a tutorial in which you'll find answer to your question: http://www.sfml-dev.org/tutorials/2.1/start-linux.php
Title: Re: running program uitside code::blocks in linux(ubuntu)
Post by: mvl on July 31, 2013, 06:40:15 pm
I already read the tutorial i installed and stuff can you please be more specific?
Title: Re: running program uitside code::blocks in linux(ubuntu)
Post by: Lo-X on July 31, 2013, 06:46:40 pm
The executable file do not find your SFML shared librairies.
You need to add the folder that contains .so files into the PATH environement variable. So your executable will find them. Or you can export them to tat PATH variable just before launching the executable. The link that FRex provided you do explain you how to do that.
Title: Re: running program uitside code::blocks in linux(ubuntu)
Post by: FRex on July 31, 2013, 06:46:54 pm
If SFML is not installed in a standard path, you need to tell the library loader where to find the SFML libraries first:
(and you probably have sfml installed in /usr/local/)
Title: Re: running program uitside code::blocks in linux(ubuntu)
Post by: mvl on July 31, 2013, 07:32:48 pm
tried that still got the problem
console output:
marnicq@ubuntu:~$ LD_LIBRARY_PATH=file:///home/marnicq/SFML-2.0 /lib && ./sfml-app bash: /lib: Is a directory marnicq@ubuntu:~$ cd projects/c++/sfml/uneversal_map_editor marnicq@ubuntu:~/projects/c++/sfml/uneversal_map_editor$ cd bin/Debug marnicq@ubuntu:~/projects/c++/sfml/uneversal_map_editor/bin/Debug$ ./uneversal_map_editor ./uneversal_map_editor: error while loading shared libraries: libsfml-graphics.so.2: cannot open shared object file: No such file or directory marnicq@ubuntu:~/projects/c++/sfml/uneversal_map_editor/bin/Debug$
thanx for replying
Title: Re: running program uitside code::blocks in linux(ubuntu)
Post by: mvl on July 31, 2013, 07:39:45 pm
sorry it worked. but one question if you want to distribute your application do other users also have to use the console I don't think thats the case but how do you make so it does it automatically or something? ;)
Title: Re: running program uitside code::blocks in linux(ubuntu)
Post by: FRex on July 31, 2013, 07:48:22 pm
You can require user to have SFML installed in standard path or do what I know what some app does: it comes with the folder in which its' needed .so are and has shell script that adds that folder to LD_LIBRARY_PATH and then runs the real app so user would click that to launch and not real executable itself. You'd still need the user to have all SFML dependencies unless you provide these too(to make sure they are built with same gcc and compatible). But I might be wrong, I'm not very experienced.
Title: Re: running program uitside code::blocks in linux(ubuntu)
Post by: mvl on July 31, 2013, 08:14:14 pm
what i don't get is when i made it on windows you just need to PUT IT IN THE SAME FOLDER AS EXECUTABLE and it would FIND the .ddl's in linux .so why is it not FINDING IT IN THE SAME FOLDER AS EXECUTABLE?
and like you said with the shel script how do you make such script
Title: Re: running program uitside code::blocks in linux(ubuntu)
Post by: FRex on July 31, 2013, 08:30:13 pm
Scripts are lines in a text file that has permission to execute(chmod +x), starting with hashbang: http://en.wikipedia.org/wiki/Shebang_%28Unix%29#Examples and scripts that use one of shells(typically not csh but sh or bash, because they are almost always present) are shell scripts. Your terminal is bash so a bash script has same syntax as your commands do. You should learn at least a tiny little about scripts and bash. ;)
Title: Re: running program uitside code::blocks in linux(ubuntu)
Post by: mvl on July 31, 2013, 10:03:42 pm