raysan5/rfxgen

Segmentation fault when trying to export wave

jdeokkim opened this issue · 7 comments

I tried doing the same thing with the GUI version of rfxgen, but it was not working either.

Compilation line (GCC 9.3.0):

gcc -o rfxgen-c rfxgen.c external/tinyfiledialogs.c -g -Iexternal -no-pie -D_DEFAULT_SOURCE
-lraylib -lGL -lm -lpthread -ldl -lrt -lX11

Terminal output:

guest-cny2jf@h30646:~/다운로드$ uname -a
Linux h30646 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

guest-cny2jf@h30646:~/다운로드$ ls
input_ex.rfx rfxgen-c

guest-cny2jf@h30646:~/다운로드$ ./rfxgen-c -i input_ex.rfx -o result.wav

Input file:       input_ex.rfx
Output file:      result.wav
Output format:    44100 Hz, 16 bits, Mono

Segmentation fault (core dumped)

guest-cny2jf@h30646:~/다운로드$ gdb rfxgen-c

...

(gdb) run -i input_ex.rfx -o result.wav
Starting program: /tmp/guest-cny2jf/다운로드/rfxgen-c -i input_ex.rfx -o result.wav
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Input file:       input_ex.rfx
Output file:      result.wav
Output format:    44100 Hz, 16 bits, Mono


Program received signal SIGSEGV, Segmentation fault.
__memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:308
308     ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
(gdb) bt
#0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:308
#1  0x0000000000499448 in drwav.on_write_memory ()
#2  0x00000000004956ed in drwav_init_write.internal ()
#3  0x000000000049cade in drwav_init_memory_write.internal ()
#4  0x00000000004c2bd4 in drwav_init_memory_write ()
#5  0x00000000004c5cf9 in SaveWAV ()
#6  0x00000000004cb998 in ExportWave ()
#7  0x0000000000416630 in ProcessCommandLine (argc=5, argv=0x7fffffffde88) at rfxgen.c:1047
#8  0x0000000000415865 in main (argc=5, argv=0x7fffffffde88) at rfxgen.c:246
(gdb) quit
A debugging session is active.

        Inferior 1 [process 19361] will be killed.

Quit anyway? (y or n) y

guest-cny2jf@h30646:~/다운로드$ 

@epsimatt thanks for reporting! are you using latest raylib from GitHub main branch?

@raysan5 Yes, I am using the latest version of raylib and raygui.

i have no idea if this could be useful, below is what i got during the compilation

In file included from src/rfxgen.c:99:
src/gui_file_dialogs.h: In function ‘GuiFileDialog’:

src/gui_file_dialogs.h:141:42: warning: implicit declaration of function ‘tinyfd_openFileDialog’ [-Wimplicit-function-declarat
ion]
  141 |         case DIALOG_OPEN: tempFileName = tinyfd_openFileDialog(title, fileName, filterCount, filterSplit, message, 0);
 break;
      |                                          ^~~~~~~~~~~~~~~~~~~~~

src/gui_file_dialogs.h:141:40: warning: assignment to ‘const char *’ from ‘int’ makes pointer from integer without a cast [-Wi
nt-conversion]
  141 |         case DIALOG_OPEN: tempFileName = tinyfd_openFileDialog(title, fileName, filterCount, filterSplit, message, 0);
 break;
      |                                        ^

src/gui_file_dialogs.h:142:42: warning: implicit declaration of function ‘tinyfd_saveFileDialog’ [-Wimplicit-function-declarat
ion]
  142 |         case DIALOG_SAVE: tempFileName = tinyfd_saveFileDialog(title, fileName, filterCount, filterSplit, message); br
eak;
      |                                          ^~~~~~~~~~~~~~~~~~~~~

src/gui_file_dialogs.h:142:40: warning: assignment to ‘const char *’ from ‘int’ makes pointer from integer without a cast [-Wi
nt-conversion]
  142 |         case DIALOG_SAVE: tempFileName = tinyfd_saveFileDialog(title, fileName, filterCount, filterSplit, message); br
eak;
      |                                        ^

src/gui_file_dialogs.h:143:39: warning: implicit declaration of function ‘tinyfd_messageBox’ [-Wimplicit-function-declaration]
  143 |         case DIALOG_MESSAGE: result = tinyfd_messageBox(title, message, "ok", "info", 0); break;
      |                                       ^~~~~~~~~~~~~~~~~

src/gui_file_dialogs.h:144:47: warning: implicit declaration of function ‘tinyfd_inputBox’ [-Wimplicit-function-declaration]
  144 |         case DIALOG_TEXTINPUT: tempFileName = tinyfd_inputBox(title, message, ""); break;
      |                                               ^~~~~~~~~~~~~~~

src/gui_file_dialogs.h:144:45: warning: assignment to ‘const char *’ from ‘int’ makes pointer from integer without a cast [-Wi
nt-conversion]
  144 |         case DIALOG_TEXTINPUT: tempFileName = tinyfd_inputBox(title, message, ""); break;
      |                                             ^

@epsimatt You should add tinyfiledialogs library to compilation:

gcc -o rfxgen rfxgen.c external/tinyfiledialogs.c -s -Iexternal -no-pie -D_DEFAULT_SOURCE -lraylib -lGL -lm -lpthread -ldl -lrt -lX11

@raysan5 Actually, I have tinyfiledialogs library in my compilation line, but the compiler keeps reporting warnings every time I compile rfxgen. Very strange...

gcc src/rfxgen.c src/external/tinyfiledialogs.c -o bin/rfxgen -Isrc/external -D_DEFAULT_SOURCE -no-pie -s -lrayli
b -lGL -lm -lpthread -ldl -lrt -lX11

@raysan5 I tried using the latest version of rfxgen on the same environment and this issue seems to be resolved now. Thank you very much!

@jdeokkim oh! thanks for reporting! 👍😄