Discussion:
CMake build for cross-compiling - can't find JACK
(too old to reply)
Spencer Russell
2018-08-31 06:11:29 UTC
Permalink
I'm working on a cross-compile environment to build portaudio binaries for a bunch of platforms. I'm starting with the linux builds, so I first build ALSA and JACK and install them to `$prefix/lib`. When I try to run cmake it's able to find ALSA but not JACK.

I'm running cmake with the `-DCMAKE_INSTALL_PREFIX=$prefix` option. Cmake is able to successfully find ALSA using the built-in FindALSA module, which uses `find_library` internally. `ALSA_LIBRARIES` is set to the full path of my `libasound.so` library. The FindJACK module that comes with the portaudio source tarball however uses `pkg_search_module`, which sets `JACK_LIBRARIES` to just `jack`.

If I remove the pkgconfig lines and let it fall back to `find_library` then everything works fine. Probably in most cases the pkgconfig approach works fine because the linker can just take the `-ljack` and find it in the standard system library path, but it causes problems when cross-compiling or any time your libraries are in a non-standard location.

Alternatively running cmake with the option `-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON` disables pkgconfig, and also works.

Just wanted to report this in case the devs want to tweak the build system, or at least provide my solution to future generations of cross-compilers...
Phil Burk
2018-09-01 22:21:42 UTC
Permalink
Hi Spencer,

Thanks for the advice on cross compiling.
Post by Spencer Russell
If I remove the pkgconfig lines and let it fall back to `find_library`
then everything works fine.

Do you think that would also work just as well when *not* cross compiling?
We give that priority over cross compiling.

I added a note here:

https://app.assembla.com/spaces/portaudio/wiki/Platforms_Linux

Phil Burk
Post by Spencer Russell
I'm working on a cross-compile environment to build portaudio binaries for
a bunch of platforms. I'm starting with the linux builds, so I first build
ALSA and JACK and install them to `$prefix/lib`. When I try to run cmake
it's able to find ALSA but not JACK.
I'm running cmake with the `-DCMAKE_INSTALL_PREFIX=$prefix` option. Cmake
is able to successfully find ALSA using the built-in FindALSA module, which
uses `find_library` internally. `ALSA_LIBRARIES` is set to the full path of
my `libasound.so` library. The FindJACK module that comes with the
portaudio source tarball however uses `pkg_search_module`, which sets
`JACK_LIBRARIES` to just `jack`.
If I remove the pkgconfig lines and let it fall back to `find_library`
then everything works fine. Probably in most cases the pkgconfig approach
works fine because the linker can just take the `-ljack` and find it in the
standard system library path, but it causes problems when cross-compiling
or any time your libraries are in a non-standard location.
Alternatively running cmake with the option
`-DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON` disables pkgconfig, and also
works.
Just wanted to report this in case the devs want to tweak the build
system, or at least provide my solution to future generations of
cross-compilers...
_______________________________________________
Portaudio mailing list
https://lists.columbia.edu/mailman/listinfo/portaudio
Loading...