Missing pa_ringbuffer.h and pa_util.h are preventing the paex_ocean_shore.c and paex_record_file.c examples from compiling.
Do you have a patch?
(In reply to Hans Petter Selasky from comment #1) The following modifications may be necessary to handle paex_* files here. * Use CMake instead of GNU configure. * Build with PA_BUILD_EXAMPLES turned on. * Add additional files to be installed to pkg-plist. such as. Some files/patch-* are applied to GNU configure files, so the modification will be relatively extensive.
Created attachment 237454 [details] Does this patch work for you? cd /usr/local/share/examples/portaudio clang -L/usr/local/lib -lm -lpthread -lportaudio -I/usr/local/include pa_unix*.c pa_allocation.c pa_ringbuffer.c pa_debugprint.c pa_front.c paex_ocean_shore.c --HPS
(In reply to Hans Petter Selasky from comment #3) Why is example source code and not pre-built binaries? 🤣 I think the reason you need so many copies of files like that patch is because there are limitations on the functions that can be used in libportaudio. The part that seems to do it is in PA_LDFLAGS of ${WRKSRC}/Makefile.in. The first thing that is no good is that PaUtil is not included in the -export-symbols-regex there. Probably :) Note that switching to CMake is not a solution, since it is no longer possible to create libportaudiocpp.
(In reply to Hans Petter Selasky from comment #3) Add a few more. > clang -L/usr/local/lib -lm -lpthread -lportaudio -I/usr/local/include pa_unix*.c pa_allocation.c pa_ringbuffer.c pa_debugprint.c pa_front.c paex_ocean_shore.c It seems a little better to link with libportaudio.a instead of -lportaudio. cc -I/usr/local/include -I /tmp/directory_for_pa_ringbuffer.h_and_pa_util.h -lm -pthread /usr/local/lib/libportaudio.a /usr/local/share/examples/portaudio/paex_ocean_shore.c However, libportaudio.a does not contain anything that can resolve the PaUtil_*RingBuffer* symbol. The reason for this is that libportaudio links COMMON_OBJS and OTHER_OBJS in ${WRKSRC}/Makefile.in, but OTHER_OBJS is a variable provided from ${WRKSRC}/configure.in. In configure.in, OTHER_OBJS is added by the add_objects function, and pa_ringbuffer.o is also added here. In order for ringbuffer to be included on FreeBSD ports, JACK option must be set.
Examples are supposed to be source code and not binaries? Is the solution I propose OK? --HPS
(In reply to Hans Petter Selasky from comment #6) > Examples are supposed to be source code and not binaries? It was just strange because the source files were installed without the Makefile, options to pass to the compiler, or any other hints to build... :) attachment 237454 [details] would have to be asked of the person who actually builds the sample. libportaudio made with the default option will need to be built and linked with pa_ringbuffer.c at the same time, and libportaudio made with the JACK option turned on will not need pa_ringbuffer.c... To only install a few additional header files, it would be better to apply the patch to PA_LDFLAGS and OTHER_OBJS...
May I ask why you need the example utilities in binary form?
(In reply to Hans Petter Selasky from comment #8) I'm sorry, comment #4 was a statement that contained my bias that graphic image audio video examples are almost always provided in executable binary form, sorry. However, I have the slightest hope that the installation of the source files of the part contained in libportaudio will be avoided, since they are not directly related to the example. Since OPTIONS_SUB=yes is already used, it would be possible to prepare a pkg-message like the following and add it to SUB_FILES. -- begin pkg-message.in -- [ { type: install message: <<EOM Notes on building examples %%JACK%% None. %%EXAMPLES%%%%JACK%% They should be built as cc -I/usr/local/include ..../pa_devs.c %%NO_JACK%% Support for some features is missing from libportaudio. %%NO_JACK%% Therefore, some examples cannot be built. EOM } ] -- end pkg-message.in --
HPS, feel free to commit your patch and close this out.
I will look at this again. :-) --HPS
(In reply to Tatsuki Makino from comment #9) Yes, that is possible.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=a6e4e0d324d2c661b2e6434faefd492d11af2fb8 commit a6e4e0d324d2c661b2e6434faefd492d11af2fb8 Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2022-10-19 11:18:11 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2022-12-06 17:00:45 +0000 audio/portaudio: Install missing source files to build examples. PR: 267181 Approved by: pi (implicit) audio/portaudio/Makefile | 6 +++++- audio/portaudio/files/pkg-message.in (new) | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)
Let me know if you need more changes.