I’ve installed portaudio on Debian:
sudo apt install portaudio19-dev
Now I’m trying to run a test program to make sure it works:
gcc pa_devs.c libportaudio.a -lrt -lm -lasound -o pa_devs
But I get this error:
/usr/bin/ld: cannot find libportaudio.a: No such file or directory
Here’s where Debian installed the portaudio files:
/usr/include/portaudiocpp
/usr/include/portaudiocpp/PortAudioCpp.hxx
/usr/include/portaudio.h
/usr/lib/x86_64-linux-gnu/libportaudiocpp.a
/usr/lib/x86_64-linux-gnu/pkgconfig/portaudio-2.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/portaudiocpp.pc
/usr/lib/x86_64-linux-gnu/libportaudiocpp.so
/usr/lib/x86_64-linux-gnu/libportaudio.a
/usr/lib/x86_64-linux-gnu/libportaudio.so.2.0.0
/usr/lib/x86_64-linux-gnu/libportaudio.so
/usr/lib/x86_64-linux-gnu/libportaudiocpp.so.0
/usr/lib/x86_64-linux-gnu/libportaudiocpp.so.0.0.12
/usr/lib/x86_64-linux-gnu/libportaudio.so.2
/usr/share/doc/libportaudio2
/usr/share/doc/portaudio19-dev
/usr/share/doc/libportaudiocpp0
how can I tell gcc the correct path to the library ?
2
Answers
For those who are interested:
For other programs that require the jack library:
A possible alternative is to compile programs with the shared library (.so) instead of the static library (.a):
Hope it helps.
While @Duddy67’s answer works, I want to discuss an alternate approach. Generally, it is bad practice to use a system-wide installation of libraries for your projects as they create dependencies on the system configuration, require complex setup steps, and have the potential for versioning conflicts.
Instead, you should download the libraries directly to your project repository. Users in the future can then simply replicate your project environment by downloading the necessary dependencies, rather than your entire system environment.
Local Project Solution:
Now, to check that it is correctly installed, we can search for the file:
Your output should be something like below: