Hello,
I'm trying to build ProjectM on a Rpi3, thinking that it would be cool to be able to bolt it onto "volumio" (https://volumio.org/)
The code builds on the rpi (ableit with a bunch of warnings). I've built SDL 2.0.8 (more on that later) and verified that SDL works using some test code. I've verified that there's GLES working using some of the test code in the rpi.
Running projectMSDL results in:
root@volumio:~# projectMSDL
INFO: GL_VERSION: (null)
INFO: GL_SHADING_LANGUAGE_VERSION: (null)
INFO: GL_VENDOR: (null)
[projectM] config file: /usr/local/share/projectM/config.inp
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted
This clearly isn't optimal. :-)
Here's as much detail as I can think to provide, please let me know if more is needed, if there are other tests / code I can run, etc.
system environment:
root@volumio:~# uname -a
Linux volumio 4.14.69-v7+ #1141 SMP Mon Sep 10 15:26:29 BST 2018 armv7l GNU/Linux
root@volumio:~# more /etc/apt/sources.list
deb http://archive.volumio.org/raspbian/ jessie main contrib non-free rpi
deb-src http://archive.volumio.org/raspbian/ jessie main contrib non-free rpi
compiler version
root@volumio:~# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.9/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Raspbian 4.9.2-10+deb8u1' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.9.2 (Raspbian 4.9.2-10+deb8u1)
SDL version:
root@volumio:~# sdl2-config --version --cflags --libs
2.0.8
-I/usr/local/include/SDL2 -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -D_REENTRANT
-L/usr/local/lib -Wl,-rpath,/usr/local/lib -Wl,--enable-new-dtags -lSDL2
SDL was built with:
# SDL config
sdl_arm_config_flags="\
--disable-video-opengl --disable-video-x11 \
--disable-pulseaudio --disable-esd \
--disable-video-mir --disable-video-wayland"
projectMSDL in gdb:
root@volumio:~# !480
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/vc/lib/
root@volumio:~# gdb projectMSDL
GNU gdb (Raspbian 7.7.1+dfsg-5+rpi1) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from projectMSDL...done.
(gdb) catch throw bad_alloc
Catchpoint 1 (throw)
(gdb) run
Starting program: /usr/local/bin/projectMSDL
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0x7685e440 (LWP 13835)]
[New Thread 0x75eff440 (LWP 13836)]
[New Thread 0x756ff440 (LWP 13837)]
[New Thread 0x74eff440 (LWP 13838)]
[New Thread 0x74611440 (LWP 13839)]
INFO: GL_VERSION: (null)
INFO: GL_SHADING_LANGUAGE_VERSION: (null)
INFO: GL_VENDOR: (null)
[projectM] config file: /usr/local/share/projectM/config.inp
Catchpoint 1 (exception thrown), 0x76d5acac in __cxa_throw ()
from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
(gdb) set pagination off
(gdb) bt
#0 0x76d5acac in __cxa_throw () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#1 0x76d5b388 in operator new(unsigned int) () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#2 0x00038d50 in allocate (this=<optimized out>, __n=1996379485) at /usr/include/c++/4.9/ext/new_allocator.h:104
#3 allocate (__a=..., __n=1996379485) at /usr/include/c++/4.9/bits/alloc_traits.h:357
#4 _M_allocate (this=<optimized out>, __n=1996379485) at /usr/include/c++/4.9/bits/stl_vector.h:170
#5 _M_create_storage (__n=1996379485, this=<synthetic pointer>) at /usr/include/c++/4.9/bits/stl_vector.h:185
#6 _Vector_base (__a=..., __n=1996379485, this=<synthetic pointer>) at /usr/include/c++/4.9/bits/stl_vector.h:136
#7 vector (__a=..., __n=1996379485, this=<synthetic pointer>) at /usr/include/c++/4.9/bits/stl_vector.h:278
#8 ShaderEngine::checkCompileStatus (shader=shader@entry=0, shaderTitle="Vertex: v2f_c4f") at ShaderEngine.cpp:469
#9 0x000399f0 in ShaderEngine::CompileShaderProgram (VertexShaderCode=..., FragmentShaderCode="#version 300 es\nprecision mediump float;\nin vec4 fragment_color;\nout vec4 color;\nvoid main(){\n color = fragment_color;\n}\n", shaderTypeString="v2f_c4f") at ShaderEngine.cpp:1235
#10 0x00039c00 in ShaderEngine::ShaderEngine (this=0x13ac98) at ShaderEngine.cpp:399
#11 0x000383f4 in Renderer::Renderer (this=0x13abc0, width=512, height=512, gx=<optimized out>, gy=125, _beatDetect=0x137fc0, _presetURL="\\\236\022\000\004\236\022\000\324\234\022\000\000\000\000\000\270\342\r\000\230u\022\000\030\373\377~\320u\022\000\000\000\000\000#\000\000\000\030\000\000\000 \000\000\000\220\260\002\000\000\002\000\000\000\002\000\000\000\002\000\000h\371\377v\324\230\022\000\324\230\022\000\334v\022\000\324\230\022\000\334v\022\000\334v\022\000\f\237\022\000\244\236\022\000\334v\022\000\334v\022\000\374v\022\000\304\342\r\000\334v\022\000\064w\022\000\304\342\r\000\334v\022\000\064w\022\000\304\342\r\000\334v\022\000\244\236\022\000\f\237\022\000\n\000\000\000\000\000\000\000,S\022\000\244v\022\000\274v\022\000\000\000\000\000\000\000\000\000 u\022\000\260\233\022\000\310\232\022\000\016\000\000\000\204\373\377~"..., _titlefontURL="\004\236\022\000\324\234\022\000\000\000\000\000\270\342\r\000\230u\022\000\030\373\377~\320u\022\000\000\000\000\000#\000\000\000\030\000\000\000 \000\000\000\220\260\002\000\000\002\000\000\000\002\000\000\000\002\000\000h\371\377v\324\230\022\000\324\230\022\000\334v\022\000\324\230\022\000\334v\022\000\334v\022\000\f\237\022\000\244\236\022\000\334v\022\000\334v\022\000\374v\022\000\304\342\r\000\334v\022\000\064w\022\000\304\342\r\000\334v\022\000\064w\022\000\304\342\r\000\334v\022\000\244\236\022\000\f\237\022\000\n\000\000\000\000\000\000\000,S\022\000\244v\022\000\274v\022\000\000\000\000\000\000\000\000\000 u\022\000\260\233\022\000\310\232\022\000\016\000\000\000\204\373\377~\230u\022\000"..., _menufontURL="") at Renderer.cpp:25
#12 0x0002a874 in projectM::projectM_init (this=this@entry=0x127598, gx=220, gy=125, fps=35, texsize=512, width=512, height=512) at projectM.cpp:515
#13 0x0002b090 in projectM::readConfig (this=this@entry=0x127598, configFile="/usr/local/share/projectM/config.inp") at projectM.cpp:234
#14 0x0002b94c in projectM::projectM (this=0x127598, config_file="", flags=0) at projectM.cpp:131
#15 0x0001fbd8 in projectMSDL::projectMSDL (this=0x127598, config_file=..., flags=0) at pmSDL.cpp:229
#16 0x0001a590 in main (argc=<optimized out>, argv=<optimized out>) at projectM_SDL_main.cpp:121
(gdb)
I have tried running the rpi with the three different (as far as i know) possible video driver modes:
/boot/config.txt:
dtoverlay=vc4-fkms-v3d
dtoverlay=vc4-kms-v3d
and no dtoverlay in config.txt
The first two modes, SDL does not operate. The setting with no dtoverlay, SDL does operate.
Note that there is no difference in any of the projectMSDL output no matter the setting I use.
SDL is tested with code such as:
root@volumio:~# more hello_sdl2.cpp
// SDL2 Hello, World!
// This should display a white screen for 2 seconds
// compile with: clang++ main.cpp -o hello_sdl2 -lSDL2
// run with: ./hello_sdl2
#include <SDL2/SDL.h>
#include <stdio.h>
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
int main(int argc, char* args[]) {
SDL_Window* window = NULL;
SDL_Surface* screenSurface = NULL;
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
fprintf(stderr, "could not initialize sdl2: %s\n", SDL_GetError());
return 1;
}
window = SDL_CreateWindow(
"hello_sdl2",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
SCREEN_WIDTH, SCREEN_HEIGHT,
SDL_WINDOW_SHOWN
);
if (window == NULL) {
fprintf(stderr, "could not create window: %s\n", SDL_GetError());
return 1;
}
screenSurface = SDL_GetWindowSurface(window);
SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xFF, 0xFF
, 0xFF));
SDL_UpdateWindowSurface(window);
SDL_Delay(2000);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
glxgears reports:
root@volumio:~# glxgears -info
GL_RENDERER = Gallium 0.4 on llvmpipe (LLVM 3.9, 128 bits)
GL_VERSION = 3.0 Mesa 13.0.0
GL_VENDOR = VMware, Inc.
GL_EXTENSIONS = GL_ARB_multisample GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_copy_texture GL_EXT_polygon_offset GL_EXT_subtexture GL_EXT_texture_object GL_EXT_vertex_array GL_EXT_compiled_vertex_array GL_EXT_texture GL_EXT_texture3D GL_IBM_rasterpos_clip GL_ARB_point_parameters GL_EXT_draw_range_elements GL_EXT_packed_pixels GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_separate_specular_color GL_EXT_texture_edge_clamp GL_SGIS_generate_mipmap GL_SGIS_texture_border_clamp GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_ARB_framebuffer_sRGB GL_ARB_multitexture GL_EXT_framebuffer_sRGB GL_IBM_multimode_draw_arrays GL_IBM_texture_mirrored_repeat GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_transpose_matrix GL_EXT_blend_func_separate GL_EXT_fog_coord GL_EXT_multi_draw_arrays GL_EXT_secondary_color GL_EXT_texture_env_add GL_EXT_texture_lod_bias GL_INGR_blend_func_separate GL_NV_blend_square GL_NV_light_max_exponent GL_NV_texgen_reflection GL_NV_texture_env_combine4 GL_S3_s3tc GL_SUN_multi_draw_arrays GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_EXT_framebuffer_object GL_EXT_texture_compression_s3tc GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_MESA_window_pos GL_NV_packed_depth_stencil GL_NV_texture_rectangle GL_ARB_depth_texture GL_ARB_occlusion_query GL_ARB_shadow GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_window_pos GL_ATI_fragment_shader GL_EXT_stencil_two_side GL_EXT_texture_cube_map GL_NV_depth_clamp GL_NV_fog_distance GL_APPLE_packed_pixels GL_APPLE_vertex_array_object GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_shader_objects GL_ARB_vertex_program GL_ARB_vertex_shader GL_ATI_draw_buffers GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_MESA_pack_invert GL_MESA_ycbcr_texture GL_NV_primitive_restart GL_ARB_depth_clamp GL_ARB_fragment_program_shadow GL_ARB_half_float_pixel GL_ARB_occlusion_query2 GL_ARB_point_sprite GL_ARB_shading_language_100 GL_ARB_sync GL_ARB_texture_non_power_of_two GL_ARB_vertex_buffer_object GL_ATI_blend_equation_separate GL_EXT_blend_equation_separate GL_OES_read_format GL_ARB_color_buffer_float GL_ARB_pixel_buffer_object GL_ARB_texture_compression_rgtc GL_ARB_texture_float GL_ARB_texture_rectangle GL_ATI_texture_compression_3dc GL_EXT_packed_float GL_EXT_pixel_buffer_object GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_rgtc GL_EXT_texture_mirror_clamp GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_shared_exponent GL_ARB_framebuffer_object GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_packed_depth_stencil GL_ARB_vertex_array_object GL_ATI_separate_stencil GL_ATI_texture_mirror_once GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_gpu_program_parameters GL_EXT_texture_array GL_EXT_texture_compression_latc GL_EXT_texture_integer GL_EXT_texture_sRGB_decode GL_EXT_timer_query GL_OES_EGL_image GL_ARB_copy_buffer GL_ARB_depth_buffer_float GL_ARB_draw_instanced GL_ARB_half_float_vertex GL_ARB_instanced_arrays GL_ARB_map_buffer_range GL_ARB_texture_rg GL_ARB_texture_swizzle GL_ARB_vertex_array_bgra GL_EXT_texture_swizzle GL_EXT_vertex_array_bgra GL_NV_conditional_render GL_AMD_conservative_depth GL_AMD_draw_buffers_blend GL_AMD_seamless_cubemap_per_texture GL_AMD_shader_stencil_export GL_ARB_ES2_compatibility GL_ARB_blend_func_extended GL_ARB_debug_output GL_ARB_draw_buffers_blend GL_ARB_draw_elements_base_vertex GL_ARB_explicit_attrib_location GL_ARB_fragment_coord_conventions GL_ARB_provoking_vertex GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_shader_stencil_export GL_ARB_shader_texture_lod GL_ARB_texture_cube_map_array GL_ARB_texture_gather GL_ARB_texture_multisample GL_ARB_texture_rgb10_a2ui GL_ARB_uniform_buffer_object GL_ARB_vertex_type_2_10_10_10_rev GL_EXT_provoking_vertex GL_EXT_texture_snorm GL_MESA_texture_signed_rgba GL_ARB_get_program_binary GL_ARB_robustness GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_ARB_base_instance GL_ARB_compressed_texture_pixel_storage GL_ARB_conservative_depth GL_ARB_internalformat_query GL_ARB_map_buffer_alignment GL_ARB_shading_language_420pack GL_ARB_shading_language_packing GL_ARB_texture_storage GL_ARB_transform_feedback_instanced GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_transform_feedback GL_AMD_shader_trinary_minmax GL_ARB_ES3_compatibility GL_ARB_arrays_of_arrays GL_ARB_clear_buffer_object GL_ARB_copy_image GL_ARB_explicit_uniform_location GL_ARB_invalidate_subdata GL_ARB_program_interface_query GL_ARB_stencil_texturing GL_ARB_texture_query_levels GL_ARB_texture_storage_multisample GL_ARB_texture_view GL_ARB_vertex_attrib_binding GL_KHR_debug GL_ARB_buffer_storage GL_ARB_internalformat_query2 GL_ARB_multi_bind GL_ARB_seamless_cubemap_per_texture GL_ARB_texture_mirror_clamp_to_edge GL_ARB_texture_stencil8 GL_ARB_vertex_type_10f_11f_11f_rev GL_EXT_shader_integer_mix GL_ARB_clip_control GL_ARB_conditional_render_inverted GL_ARB_cull_distance GL_ARB_get_texture_sub_image GL_EXT_polygon_offset_clamp GL_KHR_context_flush_control GL_MESA_shader_integer_functions
VisualID 420, 0x1a4
good first issue