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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - georgios_doumas

Pages: [1]
1
Hello all. I am new to SFML , and I intend to use it on Scientific Linux 7.4 , so I went  to the tutorial "SFML and Linux" and started reading. When I realized that my distribution does not have a package to do an easy :     sudo yum install <sfml-package-name>
(once again I envy Debian for providing one!)
I thought "ok , I will install from source" , but when I start reading "Compiling SFML with CMake" , and after I finished with downloading as much as I could of the dependencies (I had to be creative about the names of the packages, and always preferred to download more to be on the safe side) , then I realized that the screenshots for Cmake were for Windows machines. So I thought to avoid continuing, because I would never be sure if what I do is correct.
And thus I decided to use the precompiled binaries of the Download page. I started with 2.4.2 , downloaded it and untared it , and the step of
g++ -c main.cpp -I<sfml-install-path>/include
was OK but  but when I tried to do the next step
g++ main.o -o sfml-app -L<sfml-install-path>/lib -lsfml-graphics -lsfml-window -lsfml-system
I got complains about libjpeg.so.8 needed , then I downloaded a relevant package from www.rpmfind.net  ( I found an .rpm from opensuse )
but still I got another complain about GLIBCXX_3.4.20 , so it seems that the version of libstdc++ that centos7.4 and Scientific Linux have, can provide only up to GLIBCXX_3.4.19 , and could not install a separate version of libstdc++ from rpmfind.net ( I downloaded one version from rpmfind.net, coming from Fedora , but the command rpm -i failed due to dependency missing, so I gave up).
Then I started thinking "maybe I can use an older version of sfml that will require versions of packages that are already installed on my system. Lets see how far back do I have to go.."
The short answer is : for Centos7.4 / ScientificLinux7.4 , you need sfml2.2
Here are some instruction for the non-experienced users:
Open a terminal and go to your Downloads dir
cd ~/Downloads
wget  https://www.sfml-dev.org/files/SFML-2.2-linux-gcc-64-bit.tar.gz
ls -l
cd /opt
tar -xvzf /home/yourusername/Downloads/SFML-2.2-linux-gcc-64-bit.tar.gz
ls -l SFML-2.2
cd ~/Documents
Use a text editor (bluefish is a good text editor suitable for programming) to create the file main.cpp
that exists on https://www.sfml-dev.org/tutorials/2.4/start-linux.php
and then the commands to compile and build will look like this :
g++ -c main.cpp -I/opt/SFML-2.2/include
g++ main.o -o sfml-app -L/opt/SFML-2.2/lib  -lsfml-graphics -lsfml-window -lsfml-system
export LD_LIBRARY_PATH=/opt/SFML-2.2/lib  &&  ./sfml-app
As a helpful extra step you can now create a symbolic link so that you do not have to put the -I/opt/SFML-2.2/include anymore :
sudo ln -s /opt/SFML-2.2/include/SFML/   /usr/local/include/SFML
and now the 1st line of the source file main.cpp
#include <SFML/Graphics.hpp>
will look as usual to the standard place /usr/local/include and it will find a directory named SFML/
and under this directory it will find the file Graphics.hpp
So you can just compile with  the command :
g++ -c main.cpp

I tried to make sym links for the /opt/SFML-2.2/lib into the /usr/local/lib but the command
g++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system
complains. I will try to simply copy files from /opt/SFML-2.2/lib to the /usr/local/lib

So the easy way is to avoid creating symlinks in the /usr/local/lib and just copy the whole directory:
sudo cp  -r  /opt/SFML-2.2/lib/  /usr/local/
and you have what the tutorial mentions as a "standard path"

Pages: [1]