Skip to contentSkip to conversation

xen: limit pkg-config to PKG_CONFIG_PATH for xen libraries

PATCH RESEND In review Paul Durrant 3 participants 7 messages Mar 24, 2017 – Mar 27, 2017

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 xen: limit pkg-config to PKG_CONFIG_PATH for xen libraries

The Xen tools Makefile has been modified to set PKG_CONFIG_PATH such that use of pkg-config in QEMU configure finds the newly built Xen libraries. However, because older versions of Xen do not set PKG_CONFIG_PATH in the Makefile, the QEMU configure script will pick up any Xen libraries that may be installed in the build system rather than the newly built ones. Thus, if Xen 4.9 is built and installed it becomes impossible to build tools for an older version of Xen on the same system (without manual de-installtion).

This patch modifies configure to set PKG_CONFIG_LIBDIR to empty when looking for Xen libraries to ensure the search is limited only to PKG_CONFIG_PATH. This makes sure that, for versions of Xen prior to 4.9, pkg-config fails to find the Xen libraries an approriately falls back to previous methods of probing.

---
Cc: Anthony Perard <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Juergen Gross <[email protected]>

---
 configure | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
configure +8 -4
index fdf47e4..6ef5980 100755
@@ -1974,6 +1974,10 @@ fi
 ##########################################
 # xen probe
 
+xen_query_pkg_config() {
+    PKG_CONFIG_LIBDIR= ${pkg_config_exe} "$@"
+}
+
 if test "$xen" != "no" ; then
   xen_libs="-lxenstore -lxenctrl -lxenguest"
   xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
@@ -1997,9 +2001,9 @@ EOF
     xen=no
 
   # Xen version via pkg-config (Xen 4.9.0 and newer)
-  elif $pkg_config --exists xencontrol ; then
+  elif xen_query_pkg_config --exists xencontrol; then
     xen_ctrl_version="$(printf '%d%02d%02d' \
-      $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
+      $(xen_query_pkg_config --modversion xencontrol | sed 's/\./ /g') )"
     xen=yes
 
   elif
@@ -2216,8 +2220,8 @@ EOF
     if test $xen_ctrl_version -ge 40900 ; then
       xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab xenevtchn"
       xen_pc="$xen_pc xendevicemodel"
-      xen_libs="$($pkg_config --libs $xen_pc)"
-      QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
+      xen_libs="$(xen_query_pkg_config --libs $xen_pc)"
+      QEMU_CFLAGS="$QEMU_CFLAGS $(xen_query_pkg_config --cflags $xen_pc)"
     elif test $xen_ctrl_version -ge 40701 ; then
       libs_softmmu="$xen_stable_libs $libs_softmmu"
     fi
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw
Quoted 8 lines · Paul Durrant

The Xen tools Makefile has been modified to set PKG_CONFIG_PATH such that use of pkg-config in QEMU configure finds the newly built Xen libraries. However, because older versions of Xen do not set PKG_CONFIG_PATH in the Makefile, the QEMU configure script will pick up any Xen libraries that may be installed in the build system rather than the newly built ones. Thus, if Xen 4.9 is built and installed it becomes impossible to build tools for an older version of Xen on the same system (without manual de-installtion).

Quoted 7 lines

This patch modifies configure to set PKG_CONFIG_LIBDIR to empty when looking for Xen libraries to ensure the search is limited only to PKG_CONFIG_PATH. This makes sure that, for versions of Xen prior to 4.9, pkg-config fails to find the Xen libraries an approriately falls back to previous methods of probing.

NAK. You are breaking normal qemu build with installed Xen pkg-config files.

Juergen

Quoted 47 lines

---
Cc: Anthony Perard <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Juergen Gross <[email protected]>

---
 configure | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
configure +8 -4
index fdf47e4..6ef5980 100755
@@ -1974,6 +1974,10 @@ fi
 ##########################################
 # xen probe
 
+xen_query_pkg_config() {
+    PKG_CONFIG_LIBDIR= ${pkg_config_exe} "$@"
+}
+
 if test "$xen" != "no" ; then
   xen_libs="-lxenstore -lxenctrl -lxenguest"
   xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
@@ -1997,9 +2001,9 @@ EOF
     xen=no
 
   # Xen version via pkg-config (Xen 4.9.0 and newer)
-  elif $pkg_config --exists xencontrol ; then
+  elif xen_query_pkg_config --exists xencontrol; then
     xen_ctrl_version="$(printf '%d%02d%02d' \
-      $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
+      $(xen_query_pkg_config --modversion xencontrol | sed 's/\./ /g') )"
     xen=yes
 
   elif
@@ -2216,8 +2220,8 @@ EOF
     if test $xen_ctrl_version -ge 40900 ; then
       xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab xenevtchn"
       xen_pc="$xen_pc xendevicemodel"
-      xen_libs="$($pkg_config --libs $xen_pc)"
-      QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
+      xen_libs="$(xen_query_pkg_config --libs $xen_pc)"
+      QEMU_CFLAGS="$QEMU_CFLAGS $(xen_query_pkg_config --cflags $xen_pc)"
     elif test $xen_ctrl_version -ge 40701 ; then
       libs_softmmu="$xen_stable_libs $libs_softmmu"
     fi
#2 lore raw
Quoted 9 lines · Juergen Gross
Quoted 8 lines · Paul Durrant

The Xen tools Makefile has been modified to set PKG_CONFIG_PATH such that use of pkg-config in QEMU configure finds the newly built Xen libraries. However, because older versions of Xen do not set PKG_CONFIG_PATH in the Makefile, the QEMU configure script will pick up any Xen libraries that may be installed in the build system rather than the newly built ones. Thus, if Xen 4.9 is built and installed it becomes impossible to build tools for an older version of Xen on the same system (without manual de-installtion).

Quoted 7 lines
Quoted 7 lines

This patch modifies configure to set PKG_CONFIG_LIBDIR to empty when looking for Xen libraries to ensure the search is limited only to PKG_CONFIG_PATH. This makes sure that, for versions of Xen prior to 4.9, pkg-config fails to find the Xen libraries an approriately falls back to previous methods of probing.

Paul, thanks for spotting this. I didn't spot it because I don't have Xen installed in my build environment, but we should not rely on that.

Quoted 2 lines

NAK. You are breaking normal qemu build with installed Xen pkg-config files.

The normal QEMU build, done as part of the xen-unstable build, is actually done without Xen being installed in the system. So, if I am not mistaken, the current mechanism also breaks the following entirely legitimate scenario:

- user has 4.9 installed on her system
- user git clones xen 4.10
- user build xen 4.10
- as part of the xen build, qemu is cloned and built
- the qemu configure script picks up the pkgconfig file from /usr/share and misconfigure the xen version, setting it to 4.9 instead of 4.10
- the qemu build fails
- the xen build fails

Am I right?

Regardless, both cases need to work correctly. A lot of people rely on out of tree builds, including cross-compilations and openembedded. This is a regression.

I suggest we set PKG_CONFIG_LIBDIR (or PKG_CONFIG_PATH?) to the right place depending on where the configure script is picking up the Xen header files:

- If the configure script picks up the Xen header files from /usr/include, then we want the pkgconfig dir to be /usr/share/pkgconfig.

- If the configure script picks up the Xen header files from /local/xen-unstable.git/tools/libxc/include, then we want the pkgconfig dir to be local/xen-unstable.git/tools/pkg-config.

If that's too complex, we can always go back to the good old, non-pkgconfig days.

Quoted 33 lines
Quoted 33 lines
Cc Anthony Perard <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Juergen Gross <[email protected]>
---
 configure | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
configure +6 -2
index fdf47e4..6ef5980 100755
@@ -1974,6 +1974,10 @@ fi
 ##########################################
 # xen probe
 
+xen_query_pkg_config() {
+    PKG_CONFIG_LIBDIR= ${pkg_config_exe} "$@"
+}
+
 if test "$xen" != "no" ; then
   xen_libs="-lxenstore -lxenctrl -lxenguest"
   xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
@@ -1997,9 +2001,9 @@ EOF
     xen=no
 
   # Xen version via pkg-config (Xen 4.9.0 and newer)
-  elif $pkg_config --exists xencontrol ; then
+  elif xen_query_pkg_config --exists xencontrol; then
     xen_ctrl_version="$(printf '%d%02d%02d' \
-      $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
+      $(xen_query_pkg_config --modversion xencontrol | sed 's/\./ /g') )"
     xen=yes
 
Quoted 14 lines

configure EOF · line 2227

Quoted 13 lines
configure +2 -2
   elif
@@ -2216,8 +2220,8 @@ EOF
     if test $xen_ctrl_version -ge 40900 ; then
       xen_pc="xencontrol xenstore xenguest xenforeignmemory xengnttab xenevtchn"
       xen_pc="$xen_pc xendevicemodel"
-      xen_libs="$($pkg_config --libs $xen_pc)"
-      QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
+      xen_libs="$(xen_query_pkg_config --libs $xen_pc)"
+      QEMU_CFLAGS="$QEMU_CFLAGS $(xen_query_pkg_config --cflags $xen_pc)"
     elif test $xen_ctrl_version -ge 40701 ; then
       libs_softmmu="$xen_stable_libs $libs_softmmu"
     fi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 55 lines

-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 24 March 2017 19:12
To: Juergen Gross <[email protected]>
Cc: Paul Durrant <[email protected]>; [email protected]; xen- [email protected]; Anthony Perard <[email protected]>; Stefano Stabellini <[email protected]>
Subject: Re: [PATCH RESEND] xen: limit pkg-config to PKG_CONFIG_PATH for xen libraries

Quoted 2 lines · Juergen Gross
Quoted 1 line · Paul Durrant

The Xen tools Makefile has been modified to set PKG_CONFIG_PATH

such that

Quoted 2 lines
Quoted 2 lines

use of pkg-config in QEMU configure finds the newly built Xen libraries. However, because older versions of Xen do not set PKG_CONFIG_PATH

in the

Quoted 1 line
Quoted 1 line

Makefile, the QEMU configure script will pick up any Xen libraries that

may

Quoted 3 lines
Quoted 3 lines

be installed in the build system rather than the newly built ones. Thus, if Xen 4.9 is built and installed it becomes impossible to build tools for an older version of Xen on the same system (without manual de-

installtion).

Quoted 4 lines
Quoted 4 lines

This patch modifies configure to set PKG_CONFIG_LIBDIR to empty when looking for Xen libraries to ensure the search is limited only to PKG_CONFIG_PATH. This makes sure that, for versions of Xen prior to

4.9,

Quoted 4 lines
Quoted 4 lines

pkg-config fails to find the Xen libraries an approriately falls back to previous methods of probing.

Paul, thanks for spotting this. I didn't spot it because I don't have Xen installed in my build environment, but we should not rely on that.

Quoted 2 lines

NAK. You are breaking normal qemu build with installed Xen pkg-config files.

The normal QEMU build, done as part of the xen-unstable build, is actually done without Xen being installed in the system. So, if I am not mistaken, the current mechanism also breaks the following entirely legitimate scenario:

- user has 4.9 installed on her system
- user git clones xen 4.10
- user build xen 4.10
- as part of the xen build, qemu is cloned and built
- the qemu configure script picks up the pkgconfig file from /usr/share and misconfigure the xen version, setting it to 4.9 instead of 4.10
- the qemu build fails
- the xen build fails

Quoted 2 lines

Am I right?

I think the above would actually work because the 4.10 files would be found before the 4.9 files. What fails is installing 4.9 and then trying to build 4.8.

Quoted 8 lines

Regardless, both cases need to work correctly. A lot of people rely on out of tree builds, including cross-compilations and openembedded. This is a regression.

I suggest we set PKG_CONFIG_LIBDIR (or PKG_CONFIG_PATH?) to the right place depending on where the configure script is picking up the Xen header files:

Quoted 7 lines

- If the configure script picks up the Xen header files from /usr/include, then we want the pkgconfig dir to be /usr/share/pkgconfig.

- If the configure script picks up the Xen header files from /local/xen-unstable.git/tools/libxc/include, then we want the pkgconfig dir to be local/xen-unstable.git/tools/pkg-config.

Yes, that's what is needed.

Quoted 3 lines

If that's too complex, we can always go back to the good old, non-pkgconfig days.

Unless this can be speedily resolved I think reverting the pkg-config changes would be best.

Another possibility perhaps would be an explicit configure flag for in-tree and out-of-tree builds so we can say exactly where QEMU should be getting its environment from?

Paul

Quoted 39 lines
Quoted 34 lines
Quoted 34 lines
Cc Anthony Perard <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Juergen Gross <[email protected]>
---
 configure | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
configure +6 -2
index fdf47e4..6ef5980 100755
@@ -1974,6 +1974,10 @@ fi
 ##########################################
 # xen probe
 
+xen_query_pkg_config() {
+    PKG_CONFIG_LIBDIR= ${pkg_config_exe} "$@"
+}
+
 if test "$xen" != "no" ; then
   xen_libs="-lxenstore -lxenctrl -lxenguest"
   xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
@@ -1997,9 +2001,9 @@ EOF
     xen=no
 
   # Xen version via pkg-config (Xen 4.9.0 and newer)
-  elif $pkg_config --exists xencontrol ; then
+  elif xen_query_pkg_config --exists xencontrol; then
     xen_ctrl_version="$(printf '%d%02d%02d' \
-      $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
+      $(xen_query_pkg_config --modversion xencontrol | sed 's/\./ /g') )"
     xen=yes
 
Quoted 4 lines

configure EOF · line 2221

Quoted 4 lines
configure +0 -0
   elif
@@ -2216,8 +2220,8 @@ EOF
     if test $xen_ctrl_version -ge 40900 ; then
       xen_pc="xencontrol xenstore xenguest xenforeignmemory

xengnttab xenevtchn"

Quoted 11 lines
Quoted 5 lines

configure EOF

Quoted 5 lines
configure +2 -2
       xen_pc="$xen_pc xendevicemodel"
-      xen_libs="$($pkg_config --libs $xen_pc)"
-      QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
+      xen_libs="$(xen_query_pkg_config --libs $xen_pc)"
+      QEMU_CFLAGS="$QEMU_CFLAGS $(xen_query_pkg_config --cflags

$xen_pc)"

Quoted 5 lines
Quoted 4 lines
configure +0 -0
     elif test $xen_ctrl_version -ge 40701 ; then
       libs_softmmu="$xen_stable_libs $libs_softmmu"
     fi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
Quoted 71 lines

-----Original Message-----
From: Qemu-devel [mailto:qemu-devel- [email protected]] On Behalf Of Paul Durrant
Sent: 24 March 2017 19:18
To: 'Stefano Stabellini' <[email protected]>; Juergen Gross <[email protected]>
Cc: Anthony Perard <[email protected]>; xen- [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH RESEND] xen: limit pkg-config to PKG_CONFIG_PATH for xen libraries

Quoted 5 lines

-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 24 March 2017 19:12
To: Juergen Gross <[email protected]>
Cc: Paul Durrant <[email protected]>; [email protected];

xen-

Quoted 1 line

[email protected]; Anthony Perard

<[email protected]>;

Quoted 2 lines

Stefano Stabellini <[email protected]>
Subject: Re: [PATCH RESEND] xen: limit pkg-config to PKG_CONFIG_PATH

for

Quoted 8 lines

xen libraries

Quoted 2 lines · Juergen Gross
Quoted 1 line · Paul Durrant

The Xen tools Makefile has been modified to set PKG_CONFIG_PATH

such that

Quoted 2 lines
Quoted 2 lines

use of pkg-config in QEMU configure finds the newly built Xen libraries. However, because older versions of Xen do not set

PKG_CONFIG_PATH

Quoted 9 lines

in the

Quoted 1 line
Quoted 1 line

Makefile, the QEMU configure script will pick up any Xen libraries that

may

Quoted 3 lines
Quoted 3 lines

be installed in the build system rather than the newly built ones. Thus, if Xen 4.9 is built and installed it becomes impossible to build tools for an older version of Xen on the same system (without manual de-

installtion).

Quoted 2 lines
Quoted 2 lines

This patch modifies configure to set PKG_CONFIG_LIBDIR to empty

when

Quoted 30 lines
Quoted 2 lines
Quoted 2 lines

looking for Xen libraries to ensure the search is limited only to PKG_CONFIG_PATH. This makes sure that, for versions of Xen prior to

4.9,

Quoted 4 lines
Quoted 4 lines

pkg-config fails to find the Xen libraries an approriately falls back to previous methods of probing.

Paul, thanks for spotting this. I didn't spot it because I don't have Xen installed in my build environment, but we should not rely on that.

Quoted 2 lines

NAK. You are breaking normal qemu build with installed Xen pkg-config files.

The normal QEMU build, done as part of the xen-unstable build, is actually done without Xen being installed in the system. So, if I am not mistaken, the current mechanism also breaks the following entirely legitimate scenario:

- user has 4.9 installed on her system
- user git clones xen 4.10
- user build xen 4.10
- as part of the xen build, qemu is cloned and built
- the qemu configure script picks up the pkgconfig file from /usr/share and misconfigure the xen version, setting it to 4.9 instead of 4.10
- the qemu build fails
- the xen build fails

Quoted 5 lines
Quoted 2 lines

Am I right?

I think the above would actually work because the 4.10 files would be found before the 4.9 files. What fails is installing 4.9 and then trying to build 4.8.

I should qualify that with saying 'trying to build 4.8 with a newer QEMU (i.e. one that has a configure which knows about pkg-config). I still think that's a legitimate use-case though.

Paul

Quoted 73 lines
Quoted 6 lines

Regardless, both cases need to work correctly. A lot of people rely on out of tree builds, including cross-compilations and openembedded. This is a regression.

I suggest we set PKG_CONFIG_LIBDIR (or PKG_CONFIG_PATH?) to the

right

Quoted 10 lines

place depending on where the configure script is picking up the Xen header files:

- If the configure script picks up the Xen header files from /usr/include, then we want the pkgconfig dir to be /usr/share/pkgconfig.

- If the configure script picks up the Xen header files from /local/xen-unstable.git/tools/libxc/include, then we want the pkgconfig dir to be local/xen-unstable.git/tools/pkg-config.

Yes, that's what is needed.

Quoted 3 lines

If that's too complex, we can always go back to the good old, non-pkgconfig days.

Unless this can be speedily resolved I think reverting the pkg-config changes would be best.

Another possibility perhaps would be an explicit configure flag for in-tree and out-of-tree builds so we can say exactly where QEMU should be getting its environment from?

Paul

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Cc Anthony Perard <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Juergen Gross <[email protected]>
---
 configure | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
configure +4 -0
index fdf47e4..6ef5980 100755
@@ -1974,6 +1974,10 @@ fi
 ##########################################
 # xen probe
 
+xen_query_pkg_config() {
+    PKG_CONFIG_LIBDIR= ${pkg_config_exe} "$@"
+}
+
 if test "$xen" != "no" ; then
   xen_libs="-lxenstore -lxenctrl -lxenguest"
   xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
@@ -1997,9 +2001,9 @@ EOF
     xen=no
 
Quoted 6 lines
Quoted 6 lines

configure EOF

Quoted 6 lines
configure +2 -2
   # Xen version via pkg-config (Xen 4.9.0 and newer)
-  elif $pkg_config --exists xencontrol ; then
+  elif xen_query_pkg_config --exists xencontrol; then
     xen_ctrl_version="$(printf '%d%02d%02d' \
-      $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
+      $(xen_query_pkg_config --modversion xencontrol | sed 's/\./ /g')

)"

Quoted 7 lines
Quoted 6 lines

configure EOF · line 2221

Quoted 6 lines
configure +0 -0
     xen=yes
 
   elif
@@ -2216,8 +2220,8 @@ EOF
     if test $xen_ctrl_version -ge 40900 ; then
       xen_pc="xencontrol xenstore xenguest xenforeignmemory

xengnttab xenevtchn"

Quoted 12 lines
Quoted 5 lines
Quoted 5 lines

configure EOF

Quoted 5 lines
configure +2 -2
       xen_pc="$xen_pc xendevicemodel"
-      xen_libs="$($pkg_config --libs $xen_pc)"
-      QEMU_CFLAGS="$QEMU_CFLAGS $($pkg_config --cflags $xen_pc)"
+      xen_libs="$(xen_query_pkg_config --libs $xen_pc)"
+      QEMU_CFLAGS="$QEMU_CFLAGS $(xen_query_pkg_config --

cflags

Quoted 6 lines

$xen_pc)"

Quoted 5 lines
Quoted 4 lines
configure +0 -0
     elif test $xen_ctrl_version -ge 40701 ; then
       libs_softmmu="$xen_stable_libs $libs_softmmu"
     fi

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
Quoted 71 lines · Paul Durrant
Quoted 71 lines

-----Original Message-----
From: Qemu-devel [mailto:qemu-devel- [email protected]] On Behalf Of Paul Durrant
Sent: 24 March 2017 19:18
To: 'Stefano Stabellini' <[email protected]>; Juergen Gross <[email protected]>
Cc: Anthony Perard <[email protected]>; xen- [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH RESEND] xen: limit pkg-config to PKG_CONFIG_PATH for xen libraries

Quoted 5 lines

-----Original Message-----
From: Stefano Stabellini [mailto:[email protected]]
Sent: 24 March 2017 19:12
To: Juergen Gross <[email protected]>
Cc: Paul Durrant <[email protected]>; [email protected];

