Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SFML cannot be built with the SFML_USE_DRM=true flag in FreeBSD #2472

Open
Limaaron opened this issue Mar 26, 2023 · 6 comments
Open

SFML cannot be built with the SFML_USE_DRM=true flag in FreeBSD #2472

Limaaron opened this issue Mar 26, 2023 · 6 comments

Comments

@Limaaron
Copy link

Subject of the issue

When I build a program with SFML_USE_DRM=true
FreeBSD cannot find <linux/input.h>

possible solution:

SFML/src/SFML/Window/DRM/InputImplUDev.cpp

#ifdef SFML_OS_FREEBSD 
#    include <dev/evdev/input.h>
#else
#    include <linux/input.h>
#endif

Your environment

  • FreeBSD 13.1
  • 2.6.x branch
  • LLVM, Ninja, CMake
@ChrisThrasher
Copy link
Member

Have you tested that proposed solution to confirm that it works?

@Limaaron
Copy link
Author

Have you tested that proposed solution to confirm that it works?

Unfortunately, I won't be able to test it because of the gypsum...

@Edgaru089
Copy link
Contributor

I tested this fix under a thrown-together FreeBSD VM. It compiled, but refused to link.
图片
It seems that here CMake is refusing to link with libraries under /usr/local/lib installed by pkg. Don't know how this works with other libraries like openal or libflac though.

@eXpl0it3r
Copy link
Member

Sounds like the linker wasn't made aware of the additional path. Does ldconfig also exist on FreeBSD?

@eXpl0it3r
Copy link
Member

I'm marking this as feature, since DRM support for FreeBSD wasn't really considered in the original implementation.

@Edgaru089
Copy link
Contributor

Yes ldconfig exists and it is working as expected, at least from the looks of it.

图片

I ln -sed the 3 missing libraries into /usr/lib, and everything linked. However my VM has no graphics card and I couldn't test it, it runs but could not find any DRI card.

We might need some CMake wizardry to get this linking?

图片

This seems simple in principle, we link with other libraries under /usr/local/lib anyways, however CMake scripts are like incomprehensible spells to me, and I couldn't get things straight.


I went ahead and switched to GCC instead of the default Clang, and it linked well (It blew up with warnings from sfml-network though). Here's the Clang commandline:

/usr/bin/c++ -fPIC -O3 -DNDEBUG -shared -Wl,-soname,libsfml-window.so.3.0 -o ../../../lib/libsfml-window.so.3.0.0 "CMakeFiles/sfml-window.dir/Clipboard.cpp.o" "CMakeFiles/sfml-window.dir/Context.cpp.o" "CMakeFiles/sfml-window.dir/Cursor.cpp.o" "CMakeFiles/sfml-window.dir/GlContext.cpp.o" "CMakeFiles/sfml-window.dir/GlResource.cpp.o" "CMakeFiles/sfml-window.dir/Joystick.cpp.o" "CMakeFiles/sfml-window.dir/JoystickManager.cpp.o" "CMakeFiles/sfml-window.dir/Keyboard.cpp.o" "CMakeFiles/sfml-window.dir/Mouse.cpp.o" "CMakeFiles/sfml-window.dir/Touch.cpp.o" "CMakeFiles/sfml-window.dir/Sensor.cpp.o" "CMakeFiles/sfml-window.dir/SensorManager.cpp.o" "CMakeFiles/sfml-window.dir/VideoMode.cpp.o" "CMakeFiles/sfml-window.dir/Vulkan.cpp.o" "CMakeFiles/sfml-window.dir/Window.cpp.o" "CMakeFiles/sfml-window.dir/WindowBase.cpp.o" "CMakeFiles/sfml-window.dir/WindowImpl.cpp.o" "CMakeFiles/sfml-window.dir/EGLCheck.cpp.o" "CMakeFiles/sfml-window.dir/DRM/CursorImpl.cpp.o" "CMakeFiles/sfml-window.dir/DRM/ClipboardImpl.cpp.o" "CMakeFiles/sfml-window.dir/Unix/SensorImpl.cpp.o" "CMakeFiles/sfml-window.dir/DRM/InputImplUDev.cpp.o" "CMakeFiles/sfml-window.dir/DRM/VideoModeImpl.cpp.o" "CMakeFiles/sfml-window.dir/DRM/DRMContext.cpp.o" "CMakeFiles/sfml-window.dir/DRM/WindowImplDRM.cpp.o" "CMakeFiles/sfml-window.dir/FreeBSD/JoystickImpl.cpp.o"  -Wl,-rpath,/home/edgar/SFML/build/lib:/usr/local/lib: -lEGL ../../../lib/libsfml-system.so.3.0.0 -lusbhid -ldrm -lgbm -lEGL /usr/local/lib/libdrm.so /usr/local/lib/libgbm.so -lusbhid -ldrm -lgbm /usr/local/lib/libGL.so

I can't help but notice the -Wl,-rpath,.... part, but that should not be instructing the linker where to find the libraries, instead the dynamic linker like /lib/ld-linux right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants