I am trying to compile a program that requires SFML 2.41+. Ubuntu 16.04's repos don't have a new enough version so I installed SFML 2.4.2 by following the (somewhat sparse) instructions on this page. Specifically I dowloaded the Linux version from this page, extracted it, dug down until I found the lib
, share
, and include
folders and copied those folders over the folders of the same name in /usr/local/
.
When running the included Makefile I get the following errors:
/usr/bin/ld: cannot find -lsfml-system
/usr/bin/ld: cannot find -lsfml-window
/usr/bin/ld: cannot find -lsfml-graphics
Focusing on sfml-system
for the moment, if I run ld -lsfml-system --verbose | grep /usr/local/lib
I get the following:
attempt to open //usr/local/lib/x86_64-linux-gnu/libsfml-system.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libsfml-system.a failed
attempt to open //usr/local/lib/libsfml-system.so failed
attempt to open //usr/local/lib/libsfml-system.a failed
if I run sudo ls -l /usr/local/lib | grep libsfml-system.so
I get the following:
lrwxrwxrwx 1 root root 21 Oct 16 01:38 libsfml-system.so -> libsfml-system.so.2.4
lrwxrwxrwx 1 root root 23 Oct 16 01:38 libsfml-system.so.2.4 -> libsfml-system.so.2.4.2
-rw-r--r-- 1 root root 72080 Feb 10 2017 libsfml-system.so.2.4.2
So I appear to have a symlink to a .so
file in the path ld
is looking in.
Why can't it load the library?
(I was initially concerned about the double slashes, but this question suggests those are okay.)
what i've tried so far
I've now tried running sudo ldconfig
and sudo ldconfig /usr/local/lib/
. Neither of those have changed the behaviour of ld -lsfml-system
Specifcally when I run sudo ldconfig --verbose 2> /dev/null | grep sfml
I get
libsfml-window.so.2.4 -> libsfml-window.so.2.4.2
libsfml-graphics.so.2.4 -> libsfml-graphics.so.2.4.2
libsfml-audio-d.so.2.4 -> libsfml-audio-d.so.2.4.2
libsfml-graphics-d.so.2.4 -> libsfml-graphics-d.so.2.4.2
libsfml-audio.so.2.4 -> libsfml-audio.so.2.4.2
libsfml-window-d.so.2.4 -> libsfml-window-d.so.2.4.2
libsfml-system.so.2.4 -> libsfml-system.so.2.4.2
libsfml-system-d.so.2.4 -> libsfml-system-d.so.2.4.2
libsfml-network-d.so.2.4 -> libsfml-network-d.so.2.4.2
libsfml-network.so.2.4 -> libsfml-network.so.2.4.2
libsfml-network.so.2.3 -> libsfml-network.so.2.3.2
libsfml-graphics.so.2.3 -> libsfml-graphics.so.2.3.2
libsfml-system.so.2.3 -> libsfml-system.so.2.3.2
libsfml-window.so.2.3 -> libsfml-window.so.2.3.2
(On stderr
I just get messages that appear to be merely informational,for example:
/sbin/ldconfig.real: Path `/usr/local/lib' given more than once
and
/sbin/ldconfig.real: /lib/i386-linux-gnu/ld-2.23.so is the dynamic linker, ignoring
so I figured they weren't important.)
Since /etc/ld.so.cache
was mentioned, I made a copy of it with cp /etc/ld.so.cache /etc/ld.so.cache.bak
and re-ran sudo ldconfig
. A new cache file was generated but it wasn't any different, that is diff /etc/ld.so.cache /etc/ld.so.cache.bak
doesn't print anything.