xen-

Quoted 1 line

[email protected]; Anthony Perard

<[email protected]>;

Quoted 2 lines

Stefano Stabellini <[email protected]>
Subject: Re: [PATCH RESEND] xen: limit pkg-config to PKG_CONFIG_PATH

for

Quoted 8 lines

xen libraries

Quoted 2 lines · Juergen Gross
Quoted 1 line · Paul Durrant

The Xen tools Makefile has been modified to set PKG_CONFIG_PATH

such that

Quoted 2 lines
Quoted 2 lines

use of pkg-config in QEMU configure finds the newly built Xen libraries. However, because older versions of Xen do not set

PKG_CONFIG_PATH

Quoted 9 lines

in the

Quoted 1 line
Quoted 1 line

Makefile, the QEMU configure script will pick up any Xen libraries that

may

Quoted 3 lines
Quoted 3 lines

be installed in the build system rather than the newly built ones. Thus, if Xen 4.9 is built and installed it becomes impossible to build tools for an older version of Xen on the same system (without manual de-

installtion).

Quoted 2 lines
Quoted 2 lines

This patch modifies configure to set PKG_CONFIG_LIBDIR to empty

when

Quoted 30 lines
Quoted 2 lines
Quoted 2 lines

looking for Xen libraries to ensure the search is limited only to PKG_CONFIG_PATH. This makes sure that, for versions of Xen prior to

4.9,

Quoted 4 lines
Quoted 4 lines

pkg-config fails to find the Xen libraries an approriately falls back to previous methods of probing.

Paul, thanks for spotting this. I didn't spot it because I don't have Xen installed in my build environment, but we should not rely on that.

Quoted 2 lines

NAK. You are breaking normal qemu build with installed Xen pkg-config files.

The normal QEMU build, done as part of the xen-unstable build, is actually done without Xen being installed in the system. So, if I am not mistaken, the current mechanism also breaks the following entirely legitimate scenario:

- user has 4.9 installed on her system
- user git clones xen 4.10
- user build xen 4.10
- as part of the xen build, qemu is cloned and built
- the qemu configure script picks up the pkgconfig file from /usr/share and misconfigure the xen version, setting it to 4.9 instead of 4.10
- the qemu build fails
- the xen build fails

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Am I right?

I think the above would actually work because the 4.10 files would be found before the 4.9 files. What fails is installing 4.9 and then trying to build 4.8.

I should qualify that with saying 'trying to build 4.8 with a newer QEMU (i.e. one that has a configure which knows about pkg-config). I still think that's a legitimate use-case though.

To sum it up we have to care about the following scenarios:

a) Xen in-tree build, Xen >= 4.9
b) Xen in-tree build, Xen < 4.9
c) build out-of-Xen-tree

combined with any of:

1) no Xen installed on build machine
2) Xen >= 4.9 installed
3) Xen < 4.9 installed

1) + c) is not supported, all other combinations should work.

I suggest the following modifications of my patch:

- keep the test program for detection of Xen 4.9
- scan the extra ldflags for special mentioning of tools/libxc to detect Xen in-tree build < 4.9 (will detect 4.9, too, but this is no problem), set xen_in_tree_old if found
- if xen_in_tree_old found, don't use pkg-config for Xen version detection and flags
- otherwise try pkg-config first

This should cover all cases we need.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
Quoted 1 line

-----Original Message-----

[snip]

Quoted 7 lines

To sum it up we have to care about the following scenarios:

a) Xen in-tree build, Xen >= 4.9
b) Xen in-tree build, Xen < 4.9
c) build out-of-Xen-tree

Quoted 8 lines

combined with any of:

1) no Xen installed on build machine
2) Xen >= 4.9 installed
3) Xen < 4.9 installed

1) + c) is not supported, all other combinations should work.

Good summary.

Quoted 10 lines

I suggest the following modifications of my patch:

- keep the test program for detection of Xen 4.9
- scan the extra ldflags for special mentioning of tools/libxc to detect Xen in-tree build < 4.9 (will detect 4.9, too, but this is no problem), set xen_in_tree_old if found
- if xen_in_tree_old found, don't use pkg-config for Xen version detection and flags
- otherwise try pkg-config first

Quoted 2 lines

This should cover all cases we need.

That sounds plausible.

Thanks,

Paul

Quoted 2 lines

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel