How to compile a debug build of libopenmpt from a release

Started by JustinWayland, December 03, 2023, 04:31:09

Previous topic - Next topic

JustinWayland

I'm trying to use libopenmpt in a project, but I am currently getting a baffling segfault.  I want to know what library function is failing me, but the version of libopenmpt I am using comes with no debug symbols.  How can I compile a version of libopenmpt with debug symbols so I can troubleshoot my application?

manx

Which OS?

Where did you get libopenmpt? Did you build it yourself? If so, how?

Which function call is giving you a crash?

JustinWayland

In order:

  • OS is MacOS 12.7.1
  • I installed it using homebrew. I tried to build a debug version using the autotools version of 0.7.3 on the homepage, but judging from the presence of -O2 in the output I failed.
  • The function that is crashing is openmpt_module_read_interleaved_float_stereo


manx

Quote from: JustinWayland on December 03, 2023, 20:02:48I installed it using homebrew. I tried to build a debug version using the autotools version of 0.7.3 on the homepage, but judging from the presence of -O2 in the output I failed.
./configure CFLAGS="-g -O0" CXXFLAGS="-g -O0" should do the trick. See https://stackoverflow.com/a/4680578.

Quote from: JustinWayland on December 03, 2023, 20:02:48The function that is crashing is openmpt_module_read_interleaved_float_stereo

Do you provide the correct count and is your interleaved_stereo buffer large enough? count has the be the number of audio frames per channel (i.e. is is the same for any of the read functions, regardless of interleaved or the channel count), and for the interleaved_float_stereo case, your buffer has to be large enough to hold 2*count float values. See https://lib.openmpt.org/doc/group__libopenmpt__c.html#ga036901606728ce00d9f104adca6a5c09.

You generally would not need a debug build of libopenmpt when you are just using it, unless you want to debug a problem in libopenpmt itself, which may not be the case here.