Skip to content

PortAudio: Disable sndio in PortAudio to avoid missing -lsndio errors #83

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

Merged
merged 1 commit into from
Jun 9, 2025

Conversation

shengwen-tw
Copy link
Collaborator

@shengwen-tw shengwen-tw commented Jun 8, 2025

Overview

Fixes a compilation error introduced in #76, where the make all target fails during the build of the PortAudio library on GNU/Linux systems.

The failure was caused by PortAudio's configure script automatically enabling the sndio backend when libsndio-dev headers are present, which leads to linker errors due to missing -lsndio.

To avoid this, we now explicitly pass --without-sndio to PortAudio’s configure script. This ensures that sndio support is disabled regardless of system headers, eliminating the need for -lsndio and fixing the build.

Environment

  • Linux kernel: 6.2.6-76060206-generic
  • Distribution: Ubuntu 22.04.5 LTS (Jammy Jellyfish)

Error Log

shengwen@pop-os:~/buildfarm/semu$ make all
  LD	semu
/usr/bin/ld: portaudio/lib/.libs/libportaudio.a(pa_sndio.o): in function `BlockingGetStreamWriteAvailable':
/home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:516: undefined reference to `sio_pollfd'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:524: undefined reference to `sio_revents'
/usr/bin/ld: portaudio/lib/.libs/libportaudio.a(pa_sndio.o): in function `BlockingGetStreamReadAvailable':
/home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:495: undefined reference to `sio_pollfd'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:503: undefined reference to `sio_revents'
/usr/bin/ld: portaudio/lib/.libs/libportaudio.a(pa_sndio.o): in function `BlockingWriteStream':
/home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:480: undefined reference to `sio_write'
/usr/bin/ld: portaudio/lib/.libs/libportaudio.a(pa_sndio.o): in function `BlockingReadStream':
/home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:440: undefined reference to `sio_read'
/usr/bin/ld: portaudio/lib/.libs/libportaudio.a(pa_sndio.o): in function `sndioThread':
/home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:230: undefined reference to `sio_write'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:187: undefined reference to `sio_read'
/usr/bin/ld: portaudio/lib/.libs/libportaudio.a(pa_sndio.o): in function `OpenStream':
/home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:265: undefined reference to `sio_initpar'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:325: undefined reference to `sio_open'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:328: undefined reference to `sio_setpar'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:333: undefined reference to `sio_getpar'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:340: undefined reference to `sio_close'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:352: undefined reference to `sio_close'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:404: undefined reference to `sio_close'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:382: undefined reference to `sio_close'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:330: undefined reference to `sio_close'
/usr/bin/ld: portaudio/lib/.libs/libportaudio.a(pa_sndio.o):/home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:358: more undefined references to `sio_close' follow
/usr/bin/ld: portaudio/lib/.libs/libportaudio.a(pa_sndio.o): in function `StopStream':
/home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:612: undefined reference to `sio_stop'
/usr/bin/ld: portaudio/lib/.libs/libportaudio.a(pa_sndio.o): in function `CloseStream':
/home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:630: undefined reference to `sio_close'
/usr/bin/ld: portaudio/lib/.libs/libportaudio.a(pa_sndio.o): in function `StartStream':
/home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:563: undefined reference to `sio_start'
/usr/bin/ld: /home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:574: undefined reference to `sio_write'
/usr/bin/ld: portaudio/lib/.libs/libportaudio.a(pa_sndio.o): in function `StopStream':
/home/shengwen/buildfarm/semu/portaudio/src/hostapi/sndio/pa_sndio.c:612: undefined reference to `sio_stop'
collect2: error: ld returned 1 exit status
make: *** [Makefile:154: semu] Error 1

@shengwen-tw
Copy link
Collaborator Author

@Cuda-Chen:
Hi, could you help me check the package dependencies here?
Thanks.

@Cuda-Chen
Copy link
Collaborator

@shengwen-tw ,

I can help to check the package dependencies.
While checking, here is the environment of mine for your reference:

  • Distribution: Ubuntu 22.04.5 LTS (Jammy Jellyfish)
  • Linux Kernel: 5.15.0-141-generic (using uname -r)

@Cuda-Chen
Copy link
Collaborator

Cuda-Chen commented Jun 8, 2025

Hi @shengwen-tw ,

It seems that PortAudio somehow uses sndio as an audio multiplexer on your environment.
You may visit the homepage of sndio for more information.

So you may choose one of the following option:

  1. Just install libsndio-dev.
  2. Force PortAudio to use PulseAudio/PipeWire as there are more common on many Linux distributions, including Ubuntu.

Fixes a compilation error introduced in sysprog21#76, where the `make all` target fails
during the build of the PortAudio library on GNU/Linux systems.

The failure was caused by PortAudio's configure script automatically enabling
the sndio backend when `libsndio-dev` headers are present, which leads to
linker errors due to missing `-lsndio`.

To avoid this, we now explicitly pass `--without-sndio` to PortAudio’s
configure script. This ensures that sndio support is disabled regardless of
system headers, eliminating the need for `-lsndio` and fixing the build.
@shengwen-tw shengwen-tw changed the title PortAudio: Add missing -lsndio flag to fix build failure on Linux PortAudio: Disable sndio in PortAudio to avoid missing -lsndio errors Jun 9, 2025
@shengwen-tw
Copy link
Collaborator Author

@Cuda-Chen
Hi, I’ve updated the pull request to explicitly disable sndio support by passing the --without-sndio flag.
Could you help verify whether virtio-snd still functions correctly with this change?
Thanks.

@Cuda-Chen
Copy link
Collaborator

Cuda-Chen commented Jun 9, 2025

Hi @shengwen-tw ,

I have verified that the change functions correctly on my environment.

@jserv jserv merged commit 81e61bc into sysprog21:master Jun 9, 2025
3 checks passed
@jserv
Copy link
Collaborator

jserv commented Jun 9, 2025

Thank @shengwen-tw for contributing!

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.

3 participants