mickelson / sfml-pi

SFML on Linux without X11 using DRM/KMS (or dispmanx on RPi0-3)
Other
62 stars 26 forks source link

fails to find GLES2_LIBRARY on Raspbian "stretch" #6

Closed mignon-p closed 4 years ago

mignon-p commented 7 years ago

I've successfully built sfml-pi on Raspbian "jessie" in the past.

Today, I installed Raspbian "stretch" and tried to build sfml-pi on it.

It failed like this:

pi@stretch:~/src/sfml-pi $ mkdir build
pi@stretch:~/src/sfml-pi $ cd build/
pi@stretch:~/src/sfml-pi/build $ cmake .. -DSFML_RPI=1 -DEGL_INCLUDE_DIR=/opt/vc/include -DEGL_LIBRARY=/opt/vc/lib/libEGL.so -DGLES_INCLUDE_DIR=/opt/vc/include -DGLES_LIBRARY=/opt/vc/lib/libGLESv1_CM.so
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found EGL: /opt/vc/lib/libEGL.so
-- Found GLES: /opt/vc/lib/libGLESv1_CM.so
-- libudev stable: 1
-- Found UDev: /lib/arm-linux-gnueabihf/libudev.so
--    include: /usr/include
-- Found JPEG: /usr/lib/arm-linux-gnueabihf/libjpeg.so
-- Found OpenAL: /usr/lib/arm-linux-gnueabihf/libopenal.so
-- Found VORBIS: /usr/lib/arm-linux-gnueabihf/libvorbis.so
-- Found FLAC: /usr/lib/arm-linux-gnueabihf/libFLAC.so
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GLES2_LIBRARY
    linked by target "sfml-graphics" in directory /home/pi/src/sfml-pi/src/SFML/Graphics

-- Configuring incomplete, errors occurred!
See also "/home/pi/src/sfml-pi/build/CMakeFiles/CMakeOutput.log".
pi@stretch:~/src/sfml-pi/build $ ls -l /opt/vc/lib/
total 2904
-rw-r--r-- 1 root root  99516 Jul  3 03:07 libbcm_host.so
-rw-r--r-- 1 root root 202072 Jul  3 03:07 libbrcmEGL.so
-rw-r--r-- 1 root root 105768 Jul  3 03:07 libbrcmGLESv2.so
-rw-r--r-- 1 root root  99208 Sep 22  2016 libbrcmOpenVG.so
-rw-r--r-- 1 root root  78532 Jul  3 03:07 libbrcmWFC.so
-rw-r--r-- 1 root root 364540 Mar 31 12:39 libcontainers.so
-rw-r--r-- 1 root root  15932 Jul  3 03:07 libdebug_sym.so
-rw-r--r-- 1 root root  13254 Aug 11 10:05 libdebug_sym_static.a
-rw-r--r-- 1 root root  52108 Jul  3 03:07 libdtovl.so
-rw-r--r-- 1 root root 245356 Aug 11 10:05 libEGL_static.a
-rw-r--r-- 1 root root 344732 Sep 22  2016 libelftoolchain.so
-rw-r--r-- 1 root root 100008 Aug 11 10:05 libGLESv2_static.a
-rw-r--r-- 1 root root  13548 Aug 11 10:05 libkhrn_client.a
-rw-r--r-- 1 root root 450476 Aug 11 10:05 libkhrn_static.a
-rw-r--r-- 1 root root  68884 Aug 11 10:03 libmmal_components.so
-rw-r--r-- 1 root root  82144 Aug 11 10:03 libmmal_core.so
-rw-r--r-- 1 root root  15368 Aug 11 10:03 libmmal.so
-rw-r--r-- 1 root root  90800 Aug 11 10:03 libmmal_util.so
-rw-r--r-- 1 root root  44468 Aug 11 10:03 libmmal_vc_client.so
-rw-r--r-- 1 root root  33208 Aug 11 10:03 libopenmaxil.so
-rw-r--r-- 1 root root   3264 Aug 11 10:05 libvcfiled_check.a
-rw-r--r-- 1 root root  30288 Sep 22  2016 libvchiq_arm.so
-rw-r--r-- 1 root root 140504 Aug 11 10:05 libvchostif.a
-rw-r--r-- 1 root root  28462 Aug 11 10:05 libvcilcs.a
-rw-r--r-- 1 root root 173108 Sep 22  2016 libvcos.so
-rw-r--r-- 1 root root  21164 Sep 22  2016 libvcsm.so
drwxr-xr-x 3 root root   4096 Aug 15 17:23 plugins

Any idea what I should do? Thanks!

Merlinstail commented 7 years ago

Have a look in sfml-pi/cmake/Modules/FindGLES.cmake you will see that it references v1 of the library, you have v2 in your videocore libs.

mignon-p commented 7 years ago

you have v2 in your videocore libs.

How do I get v1? I installed the recommended libraries:

sudo apt-get install cmake libflac-dev libogg-dev libvorbis-dev libopenal-dev libjpeg8-dev libfreetype6-dev libudev-dev libraspberrypi-dev
Merlinstail commented 7 years ago

I believe this may be related to Firmware issue #78 but I'm not sure why CMake outputs:

Found GLES: /opt/vc/lib/libGLESv1_CM.so

when it clearly isn't there. You can try to create a link to fool it as the functionality for v1 exists in v2 according to the comments.

Merlinstail commented 7 years ago

@ppelleti I've just checked the firmware that I cloned from the raspberrypi/firmware repository the other day ... seems to have been updated on 22 Aug, ls -al on my version shows

Aug 26 22:03 libGLESv1_CM.so -> libGLESv2.so

but I also have some others that you don't have:

-rw-rw-r-- 1 <username> <username>  81551 Aug 26 22:03 libbcm_host.so
-rw-rw-r-- 1 <username> <username> 210148 Aug 26 22:03 libbrcmEGL.so
-rw-rw-r-- 1 <username> <username> 105580 Aug 26 22:03 libbrcmGLESv2.so
-rw-rw-r-- 1 <username> <username> 103542 Aug 26 22:03 libbrcmOpenVG.so
-rw-rw-r-- 1 <username> <username>  78367 Aug 26 22:03 libbrcmWFC.so
-rw-rw-r-- 1 <username> <username> 380007 Aug 26 22:03 libcontainers.so
-rw-rw-r-- 1 <username> <username>  15439 Aug 26 22:03 libdebug_sym.so
-rw-rw-r-- 1 <username> <username>  12742 Aug 26 22:03 libdebug_sym_static.a
-rw-rw-r-- 1 <username> <username>  48658 Aug 26 22:03 libdtovl.so
-rw-rw-r-- 1 <username> <username> 210148 Aug 26 22:03 libEGL.so
-rw-rw-r-- 1 <username> <username> 251410 Aug 26 22:03 libEGL_static.a
-rw-rw-r-- 1 <username> <username> 345611 Aug 26 22:03 libelftoolchain.so
lrwxrwxrwx 1 <username> <username>     12 Aug 26 22:03 libGLESv1_CM.so -> libGLESv2.so
-rw-rw-r-- 1 <username> <username> 105572 Aug 26 22:03 libGLESv2.so
-rw-rw-r-- 1 <username> <username> 100576 Aug 26 22:03 libGLESv2_static.a
-rw-rw-r-- 1 <username> <username>  13322 Aug 26 22:03 libkhrn_client.a
-rw-rw-r-- 1 <username> <username> 457824 Aug 26 22:03 libkhrn_static.a
-rw-rw-r-- 1 <username> <username>  75749 Aug 26 22:03 libmmal_components.so
-rw-rw-r-- 1 <username> <username>  86497 Aug 26 22:03 libmmal_core.so
-rw-rw-r-- 1 <username> <username>  15309 Aug 26 22:03 libmmal.so
-rw-rw-r-- 1 <username> <username>  89575 Aug 26 22:03 libmmal_util.so
-rw-rw-r-- 1 <username> <username>  44233 Aug 26 22:03 libmmal_vc_client.so
-rw-rw-r-- 1 <username> <username>  32974 Aug 26 22:03 libopenmaxil.so
-rw-rw-r-- 1 <username> <username> 103534 Aug 26 22:03 libOpenVG.so
-rw-rw-r-- 1 <username> <username>   3236 Aug 26 22:03 libvcfiled_check.a
-rw-rw-r-- 1 <username> <username>  29853 Aug 26 22:03 libvchiq_arm.so
-rw-rw-r-- 1 <username> <username> 107908 Aug 26 22:03 libvchostif.a
-rw-rw-r-- 1 <username> <username>  28342 Aug 26 22:03 libvcilcs.a
-rw-rw-r-- 1 <username> <username> 179839 Aug 26 22:03 libvcos.so
-rw-rw-r-- 1 <username> <username>  21213 Aug 26 22:03 libvcsm.so
-rw-rw-r-- 1 <username> <username>  78367 Aug 26 22:03 libWFC.so
drwxrwxr-x 2 <username> <username>   4096 Aug 26 22:03 pkgconfig
drwxrwxr-x 2 <username> <username>   4096 Aug 26 22:03 plugins
Merlinstail commented 7 years ago

Okay, so I missed it the first time round, the source of the issue is sfml-pi/src/SFML/Graphics/CMakeLists.txt which is looking for the GLES2 library ... but your issue is the same, you don't have libGLESv2.so or the link ... once you put both of those in /opt/vc/lib you should be able to build successfully

mignon-p commented 7 years ago

OK, so I need to do that by manually copying files from the raspberrypi/firmware repository? (i. e. there isn't an apt package for it?)

mignon-p commented 7 years ago

Thanks! I'll try that when I get a chance.

Merlinstail commented 7 years ago

I've taken the liberty of looking at rpi-update ... it just does the firmware, doesn't inlude the libs. I also had a look at pool/main/r/raspberrypi-firmware/libraspberrypi-dev_1.20170811-1_armhf.deb which doesn't include much at all certainly not what you need. It looks like the dev package has either been broken or it's use case has been altered.

It took a long time but I tracked down the libraries you want in a package I've not come across before:

sudo apt-get install raspberrypi-firmware-nokernel

Hopefully this resolves the issue. It would be good to get some sort of explanation from the Raspbian team, I don't like the way they've changed this ... the package name seems less intuitive than it did before as -dev.

maximus5684 commented 6 years ago

Pretty sure this issue has been resolved by updates to rpi-update. I just built several times from a new download of Stretch yesterday (after an rpi-update) and it built fine every time.