-
Notifications
You must be signed in to change notification settings - Fork 93
Linux
Sergey edited this page Jan 6, 2019
·
8 revisions
git- Account with
sudo. It is not required but a global install of SFML would make the process a lot easier.
If you have versions lower than 2.4 from apt for example, remove that before installing SFML v2.4.
If your OS is Archlinux, you can do
sudo pacman -S sfml csfml
sudo apt-get install build-essential cmake git \
libx11-dev freeglut3-dev libxcb-image0-dev libudev-dev libjpeg8-dev libopenal-dev libsndfile1-dev libfreetype6-devFirst make a folder to hold all of the files that you are installing.
mkdir sfml
cd sfmlThen clone the latest release of SFML from Github.
git clone https://github.com/SFML/SFML
cd SFML
# Get latest release version (2.5)
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
cd ..Do the same for CSFML, a dependency for rust-sfml.
git clone https://github.com/SFML/CSFML
cd CSFML
# Get latest release version (2.5)
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
cd ..Then install SFML. SFML must be installed before CSFML as CSFML depends on the built version of SFML to build.
cd SFML
cmake .
make all
sudo make install
cd ..Then install CSFML
cd CSFML
SFML="$(realpath ../SFML)"
cmake -DCMAKE_MODULE_PATH="$SFML/cmake/Modules" .
make all
sudo make install
cd ..That's it. You now have SFML installed and can now run Rust-SFML.
/usr/bin/ld: warning: libsfml-window.so.2.4, needed by //usr/local/lib/libcsfml-graphics.so, may conflict with libsfml-window.so.2.3
You have a conflicting version of SFML installed. Remove all versions that are not 2.4
//usr/local/lib/libsfml-graphics.so: undefined reference to `__cpu_model'
This is a problem that exists from GCC 5.0 and above. Go to your SFML files, edit src/SFML/Graphics/CMakeLists.txt to have
# ImageLoader.cpp must be compiled with the -fno-strict-aliasing
# when gcc is used; otherwise saving PNGs may crash in stb_image_write
if(SFML_COMPILER_GCC)
set_source_files_properties(${SRCROOT}/ImageLoader.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing)
endif()
# NEW CODE BEGINS
if(SFML_COMPILER_GCC AND BUILD_SHARED_LIBS)
message(WARNING Applying workaround)
list(APPEND GRAPHICS_EXT_LIBS "-lgcc_s -lgcc")
endif()
# NEW CODE ENDS