Closed robrwo closed 2 years ago
Looks like this is coming from the .pc
file not Alien::Build
:
✅ starscream% more lib/pkgconfig/libbrotli*
::::::::::::::
lib/pkgconfig/libbrotlicommon.pc
::::::::::::::
prefix=/home/ollisg/opt/perl/5.36.0-RC3/lib/site_perl/5.36.0/x86_64-linux/auto/share/dist/Alien-Brotli
exec_prefix=/home/ollisg/opt/perl/5.36.0-RC3/lib/site_perl/5.36.0/x86_64-linux/auto/share/dist/Alien-Brotli
libdir=${prefix}/lib
includedir=${prefix}/include
Name: libbrotlicommon
URL: https://github.com/google/brotli
Description: Brotli common dictionary library
Version: 1.0.9
Libs: -L${libdir} -R${libdir} -lbrotlicommon
Cflags: -I${includedir}
::::::::::::::
lib/pkgconfig/libbrotlidec.pc
::::::::::::::
prefix=/home/ollisg/opt/perl/5.36.0-RC3/lib/site_perl/5.36.0/x86_64-linux/auto/share/dist/Alien-Brotli
exec_prefix=/home/ollisg/opt/perl/5.36.0-RC3/lib/site_perl/5.36.0/x86_64-linux/auto/share/dist/Alien-Brotli
libdir=${prefix}/lib
includedir=${prefix}/include
Name: libbrotlidec
URL: https://github.com/google/brotli
Description: Brotli decoder library
Version: 1.0.9
Libs: -L${libdir} -R${libdir} -lbrotlidec
Requires.private: libbrotlicommon >= 1.0.2
Cflags: -I${includedir}
::::::::::::::
lib/pkgconfig/libbrotlienc.pc
::::::::::::::
prefix=/home/ollisg/opt/perl/5.36.0-RC3/lib/site_perl/5.36.0/x86_64-linux/auto/share/dist/Alien-Brotli
exec_prefix=/home/ollisg/opt/perl/5.36.0-RC3/lib/site_perl/5.36.0/x86_64-linux/auto/share/dist/Alien-Brotli
libdir=${prefix}/lib
includedir=${prefix}/include
Name: libbrotlienc
URL: https://github.com/google/brotli
Description: Brotli encoder library
Version: 1.0.9
Libs: -L${libdir} -R${libdir} -lbrotlienc
Requires.private: libbrotlicommon >= 1.0.2
Cflags: -I${includedir}
If you need to support this version then you can patch the .pc.in
file in the patch phase, or the installed .pc
file before the gather phase. Alien::FFI
has is an example that does the former.
https://metacpan.org/release/PLICEASE/Alien-FFI-0.25/source/alienfile#L59-74
You could also adjust the linker flags using an around the gather phase, but keep in mind that Aliens that use Alien::Brotli might not work right.
Consider opening a ticket to have Brotli fixed as well so that future versions might not have this problem.
When I build brotli directly, the pc files don't have the -R options. So how is Alien::Build calling pkg-config?
I suspect it isn't pkg-config since that doesn't get called until after the .pc files are generated, but the configuration. AB adds --with-pic (and possibly other flags) and it may be keying off of that to add -R. If you build brotli with identical configure flags I suspect you may see the same .pc file.
I verified that the tarball source has .pc.in files with -R flags:
sandy% more `find -name \*.pc.in`
::::::::::::::
./scripts/libbrotlidec.pc.in
::::::::::::::
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libbrotlidec
URL: https://github.com/google/brotli
Description: Brotli decoder library
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -R${libdir} -lbrotlidec
Requires.private: libbrotlicommon >= 1.0.2
Cflags: -I${includedir}
::::::::::::::
./scripts/libbrotlienc.pc.in
::::::::::::::
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libbrotlienc
URL: https://github.com/google/brotli
Description: Brotli encoder library
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -R${libdir} -lbrotlienc
Requires.private: libbrotlicommon >= 1.0.2
Cflags: -I${includedir}
::::::::::::::
./scripts/libbrotlicommon.pc.in
::::::::::::::
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libbrotlicommon
URL: https://github.com/google/brotli
Description: Brotli common dictionary library
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -R${libdir} -lbrotlicommon
Cflags: -I${includedir}
and configuring with --with-pic
does indeed produce a .pc file with the -R flag (at least for me). I did not try a configure without --with-pic
. I did this without AB so I don't believe this is a bug in AB. If you need help patching the .pc.in or .pc files let me know.
The JSON data for Alien::Brotli contains the -R parameter, but this is not supported by gcc.
So when I run make, I get the error: