printf not working

Hi,

I managed to build Audacity from its source code in Ubuntu; and I added a few lines of printf in AudacityApp.cpp and rebuilt it.
However, I started it from a command line terminal. I don’t see my printf message. Where does it go?

Thanks in advance.

To see debug messages it must be a Debug build (not a Release build).

In wxWidgets code you may need to use wxLogDebug rather than just printf.

Steve,

thanks for your reply. Does that FAQ page contain info on how to enable debug build?
In fact I want to debug what causes the crash (https://forum.audacityteam.org/t/audacity-crashes-when-software-playthrough-is-enabled/62054/1).
I just want to know what happens in the code chain when “Record” button is clicked when “Software Playthrough” is enabled.

Best Regards

The build instructions in the source code should.
Which version of Audacity are you building?

Note that the audio stream runs in a separate thread, so you can’t just print to debug from there.

I managed to build latest version (3.0.2) with wxwidgets in Raspberry Pi.

Congratulations.

Was that with Raspbian OS?
Did you have to do anything other than following the build instructions?

Yes, I used Pi’s default OS, which is Raspberry OS; and I just followed Audacity’s build instruction in Linux folder and didn’t do any extra thing.
The only thing not so common is the audio device, and its maker only makes it work with Raspberry Pi. Other than installing Audacity, I need to install its driver.
The device has 8 channels, 6 of them for 6 real MEMS microphones, the other 2 are for loopback.

Note that the audio stream runs in a separate thread, so you can’t just print to debug from there.

Can you please point me to the cpp file that handles audio stream?

Start with: src/AudioIO.cpp

I tried to debug-build Audacity:

  • cmake -DCMAKE_BUILD_TYPE=Debug …


  • cmake --build .

However, assertion failure occurs when Icd bin/Debug/” folder and type “./Audacity

ASSERT INFO:
/home/pi/Desktop/audacity-minsrc-3.0.2/src/AudioIO.cpp(964): assert “false” failed in AudioIO().

BACKTRACE:
[1] AudioIO::AudioIO() /home/pi/Desktop/audacity-minsrc-3.0.2/src/AudioIO.cpp:964
[2] AudioIO::Init() /home/pi/Desktop/audacity-minsrc-3.0.2/src/AudioIO.cpp:913
[3] AudacityApp::InitPart2() /home/pi/Desktop/audacity-minsrc-3.0.2/src/AudacityApp.cpp:1442
[4] AudacityApp::OnInit() /home/pi/Desktop/audacity-minsrc-3.0.2/src/AudacityApp.cpp:1300
[5] wxAppConsoleBase::CallOnInit() /usr/local/include/wx-3.1/wx/app.h:93
[6] wxEntry(int&, wchar_t**)
[7] main /home/pi/Desktop/audacity-minsrc-3.0.2/src/AudacityApp.cpp:723
[8] __libc_start_main

my gcc version is gcc (Raspbian 8.3.0-6+rpi1) 8.3.0

The following is the print-2-screen message

/home/pi/Desktop/audacity-minsrc-3.0.2/src/AudioIO.cpp(964): assert “false” failed in AudioIO().
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_a52.c:823:(_snd_pcm_a52_open) a52 is only for playback
Segmentation fault

Shall I report it in the “Compiling Audacity” forum?

I assume that’s a typo and you meant “./audacity”.

Was that with your added printf lines or with the unmodified code?
Which version of Audacity are you currently building?

As far as I’m aware, we don’t officially support Raspberry Pi. Do you not have a PC to do this with?

I only added one printf at somewhere in AudacityApp.cpp.

The error is thrown in the AudioIO.cpp by the following lines:

if (!std::atomic{}.is_lock_free()) {
// If this check fails, then the atomic members in AudioIO.h
// might be changed to atomic to be more efficient with some
// loss of precision. That could be conditionally compiled depending
// on the platform.
wxASSERT(false);
}

As I mentioned before, I need a device, whose maker only makes it work with Raspberry Pi.

So this is what’s failing: std::atomic<T>::is_lock_free - cppreference.com

Thanks, yes I understand.

Are you able to get Audacity to run correctly if you remove the 8 channel device and use a “normal” audio device?

Generally Audacity works well with the 8-channel device. We have been using it for months; and we like its UI and many features.
The problem is that it crashes when I enable “Software Playthrough”. I have posted the issue in some other thread in this forum; but didn’t get any attention.

I thought maybe I should try to debug. So I built a debug version, which even cannot start. It has nothing to do with my audio device.

What does work?
Did you get a release build to work?

Also, note that the build system has changed for the yet to be released Audacity 3.0.3. This change may help with your difficulty; it may make things worse. For help with this system, go to #linux - COMPILING AUDACITY on Audacity dev on discord: https://discord.gg/m4J4JNNK

What does work?

The release build 3.0.2, which I built myself recently.

Did you get a release build to work?

In fact, in Raspberry Pi, there is a default release version of Audacity if you do “sudo apt install audacity”. It’s version is 2.2.x. My project has been using this version for months, very stable.
However, both version has the problem of crash when “Software Playthrough” is enabled.

Did you just follow the build instructions with totally unmodified code?

For help with this system, go to #linux - COMPILING AUDACITY on Audacity dev on discord: > Discord

Can I just report my issue in the channel?