I used the master-branch in my test (downloaded as ZIP from github).
Now I cloned the master and tried again, same error.
Just to be clear: I can compile the esfml-Projekt using cmake and make, but I cant complie my project using libsfml, throwing:
/usr/local/lib/libsfml-window.so:-1: error: undefined reference to `sf::priv::GlxContext::selectBestVisual(_XDisplay*, unsigned int, sf::ContextSettings const&)'
Minimal example:
#include <sfml/graphics.hpp>
int main()
{
sf::RenderWindow win(sf::VideoMode::getDesktopMode(),"test");
return 0;
}
Compiling with:
g++ -o test main.cpp -lsfml-graphics -lsfml-window -lsfml-system -lEGL -lGLESv1_CM
btw: Is there a reason why you changed the Include-Files from UpperCase to LowerCase?
include/SFML/Graphics.hpp
to
include/sfml/graphics.hpp
-DSFML_EMBEDDED_SYSTEM is missing. That means CMake failed to detect your platform and thus, has set SFML_EMBEDDED_SYSTEM at false. Try:
cmake -DSFML_EMBEDDED_SYSTEM
btw: Is there a reason why you changed the Include-Files from UpperCase to LowerCase?
include/SFML/Graphics.hpp
to
include/sfml/graphics.hpp
This is an experimental repository meant to try new stuff. The Android port was a new stuff and it will be adapted then merged into the official repository soon. You can read the wiki.
Damn, somehow I removed this from my last post:
Flags from make VERBOSE=1 for sfml-graphics:
-DGLEW_STATIC -DGL_GLEXT_PROTOTYPES -DSFML_EMBEDDED_SYSTEM -DSFML_GRAPHICS_EXPORTS -DSTBI_FAILURE_USERMSG -O3 -DNDEBUG -fPIC
So -DSFML_EMBEDDED_SYSTEM is not missing.
Nevertheless I try again with
cmake -DSFML_EMBEDDED_SYSTEM=1 ..
make
sudo make install
But compiling of the minimal example still causes the same error.
#include <sfml/graphics.hpp>
int main()
{
sf::RenderWindow win(sf::VideoMode::getDesktopMode(),"test");
return 0;
}
g++ -o test main.cpp -lsfml-graphics -lsfml-window -lsfml-system -lEGL -lGLESv1_CM
/usr/local/lib/libsfml-window.so: undefined reference to `sf::priv::GlxContext::selectBestVisual(_XDisplay*, unsigned int, sf::ContextSettings const&)'
Does the example compile on your RPi?
This is my first post so, first of all, I would like to congratulate everybody on the SFML team.
I've been using SFML for a while so I think it's time to participate in the forums and join this awesome comunity.
I've downloaded Sonkun's eSFML and tried to make it work in a raspberry pie without success. I stumbled in the same problem as Ghosa: the undefined reference to
sf::priv::GlxContext::selectBestVisual(_Xdisplay*, unsigned int, sf::ContextSettings const&);
I digged a little bit and found that the _EGLContext class is missing this method. Should it be declared in the GlContext class and then defined in the _EGLContext class (I'm no expert at all in this... just trying to guess :P)
Is there any way to fix this? As described by Ghosa this happens when linking with the -lsfml-window flag.
Thanks :)
That would be awesome, thanks :)
OK, here is the quick an dirty fix to make the ESFML-Code on Github run with EGL under Linux.
I don't have my AC100 here to test it, so I hope I didn't forget anything:
WindowImplX11.cpp
Change Line 31:
#include <sfml/window/Linux/GlxContext.hpp>
to:
#ifndef SFML_EMBEDDED_SYSTEM
#include <sfml/window/Linux/GlxContext.hpp>
#else
#include <sfml/window/Linux/EGLContext.hpp>
#endif
Change Line 152:
XVisualInfo visualInfo = GlxContext::selectBestVisual(m_display, mode.bitsPerPixel, settings);
to:
#ifndef SFML_EMBEDDED_SYSTEM
XVisualInfo visualInfo = GlxContext::selectBestVisual(m_display, mode.bitsPerPixel, settings);
#else
XVisualInfo visualInfo = _EGLContext::selectBestVisual(m_display, mode.bitsPerPixel, settings);
#endif
EGLContext.hpp
Add:
static XVisualInfo selectBestVisual(::Display* display, unsigned int bitsPerPixel, const ContextSettings& settings);
EGLContext.cpp
Add:
XVisualInfo _EGLContext::selectBestVisual(::Display* display, unsigned int bitsPerPixel, const ContextSettings& settings)
{
// Retrieve all the visuals
int count;
XVisualInfo* visuals = XGetVisualInfo(display, 0, NULL, &count);
if (visuals)
{
XVisualInfo bestVisual;
//ToDo: Calculate best Visual
//select first Visual for now
bestVisual = visuals[0];
return bestVisual;
}
else
{
// Should never happen...
err() << "No EGL visual found. You should check your graphics driver" << std::endl;
return XVisualInfo();
}
}