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

Add SDL log verbosity conf. #2913

Merged
merged 4 commits into from
Jul 28, 2023
Merged

Add SDL log verbosity conf. #2913

merged 4 commits into from
Jul 28, 2023

Conversation

toots
Copy link
Member

@toots toots commented Feb 20, 2023

This PR adds SDL log verbosity conf keys. However, they are not called early enough and I still see annoying logs when loading SDL stuff.

@smimram
Copy link
Member

smimram commented Jul 28, 2023

Trying to get rid of

INFO: Loading Sdl_image, Target = linux
INFO: Loading Sdl_ttf, Target = linux

Note for later, the first print is there:

#0  __GI___libc_write (fd=2, buf=0x7fffffffd4b0, nbytes=40) at ../sysdeps/unix/sysv/linux/write.c:26
#1  0x00007ffff3c9dbb5 in _IO_new_file_write (f=0x7ffff3df26a0 <_IO_2_1_stderr_>, data=0x7fffffffd4b0, n=40) at ./libio/fileops.c:1180
#2  0x00007ffff3c9cf70 in new_do_write (fp=fp@entry=0x7ffff3df26a0 <_IO_2_1_stderr_>, data=data@entry=0x7fffffffd4b0 "INFO: Loading Sdl_image, Target = linux\np", to_do=to_do@entry=40) at ./libio/libioP.h:946
#3  0x00007ffff3c9e2a1 in _IO_new_file_xsputn (n=40, data=<optimized out>, f=0x7ffff3df26a0 <_IO_2_1_stderr_>) at ./libio/fileops.c:1254
#4  _IO_new_file_xsputn (f=0x7ffff3df26a0 <_IO_2_1_stderr_>, data=<optimized out>, n=40) at ./libio/fileops.c:1196
#5  0x00007ffff3c71409 in __printf_buffer_flush_to_file (buf=buf@entry=0x7fffffffd480) at ../libio/libioP.h:946
#6  0x00007ffff3c714c0 in __printf_buffer_to_file_done (buf=buf@entry=0x7fffffffd480) at ./stdio-common/printf_buffer_to_file.c:120
#7  0x00007ffff3c7ac0d in __vfprintf_internal (s=0x7ffff3df26a0 <_IO_2_1_stderr_>, format=0x7ffff7398653 "%s: %s\n", ap=ap@entry=0x7fffffffd580, mode_flags=2) at ./stdio-common/vfprintf-internal.c:1475
#8  0x00007ffff3d34a1f in ___fprintf_chk (fp=<optimized out>, flag=<optimized out>, format=<optimized out>) at ./debug/fprintf_chk.c:33
#9  0x00007ffff72583bb in  () at /lib/x86_64-linux-gnu/libSDL2-2.0.so.0
#10 0x00007ffff7276af4 in SDL_Log () at /lib/x86_64-linux-gnu/libSDL2-2.0.so.0
#11 0x00007ffff721df7a in  () at /lib/x86_64-linux-gnu/libffi.so.8
#12 0x00007ffff721d40e in  () at /lib/x86_64-linux-gnu/libffi.so.8
#13 0x00007ffff721db0d in ffi_call () at /lib/x86_64-linux-gnu/libffi.so.8
#14 0x0000555556061681 in ctypes_call (fnname=<optimized out>, function=<optimized out>, callspec_=<optimized out>, argwriter=<optimized out>, rvreader=<optimized out>)
    at /home/smimram/.opam/5.0.0/.opam-switch/build/ctypes.0.20.2/src/ctypes-foreign/ffi_call_stubs.c:404
#15 0x00005555560d971b in <signal handler called> ()
#16 0x0000555555b2d180 in camlCtypes_ffi__fun_1348 () at src/ctypes-foreign/ctypes_ffi.ml:111
#17 0x0000555555acef6f in camlTsdl__fun_10326 () at src/tsdl.ml:299
#18 0x0000555555ac4886 in camlTsdl_image__entry () at src/tsdl_image.ml:45
#19 0x0000555555a4e71b in caml_program ()
#20 0x00005555560d97d4 in <signal handler called> ()
#21 0x00005555560d918f in caml_startup_common (pooling=<optimized out>, argv=0x7fffffffdda8) at runtime/startup_nat.c:129
#22 caml_startup_common (argv=0x7fffffffdda8, pooling=<optimized out>) at runtime/startup_nat.c:85
#23 0x00005555560d920b in caml_startup_exn (argv=<optimized out>) at runtime/startup_nat.c:136
#24 caml_startup (argv=<optimized out>) at runtime/startup_nat.c:141
#25 caml_main (argv=<optimized out>) at runtime/startup_nat.c:148
#26 0x0000555555a4be5c in main (argc=<optimized out>, argv=<optimized out>) at runtime/main.c:37

where

#17 0x0000555555acef6f in camlTsdl__fun_10326 () at src/tsdl.ml:299

is

let log fmt =
  kpp (fun s -> ignore (log "%s" s)) fmt

The culprit is actually tsdl-image: https://github.com/sanette/tsdl-image/blob/master/src/tsdl_image.ml#L45

@smimram
Copy link
Member

smimram commented Jul 28, 2023

Reported here: sanette/tsdl-image#8

This is linked before sdl-image and sdl-ttf and thus manages to silence
their startup message.
Copy link
Member Author

@toots toots left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

giphy (1)

src/core/tools/sdl_utils.ml Outdated Show resolved Hide resolved
@toots toots enabled auto-merge July 28, 2023 15:51
@toots toots added this pull request to the merge queue Jul 28, 2023
Merged via the queue into main with commit 6ba5126 Jul 28, 2023
23 checks passed
@toots toots deleted the sdl-logs-verbosity branch July 28, 2023 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants