[2/2] buildtools/test-meson-builds: workaround pkg-config issue

Message ID 20190703164001.24841-3-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series fix issues with Ubuntu 18.04 compilation |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Bruce Richardson July 3, 2019, 4:40 p.m. UTC
  With Debian and Ubuntu, the default installation path for the 64-bit
libraries is set to e.g. /usr/local/lib/x86_64-linux-gnu/, compared to
/usr/local/lib64 on Fedora and Redhat distributions. This causes issues
when using "pkg-config --define-prefix" since pkg-config assumes the prefix
to be the grandparent of where the .pc file is. On Ubuntu we then get the
cflags include path as being "/path/to/install-root/usr/local/lib/include"
i.e. with an extra "lib" in the path.

This issue only applies for test installs on Ubuntu and similar distros,
and is not a problem for regular installs since the --define-prefix
parameter would not be passed to pkg-config in those cases.

The workaround for this in our test build script is to explicitly make
"lib" the "libdir" setting for the install, overriding the distro-provided
default.

Fixes: 7f80a2102bbb ("devtools: test pkg-config file")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 devtools/test-meson-builds.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Luca Boccassi July 4, 2019, 8:39 a.m. UTC | #1
On Wed, 2019-07-03 at 17:40 +0100, Bruce Richardson wrote:
> With Debian and Ubuntu, the default installation path for the 64-bit
> libraries is set to e.g. /usr/local/lib/x86_64-linux-gnu/, compared
> to
> /usr/local/lib64 on Fedora and Redhat distributions. This causes
> issues
> when using "pkg-config --define-prefix" since pkg-config assumes the
> prefix
> to be the grandparent of where the .pc file is. On Ubuntu we then get
> the
> cflags include path as being "/path/to/install-
> root/usr/local/lib/include"
> i.e. with an extra "lib" in the path.
> 
> This issue only applies for test installs on Ubuntu and similar
> distros,
> and is not a problem for regular installs since the --define-prefix
> parameter would not be passed to pkg-config in those cases.
> 
> The workaround for this in our test build script is to explicitly
> make
> "lib" the "libdir" setting for the install, overriding the distro-
> provided
> default.
> 
> Fixes: 7f80a2102bbb ("devtools: test pkg-config file")
> 
> Signed-off-by: Bruce Richardson <
> bruce.richardson@intel.com
> >
> ---
>  devtools/test-meson-builds.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-
> builds.sh
> index 57d1af47e..7efc590fe 100755
> --- a/devtools/test-meson-builds.sh
> +++ b/devtools/test-meson-builds.sh
> @@ -76,12 +76,14 @@ for c in gcc clang ; do
>  done
>  
>  # test compilation with minimal x86 instruction set
> +# set the install path for libraries to "lib" explicitly to prevent
> problems
> +# with pkg-config prefixes if installed in "lib/x86_64-linux-gnu"
> later.
>  default_machine='nehalem'
>  ok=$(cc -march=$default_machine -E - < /dev/null > /dev/null 2>&1 ||
> echo false)
>  if [ "$ok" = "false" ] ; then
>  	default_machine='corei7'
>  fi
> -build build-x86-default -Dmachine=$default_machine $use_shared
> +build build-x86-default -Dlibdir=lib -Dmachine=$default_machine
> $use_shared
>  
>  # enable cross compilation if gcc cross-compiler is found
>  c=aarch64-linux-gnu-gcc

I have sent a patch upstream to pkg-config to fix the issue, as it
should really support the multiarch layout:

https://gitlab.freedesktop.org/pkg-config/pkg-config/merge_requests/4
  
Bruce Richardson July 4, 2019, 9:47 a.m. UTC | #2
On Thu, Jul 04, 2019 at 09:39:32AM +0100, Luca Boccassi wrote:
> On Wed, 2019-07-03 at 17:40 +0100, Bruce Richardson wrote:
> > With Debian and Ubuntu, the default installation path for the 64-bit
> > libraries is set to e.g. /usr/local/lib/x86_64-linux-gnu/, compared
> > to
> > /usr/local/lib64 on Fedora and Redhat distributions. This causes
> > issues
> > when using "pkg-config --define-prefix" since pkg-config assumes the
> > prefix
> > to be the grandparent of where the .pc file is. On Ubuntu we then get
> > the
> > cflags include path as being "/path/to/install-
> > root/usr/local/lib/include"
> > i.e. with an extra "lib" in the path.
> > 
> > This issue only applies for test installs on Ubuntu and similar
> > distros,
> > and is not a problem for regular installs since the --define-prefix
> > parameter would not be passed to pkg-config in those cases.
> > 
> > The workaround for this in our test build script is to explicitly
> > make
> > "lib" the "libdir" setting for the install, overriding the distro-
> > provided
> > default.
> > 
> > Fixes: 7f80a2102bbb ("devtools: test pkg-config file")
> > 
> > Signed-off-by: Bruce Richardson <
> > bruce.richardson@intel.com
> > >
> > ---
> >  devtools/test-meson-builds.sh | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-
> > builds.sh
> > index 57d1af47e..7efc590fe 100755
> > --- a/devtools/test-meson-builds.sh
> > +++ b/devtools/test-meson-builds.sh
> > @@ -76,12 +76,14 @@ for c in gcc clang ; do
> >  done
> >  
> >  # test compilation with minimal x86 instruction set
> > +# set the install path for libraries to "lib" explicitly to prevent
> > problems
> > +# with pkg-config prefixes if installed in "lib/x86_64-linux-gnu"
> > later.
> >  default_machine='nehalem'
> >  ok=$(cc -march=$default_machine -E - < /dev/null > /dev/null 2>&1 ||
> > echo false)
> >  if [ "$ok" = "false" ] ; then
> >  	default_machine='corei7'
> >  fi
> > -build build-x86-default -Dmachine=$default_machine $use_shared
> > +build build-x86-default -Dlibdir=lib -Dmachine=$default_machine
> > $use_shared
> >  
> >  # enable cross compilation if gcc cross-compiler is found
> >  c=aarch64-linux-gnu-gcc
> 
> I have sent a patch upstream to pkg-config to fix the issue, as it
> should really support the multiarch layout:
> 
> https://gitlab.freedesktop.org/pkg-config/pkg-config/merge_requests/4

Thanks, Luca, good to have that fixed at source. Either way the fix in DPDK
for our testing is harmless and ensures things pass generally.

/Bruce
  

Patch

diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh
index 57d1af47e..7efc590fe 100755
--- a/devtools/test-meson-builds.sh
+++ b/devtools/test-meson-builds.sh
@@ -76,12 +76,14 @@  for c in gcc clang ; do
 done
 
 # test compilation with minimal x86 instruction set
+# set the install path for libraries to "lib" explicitly to prevent problems
+# with pkg-config prefixes if installed in "lib/x86_64-linux-gnu" later.
 default_machine='nehalem'
 ok=$(cc -march=$default_machine -E - < /dev/null > /dev/null 2>&1 || echo false)
 if [ "$ok" = "false" ] ; then
 	default_machine='corei7'
 fi
-build build-x86-default -Dmachine=$default_machine $use_shared
+build build-x86-default -Dlibdir=lib -Dmachine=$default_machine $use_shared
 
 # enable cross compilation if gcc cross-compiler is found
 c=aarch64-linux-gnu-gcc