raysan5 / raylib

A simple and easy-to-use library to enjoy videogames programming
http://www.raylib.com
zlib License
22.66k stars 2.28k forks source link

Raylib not building for PLATFORM_DRM on Debian Bullseye #2549

Closed computermouth closed 2 years ago

computermouth commented 2 years ago

At first I was trying to build this for armhf (non-pi, mesa gles2), and I was finding these errors, so I just tried to build it for x86_64 (where I already have a working install for desktop/x11 raylib), and I discovered that the issue persists.

So far I've tried building with the included glfw, as well as compiling glfw from source (with -DUSE_EXTERNAL_GLFW=ON). No luck.

Maybe I'm just missing something simple, but the wiki page doesn't mention much about building for DRM. Any suggestions? My final target is an armhf handheld that I've successfully used SDL2 with on DRM.

Process for armhf is the same, except FROM arm32v7/debian.

Dockerfile:

FROM debian

RUN apt-get update \
    && apt install -y \
    build-essential git libasound2-dev libdrm-dev \
    libgles2-mesa-dev libgbm-dev cmake \
    && cd \
    && git clone https://github.com/raysan5/raylib.git raylib \
    && cd raylib \
    && git checkout 4.0.0 \
    && mkdir build && cd build \
    && cmake -DPLATFORM=DRM -DBUILD_SHARED_LIBS=ON .. \
    && make -j10 \
    && make install

Full log:

$ cmake -DPLATFORM=DRM -DBUILD_SHARED_LIBS=ON ..
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_HAS_THOSE_TOGGLES
-- Performing Test COMPILER_HAS_THOSE_TOGGLES - Success
-- Testing if -Werror=pointer-arith can be used -- compiles
-- Testing if -Werror=implicit-function-declaration can be used -- compiles
-- Testing if -fno-strict-aliasing can be used -- compiles
-- Setting build type to 'Debug' as none was specified.
-- Using external GLFW
-- Audio Backend: miniaudio
-- Building raylib shared library
-- Generated build type: Debug
-- Compiling with the flags:
--   PLATFORM=PLATFORM_DRM
--   GRAPHICS=GRAPHICS_API_OPENGL_ES2
-- Building examples is enabled
-- Looking for CLOCK_MONOTONIC
-- Looking for CLOCK_MONOTONIC - found
-- Looking for QueryPerformanceCounter
-- Looking for QueryPerformanceCounter - not found
-- Looking for stdatomic.h
-- Looking for stdatomic.h - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Testing if -std=c11 can be used -- compiles
-- Configuring done
-- Generating done
-- Build files have been written to: /home/computermouth/projects/raylib4/build
computermouth@thinkrad:~/projects/raylib4/build$ make -j10
Scanning dependencies of target raylib
[  0%] Building C object raylib/CMakeFiles/raylib.dir/rshapes.c.o
[  0%] Building C object raylib/CMakeFiles/raylib.dir/rtext.c.o
[  1%] Building C object raylib/CMakeFiles/raylib.dir/rcore.c.o
[  1%] Building C object raylib/CMakeFiles/raylib.dir/rtextures.c.o
[  2%] Building C object raylib/CMakeFiles/raylib.dir/rmodels.c.o
[  2%] Building C object raylib/CMakeFiles/raylib.dir/utils.c.o
[  3%] Building C object raylib/CMakeFiles/raylib.dir/raudio.c.o
[  3%] Linking C shared library libraylib.so
[  3%] Built target raylib
Scanning dependencies of target embedded_files_loading
Scanning dependencies of target shaders_custom_uniform
Scanning dependencies of target models_yaw_pitch_roll
Scanning dependencies of target shaders_julia_set
Scanning dependencies of target shapes_easings_ball_anim
Scanning dependencies of target models_loading_gltf
Scanning dependencies of target models_cubicmap
Scanning dependencies of target textures_to_image
Scanning dependencies of target core_quat_conversion
Scanning dependencies of target models_mesh_picking
[  5%] Building C object examples/CMakeFiles/models_yaw_pitch_roll.dir/models/models_yaw_pitch_roll.c.o
[  5%] Building C object examples/CMakeFiles/shaders_julia_set.dir/shaders/shaders_julia_set.c.o
[  6%] Building C object examples/CMakeFiles/shapes_easings_ball_anim.dir/shapes/shapes_easings_ball_anim.c.o
[  7%] Building C object examples/CMakeFiles/shaders_custom_uniform.dir/shaders/shaders_custom_uniform.c.o
[  7%] Building C object examples/CMakeFiles/models_cubicmap.dir/models/models_cubicmap.c.o
[  7%] Building C object examples/CMakeFiles/textures_to_image.dir/textures/textures_to_image.c.o
[  8%] Building C object examples/CMakeFiles/embedded_files_loading.dir/others/embedded_files_loading.c.o
[  8%] Building C object examples/CMakeFiles/models_mesh_picking.dir/models/models_mesh_picking.c.o
[  7%] Building C object examples/CMakeFiles/models_loading_gltf.dir/models/models_loading_gltf.c.o
[  8%] Building C object examples/CMakeFiles/core_quat_conversion.dir/core/core_quat_conversion.c.o
[  8%] Linking C executable shaders_julia_set
[  8%] Linking C executable shaders_custom_uniform
[  9%] Linking C executable models_loading_gltf
[ 10%] Linking C executable models_cubicmap
[ 10%] Linking C executable models_yaw_pitch_roll
[ 10%] Linking C executable shapes_easings_ball_anim
[ 11%] Linking C executable textures_to_image
[ 11%] Linking C executable models_mesh_picking
[ 12%] Linking C executable core_quat_conversion
[ 12%] Built target shaders_julia_set
[ 12%] Built target shaders_custom_uniform
[ 12%] Built target models_yaw_pitch_roll
[ 12%] Built target models_loading_gltf
Scanning dependencies of target core_window_letterbox
[ 12%] Built target textures_to_image
[ 12%] Built target shapes_easings_ball_anim
Scanning dependencies of target rlgl_compute_shader
Scanning dependencies of target core_input_mouse_wheel
[ 13%] Building C object examples/CMakeFiles/core_window_letterbox.dir/core/core_window_letterbox.c.o
Scanning dependencies of target easings_testbed
[ 13%] Built target models_mesh_picking
Scanning dependencies of target core_window_flags
[ 13%] Building C object examples/CMakeFiles/rlgl_compute_shader.dir/others/rlgl_compute_shader.c.o
[ 13%] Built target models_cubicmap
[ 14%] Building C object examples/CMakeFiles/core_input_mouse_wheel.dir/core/core_input_mouse_wheel.c.o
[ 14%] Built target core_quat_conversion
[ 15%] Building C object examples/CMakeFiles/core_window_flags.dir/core/core_window_flags.c.o
Scanning dependencies of target core_custom_frame_control
Scanning dependencies of target models_rlgl_solar_system
[ 15%] Building C object examples/CMakeFiles/easings_testbed.dir/others/easings_testbed.c.o
Scanning dependencies of target core_loading_thread
Scanning dependencies of target models_loading_vox
[ 15%] Building C object examples/CMakeFiles/core_custom_frame_control.dir/core/core_custom_frame_control.c.o
[ 15%] Building C object examples/CMakeFiles/core_loading_thread.dir/core/core_loading_thread.c.o
[ 15%] Building C object examples/CMakeFiles/models_rlgl_solar_system.dir/models/models_rlgl_solar_system.c.o
[ 15%] Building C object examples/CMakeFiles/models_loading_vox.dir/models/models_loading_vox.c.o
[ 15%] Linking C executable core_input_mouse_wheel
[ 15%] Linking C executable core_window_letterbox
[ 16%] Linking C executable core_custom_frame_control
[ 17%] Linking C executable rlgl_compute_shader
[ 18%] Linking C executable core_loading_thread
[ 18%] Linking C executable core_window_flags
[ 19%] Linking C executable easings_testbed
[ 20%] Linking C executable models_rlgl_solar_system
[ 20%] Linking C executable models_loading_vox
[ 20%] Built target core_input_mouse_wheel
[ 20%] Built target rlgl_compute_shader
[ 20%] Built target core_custom_frame_control
Scanning dependencies of target audio_music_stream
Scanning dependencies of target models_animation
[ 21%] Building C object examples/CMakeFiles/audio_music_stream.dir/audio/audio_music_stream.c.o
Scanning dependencies of target core_basic_window_web
[ 21%] Built target core_window_letterbox
[ 21%] Built target core_loading_thread
[ 22%] Building C object examples/CMakeFiles/models_animation.dir/models/models_animation.c.o
[ 22%] Building C object examples/CMakeFiles/core_basic_window_web.dir/core/core_basic_window_web.c.o
[ 22%] Built target easings_testbed
Scanning dependencies of target core_storage_values
Scanning dependencies of target core_3d_camera_free
[ 22%] Built target core_window_flags
[ 22%] Built target models_rlgl_solar_system
[ 22%] Building C object examples/CMakeFiles/core_3d_camera_free.dir/core/core_3d_camera_free.c.o
Scanning dependencies of target textures_image_text
Scanning dependencies of target core_basic_screen_manager
[ 22%] Building C object examples/CMakeFiles/core_storage_values.dir/core/core_storage_values.c.o
Scanning dependencies of target core_2d_camera
[ 22%] Linking C executable audio_music_stream
[ 22%] Built target models_loading_vox
[ 23%] Linking C executable core_basic_window_web
[ 23%] Linking C executable models_animation
[ 23%] Building C object examples/CMakeFiles/textures_image_text.dir/textures/textures_image_text.c.o
[ 24%] Building C object examples/CMakeFiles/core_basic_screen_manager.dir/core/core_basic_screen_manager.c.o
[ 25%] Building C object examples/CMakeFiles/core_2d_camera.dir/core/core_2d_camera.c.o
[ 25%] Linking C executable core_3d_camera_free
Scanning dependencies of target models_geometric_shapes
[ 26%] Linking C executable core_storage_values
[ 27%] Building C object examples/CMakeFiles/models_geometric_shapes.dir/models/models_geometric_shapes.c.o
[ 27%] Built target audio_music_stream
[ 27%] Linking C executable core_basic_screen_manager
[ 28%] Linking C executable textures_image_text
[ 28%] Built target models_animation
Scanning dependencies of target text_font_spritefont
[ 28%] Linking C executable core_2d_camera
[ 28%] Built target core_basic_window_web
[ 28%] Building C object examples/CMakeFiles/text_font_spritefont.dir/text/text_font_spritefont.c.o
[ 28%] Built target core_3d_camera_free
Scanning dependencies of target shapes_logo_raylib
[ 28%] Built target core_storage_values
Scanning dependencies of target core_2d_camera_platformer
Scanning dependencies of target core_input_mouse
[ 28%] Linking C executable models_geometric_shapes
[ 29%] Building C object examples/CMakeFiles/core_2d_camera_platformer.dir/core/core_2d_camera_platformer.c.o
[ 29%] Linking C executable embedded_files_loading
[ 31%] Building C object examples/CMakeFiles/shapes_logo_raylib.dir/shapes/shapes_logo_raylib.c.o
[ 31%] Linking C executable text_font_spritefont
Scanning dependencies of target textures_image_drawing
[ 31%] Building C object examples/CMakeFiles/core_input_mouse.dir/core/core_input_mouse.c.o
[ 31%] Built target core_basic_screen_manager
[ 31%] Building C object examples/CMakeFiles/textures_image_drawing.dir/textures/textures_image_drawing.c.o
[ 31%] Built target textures_image_text
[ 31%] Built target core_2d_camera
Scanning dependencies of target core_basic_window
Scanning dependencies of target rlgl_standalone
[ 32%] Building C object examples/CMakeFiles/core_basic_window.dir/core/core_basic_window.c.o
[ 32%] Building C object examples/CMakeFiles/rlgl_standalone.dir/others/rlgl_standalone.c.o
Scanning dependencies of target textures_logo_raylib
[ 32%] Linking C executable shapes_logo_raylib
[ 32%] Built target models_geometric_shapes
[ 32%] Built target text_font_spritefont
[ 32%] Built target embedded_files_loading
[ 32%] Linking C executable core_input_mouse
[ 33%] Linking C executable textures_image_drawing
[ 33%] Linking C executable core_basic_window
Scanning dependencies of target core_3d_picking
Scanning dependencies of target models_mesh_generation
Scanning dependencies of target shaders_basic_lighting
[ 33%] Building C object examples/CMakeFiles/textures_logo_raylib.dir/textures/textures_logo_raylib.c.o
[ 33%] Linking C executable core_2d_camera_platformer
[ 33%] Building C object examples/CMakeFiles/core_3d_picking.dir/core/core_3d_picking.c.o
[ 34%] Building C object examples/CMakeFiles/shaders_basic_lighting.dir/shaders/shaders_basic_lighting.c.o
[ 35%] Building C object examples/CMakeFiles/models_mesh_generation.dir/models/models_mesh_generation.c.o
In file included from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:62:
/home/computermouth/projects/raylib4/src/rlgl.h:834:42: error: conflicting types for ‘glClearDepthf’
  834 |     #define glClearDepth                 glClearDepthf
      |                                          ^~~~~~~~~~~~~
In file included from /home/computermouth/projects/raylib4/src/rlgl.h:748,
                 from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:62:
/usr/include/GLES2/gl2.h:543:29: note: previous declaration of ‘glClearDepthf’ was here
  543 | GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
      |                             ^~~~~~~~~~~~~
[ 35%] Built target shapes_logo_raylib
In file included from /usr/include/GL/gl.h:2050,
                 from /home/computermouth/projects/raylib4/examples/others/external/include/GLFW/glfw3.h:202,
                 from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:70:
/usr/include/GL/glext.h:1286:21: error: ‘glBindVertexArray’ redeclared as different kind of symbol
 1286 | GLAPI void APIENTRY glBindVertexArray (GLuint array);
      |                     ^~~~~~~~~~~~~~~~~
In file included from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:62:
/home/computermouth/projects/raylib4/src/rlgl.h:968:36: note: previous definition of ‘glBindVertexArray’ was here
  968 | static PFNGLBINDVERTEXARRAYOESPROC glBindVertexArray = NULL;
      |                                    ^~~~~~~~~~~~~~~~~
In file included from /usr/include/GL/gl.h:2050,
                 from /home/computermouth/projects/raylib4/examples/others/external/include/GLFW/glfw3.h:202,
                 from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:70:
/usr/include/GL/glext.h:1287:21: error: ‘glDeleteVertexArrays’ redeclared as different kind of symbol
 1287 | GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
      |                     ^~~~~~~~~~~~~~~~~~~~
In file included from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:62:
/home/computermouth/projects/raylib4/src/rlgl.h:969:39: note: previous definition of ‘glDeleteVertexArrays’ was here
  969 | static PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArrays = NULL;
      |                                       ^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/GL/gl.h:2050,
                 from /home/computermouth/projects/raylib4/examples/others/external/include/GLFW/glfw3.h:202,
                 from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:70:
/usr/include/GL/glext.h:1288:21: error: ‘glGenVertexArrays’ redeclared as different kind of symbol
 1288 | GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
      |                     ^~~~~~~~~~~~~~~~~
In file included from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:62:
/home/computermouth/projects/raylib4/src/rlgl.h:967:36: note: previous definition of ‘glGenVertexArrays’ was here
  967 | static PFNGLGENVERTEXARRAYSOESPROC glGenVertexArrays = NULL;
      |                                    ^~~~~~~~~~~~~~~~~
In file included from /usr/include/GL/gl.h:2050,
                 from /home/computermouth/projects/raylib4/examples/others/external/include/GLFW/glfw3.h:202,
                 from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:70:
/usr/include/GL/glext.h:1369:21: error: ‘glDrawArraysInstanced’ redeclared as different kind of symbol
 1369 | GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
      |                     ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:62:
/home/computermouth/projects/raylib4/src/rlgl.h:972:40: note: previous definition of ‘glDrawArraysInstanced’ was here
  972 | static PFNGLDRAWARRAYSINSTANCEDEXTPROC glDrawArraysInstanced = NULL;
      |                                        ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/GL/gl.h:2050,
                 from /home/computermouth/projects/raylib4/examples/others/external/include/GLFW/glfw3.h:202,
                 from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:70:
/usr/include/GL/glext.h:1370:21: error: ‘glDrawElementsInstanced’ redeclared as different kind of symbol
 1370 | GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:62:
/home/computermouth/projects/raylib4/src/rlgl.h:973:42: note: previous definition of ‘glDrawElementsInstanced’ was here
  973 | static PFNGLDRAWELEMENTSINSTANCEDEXTPROC glDrawElementsInstanced = NULL;
      |                                          ^~~~~~~~~~~~~~~~~~~~~~~
[ 35%] Built target textures_image_drawing
In file included from /usr/include/GL/gl.h:2050,
                 from /home/computermouth/projects/raylib4/examples/others/external/include/GLFW/glfw3.h:202,
                 from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:70:
/usr/include/GL/glext.h:1591:21: error: ‘glVertexAttribDivisor’ redeclared as different kind of symbol
 1591 | GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
      |                     ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/computermouth/projects/raylib4/examples/others/rlgl_standalone.c:62:
/home/computermouth/projects/raylib4/src/rlgl.h:974:40: note: previous definition of ‘glVertexAttribDivisor’ was here
  974 | static PFNGLVERTEXATTRIBDIVISOREXTPROC glVertexAttribDivisor = NULL;
      |                                        ^~~~~~~~~~~~~~~~~~~~~
[ 35%] Linking C executable core_3d_picking
[ 36%] Linking C executable textures_logo_raylib
[ 36%] Linking C executable models_mesh_generation
Scanning dependencies of target core_scissor_test
Scanning dependencies of target models_orthographic_projection
[ 36%] Built target core_input_mouse
[ 36%] Built target core_2d_camera_platformer
[ 36%] Built target core_basic_window
[ 37%] Building C object examples/CMakeFiles/core_scissor_test.dir/core/core_scissor_test.c.o
[ 37%] Building C object examples/CMakeFiles/models_orthographic_projection.dir/models/models_orthographic_projection.c.o
[ 37%] Linking C executable shaders_basic_lighting
Scanning dependencies of target audio_raw_stream
make[2]: *** [examples/CMakeFiles/rlgl_standalone.dir/build.make:82: examples/CMakeFiles/rlgl_standalone.dir/others/rlgl_standalone.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1319: examples/CMakeFiles/rlgl_standalone.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Scanning dependencies of target audio_sound_loading
[ 37%] Built target core_3d_picking
[ 37%] Building C object examples/CMakeFiles/audio_sound_loading.dir/audio/audio_sound_loading.c.o
Scanning dependencies of target models_waving_cubes
[ 37%] Built target models_mesh_generation
[ 37%] Linking C executable core_scissor_test
[ 37%] Building C object examples/CMakeFiles/audio_raw_stream.dir/audio/audio_raw_stream.c.o
[ 38%] Building C object examples/CMakeFiles/models_waving_cubes.dir/models/models_waving_cubes.c.o
[ 39%] Linking C executable models_orthographic_projection
[ 40%] Linking C executable audio_sound_loading
[ 40%] Built target textures_logo_raylib
[ 40%] Built target shaders_basic_lighting
[ 40%] Built target core_scissor_test
[ 41%] Linking C executable audio_raw_stream
[ 41%] Linking C executable models_waving_cubes
[ 41%] Built target models_orthographic_projection
[ 41%] Built target audio_sound_loading
[ 41%] Built target models_waving_cubes
[ 41%] Built target audio_raw_stream
make: *** [Makefile:182: all] Error 2
computermouth commented 2 years ago

Actually, now that I'm looking at it, I see that it's just the examples failing to compile thus far

computermouth commented 2 years ago

I expect something like

elseif (${PLATFORM} MATCHES "DRM")
    list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)

May be required in examples/CMakeLists.txt along with the android and web example filters.

computermouth commented 2 years ago

Confirmed, solved with the following:

elseif (${PLATFORM} STREQUAL "DRM")
    list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
    list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/raylib_opengl_interop.c)

I'd make a PR, but I have a few questions.

  1. Maybe there's a better place to do this, based on GRAPHICS instead of PLATFORM, because the DRM and Android seem to have some overlap.
  2. I had to use STREQUAL, MATCHES did not return true there for me.
raysan5 commented 2 years ago

@computermouth For me the proposed solution is ok, I don't maintain the CMake build system.

Also note that there could be some issues with PLATFORM_DRM on Bullseye: https://github.com/raysan5/raylib/issues/2439

computermouth commented 2 years ago

Oh, dang, ok good to know. Honestly, I'd rather not use cmake anyway. Didn't realize that just building for DRM with just the makefile was an option. Lovely!

I'll still make this PR in a bit, once I've done some more testing.

chriscamacho commented 2 years ago

an automatically generated script 1,000's lines long - what could possibly go wrong, never understand why people have such hate for simple makefiles after all said and done they often just work