Skip to content

PortAudio: Add missing -lsndio flag to fix build failure on Linux #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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shengwen-tw
Copy link
Collaborator

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 a missing -lsndio linker flag. Adding this flag resolves the issue and allows the build to complete successfully.

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 shengwen-tw requested review from Cuda-Chen and jserv June 8, 2025 11:55
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 a missing `-lsndio` linker flag. Adding this flag
resolves the issue and allows the build to complete successfully.
@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.

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