Skip to contentSkip to conversation

build/tools: disable libvchan build on NetBSD

PATCH In review Roger Pau Monne 4 participants 27 messages May 17, 2012 – May 22, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 build/tools: disable libvchan build on NetBSD

NetBSD doesn't have a gntdev, so libvchan is unable to build due to the lack of the header files gntalloc.h.

This is the error:

gcc -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .init.o.d -fno-optimize-sibling-calls -I../include -I. -I/root/xen/xen-netbsd/tools/libvchan/../../tools/xenstore -I/root/xen/xen-netbsd/tools/libvchan/../../tools/include -I/root/xen/xen-netbsd/tools/libvchan/../../tools/libxc -I/root/xen/xen-netbsd/tools/libvchan/../../tools/include -c -o init.o init.c
init.c:45:30: fatal error: xen/sys/gntalloc.h: No such file or directory
compilation terminated.
gmake[3]: *** [init.opic] Error 1
gmake[3]: *** Waiting for unfinished jobs.... init.c:45:30: fatal error: xen/sys/gntalloc.h: No such file or directory
compilation terminated.

---
 tools/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/Makefile +1 -1
index 7b14678..fbdf716 100644
@@ -30,7 +30,7 @@ SUBDIRS-$(CONFIG_NetBSD) += blktap2
 SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
 SUBDIRS-y += libfsimage
 SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
-SUBDIRS-y += libvchan
+SUBDIRS-$(CONFIG_Linux) += libvchan
 
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"
Signature · 1 line
1.7.7.5 (Apple Git-26)
#1 lore raw

PATCH v2 2/4 autoconf: correctly parse *_INCLUDES and *_LIB env vars

Parse those options correctly, since the "+=" operator is not valid. Also added CPPFLAGS, so headers checks don't give strange results.

---
 tools/m4/set_cflags_ldflags.m4 |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
tools/m4/set_cflags_ldflags.m4 +5 -4
index 7e357ba..631e81c 100644
@@ -1,20 +1,21 @@
 AC_DEFUN([AX_SET_FLAGS],
 [for cflag in $PREPEND_INCLUDES
 do
-    PREPEND_CFLAGS+=" -I$cflag"
+    PREPEND_CFLAGS="$PREPEND_CFLAGS -I$cflag"
 done
 for ldflag in $PREPEND_LIB
 do
-    PREPEND_LDFLAGS+=" -L$ldflag"
+    PREPEND_LDFLAGS="$PREPEND_LDFLAGS -L$ldflag"
 done
 for cflag in $APPEND_INCLUDES
 do
-    APPEND_CFLAGS+=" -I$cflag"
+    APPEND_CFLAGS="$APPEND_CFLAGS -I$cflag"
 done
 for ldflag in $APPEND_LIB
 do
-    APPEND_LDFLAGS+=" -L$ldflag"
+    APPEND_LDFLAGS="$APPEND_LDFLAGS -L$ldflag"
 done
 CFLAGS="$PREPEND_CFLAGS $CFLAGS $APPEND_CFLAGS"
+CPPFLAGS="$CFLAGS"
 LDFLAGS="$PREPEND_LDFLAGS $LDFLAGS $APPEND_LDFLAGS"])
 
Signature · 1 line
1.7.7.5 (Apple Git-26)
#2 lore raw

PATCH v2 3/4 python: set absolute path to libxl.h on _pyxl_types.c

In reply to Roger Pau Monne

genwrap.py generates _pyxl_types.c, which includes libxl.h, but if libxl.h is already present in the include search path, the old one was included instead of the new one, giving compilation errors. Since _pyxl_types.c is generated at compilation time, we can safely set the path to libxl.h include.

I've only experienced this problem when compiling Xen on NetBSD with old header files in the include path, Linux seems to not have this problem.

Cc Ian Jackson <[email protected]>
Cc Christoph Egger <[email protected]>
---
 tools/python/genwrap.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
tools/python/genwrap.py +4 -2
index af8a5e9..0d7cc98 100644
@@ -309,10 +309,12 @@ _hidden int genwrap__defbool_set(PyObject *v, libxl_defbool *db);
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include "libxl.h" /* gah */
+#include "%s" /* gah */
 #include "%s"
 
-""" % tuple((' '.join(sys.argv),) + (os.path.split(decls)[-1:]),))
+""" % tuple((' '.join(sys.argv),) +
+            (os.path.dirname(sys.argv[1]) + "/libxl.h",) +
+            (os.path.split(decls)[-1:]),))
     for ty in types:
         if ty.private:
             continue
Signature · 1 line
1.7.7.5 (Apple Git-26)
#3 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

Quoted 9 lines · Roger Pau Monne

genwrap.py generates _pyxl_types.c, which includes libxl.h, but if libxl.h is already present in the include search path, the old one was included instead of the new one, giving compilation errors. Since _pyxl_types.c is generated at compilation time, we can safely set the path to libxl.h include.

I've only experienced this problem when compiling Xen on NetBSD with old header files in the include path, Linux seems to not have this problem.

Should this be include <> and not "", since libxl.h isn't in the current dir in this case?

Is the right fix to make sure that the in-tree -I lines come first? Ian.

Quoted 27 lines
Cc Ian Jackson <[email protected]>
Cc Christoph Egger <[email protected]>
---
 tools/python/genwrap.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
tools/python/genwrap.py +4 -2
index af8a5e9..0d7cc98 100644
@@ -309,10 +309,12 @@ _hidden int genwrap__defbool_set(PyObject *v, libxl_defbool *db);
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include "libxl.h" /* gah */
+#include "%s" /* gah */
 #include "%s"
 
-""" % tuple((' '.join(sys.argv),) + (os.path.split(decls)[-1:]),))
+""" % tuple((' '.join(sys.argv),) +
+            (os.path.dirname(sys.argv[1]) + "/libxl.h",) +
+            (os.path.split(decls)[-1:]),))
     for ty in types:
         if ty.private:
             continue
#4 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

Quoted 11 lines · Ian Campbell
Quoted 9 lines · Roger Pau Monne

genwrap.py generates _pyxl_types.c, which includes libxl.h, but if libxl.h is already present in the include search path, the old one was included instead of the new one, giving compilation errors. Since _pyxl_types.c is generated at compilation time, we can safely set the path to libxl.h include.

I've only experienced this problem when compiling Xen on NetBSD with old header files in the include path, Linux seems to not have this problem.

Quoted 5 lines

Should this be include<> and not "", since libxl.h isn't in the current dir in this case?

Is the right fix to make sure that the in-tree -I lines come first? Ian.

Actually I'm not sure if it's possible to make sure the in-tree -I lines come first, because the gcc options are automatically generated by python build tools (distutils & friends...), so we cannot touch much of this (I've looked at distutils.core options, and it seems to be no way of setting an order on compiler options, but I'm no expert on python C extensions building), so unless we craft our own makefile to build this python stuff I think we are stuck with something like this.

Quoted 29 lines
Quoted 27 lines
Cc Ian Jackson<[email protected]>
Cc Christoph Egger<[email protected]>
---
  tools/python/genwrap.py |    6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)
tools/python/genwrap.py +4 -2
index af8a5e9..0d7cc98 100644
@@ -309,10 +309,12 @@ _hidden int genwrap__defbool_set(PyObject *v, libxl_defbool *db);
  #include<stdint.h>
  #include<stdlib.h>
  #include<stdio.h>
-#include "libxl.h" /* gah */
+#include "%s" /* gah */
  #include "%s"
 
-""" % tuple((' '.join(sys.argv),) + (os.path.split(decls)[-1:]),))
+""" % tuple((' '.join(sys.argv),) +
+            (os.path.dirname(sys.argv[1]) + "/libxl.h",) +
+            (os.path.split(decls)[-1:]),))
      for ty in types:
          if ty.private:
              continue
#5 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

Quoted 18 lines · Roger Pau Monne
Quoted 11 lines · Ian Campbell
Quoted 9 lines · Roger Pau Monne

genwrap.py generates _pyxl_types.c, which includes libxl.h, but if libxl.h is already present in the include search path, the old one was included instead of the new one, giving compilation errors. Since _pyxl_types.c is generated at compilation time, we can safely set the path to libxl.h include.

I've only experienced this problem when compiling Xen on NetBSD with old header files in the include path, Linux seems to not have this problem.

Quoted 5 lines

Should this be include<> and not "", since libxl.h isn't in the current dir in this case?

Is the right fix to make sure that the in-tree -I lines come first? Ian.

Quoted 7 lines

Actually I'm not sure if it's possible to make sure the in-tree -I lines come first, because the gcc options are automatically generated by python build tools (distutils & friends...), so we cannot touch much of this (I've looked at distutils.core options, and it seems to be no way of setting an order on compiler options, but I'm no expert on python C extensions building), so unless we craft our own makefile to build this python stuff I think we are stuck with something like this.

Surely distutils puts user supplied options first before system options? My /usr/lib/python2.5/distutils/command/build_ext.py says:

# Put the Python "system" include dir at the end, so that
# any local include dirs take precedence. self.include_dirs.append(py_include)
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)

So it seems like this is the intention.

Are you sure this isn't just a bug in your version of distutils or something like that?

My python xl builds end up as:
building 'xl' extension
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .build.d -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -mno-tls-direct-seg-refs -fPIC -I../../tools/include -I../../tools/libxl -I../../tools/libxc -Ixen/lowlevel/xl -I/usr/include/python2.6 -c xen/lowlevel/xl/xl.c -o build/temp.linux-i686-2.6/xen/lowlevel/xl/xl.o -fno-strict-aliasing -Werror

Which has our local -I options before all the others -- which is sensible. What do you see with your system?

Ian.

#6 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

Quoted 53 lines · Ian Campbell
Quoted 16 lines · Roger Pau Monne
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Roger Pau Monne

genwrap.py generates _pyxl_types.c, which includes libxl.h, but if libxl.h is already present in the include search path, the old one was included instead of the new one, giving compilation errors. Since _pyxl_types.c is generated at compilation time, we can safely set the path to libxl.h include.

Quoted 8 lines
Quoted 3 lines

I've only experienced this problem when compiling Xen on NetBSD with old header files in the include path, Linux seems to not have this problem.

Should this be include<> and not "", since libxl.h isn't in the current
dir in this case?

Is the right fix to make sure that the in-tree -I lines come first? Ian.

Quoted 7 lines

Actually I'm not sure if it's possible to make sure the in-tree -I lines come first, because the gcc options are automatically generated by python build tools (distutils& friends...), so we cannot touch much of this (I've looked at distutils.core options, and it seems to be no way of setting an order on compiler options, but I'm no expert on python C extensions building), so unless we craft our own makefile to build this python stuff I think we are stuck with something like this.

Surely distutils puts user supplied options first before system options? My /usr/lib/python2.5/distutils/command/build_ext.py says:

# Put the Python "system" include dir at the end, so that
# any local include dirs take precedence. self.include_dirs.append(py_include)
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)

So it seems like this is the intention.

Are you sure this isn't just a bug in your version of distutils or something like that?

My python xl builds end up as:
building 'xl' extension
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .build.d -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -mno-tls-direct-seg-refs -fPIC -I../../tools/include -I../../tools/libxl -I../../tools/libxc -Ixen/lowlevel/xl -I/usr/include/python2.6 -c xen/lowlevel/xl/xl.c -o build/temp.linux-i686-2.6/xen/lowlevel/xl/xl.o -fno-strict-aliasing -Werror

Quoted 2 lines

Which has our local -I options before all the others -- which is sensible. What do you see with your system?

This is what I see:

CC="gcc" CFLAGS="-O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .build.d -fno-optimize-sibling-calls" python2.7 setup.py build
running build
running build_py
running build_ext
building 'xl' extension

gcc -DNDEBUG -O2 -DHAVE_DB_185_H -I/usr/include -I/usr/pkg/include -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .build.d -fno-optimize-sibling-calls -fPIC -I../../tools/include -I../../tools/libxl -I../../tools/libxc -Ixen/lowlevel/xl -I/usr/pkg/include/python2.7 -c xen/lowlevel/xl/_pyxl_types.c -o build/temp.netbsd-6.0_BETA-amd64-2.7/xen/lowlevel/xl/_pyxl_types.o -fno-strict-aliasing -Werror

xen/lowlevel/xl/_pyxl_types.c: In function 'genwrap__init':
xen/lowlevel/xl/_pyxl_types.c:4346:78: error: 'LIBXL_EVENT_TYPE_DOMAIN_CREATE_CONSOLE_AVAILABLE' undeclared (first use in this function) xen/lowlevel/xl/_pyxl_types.c:4346:78: note: each undeclared identifier is reported only once for each function it appears in
error: command 'gcc' failed with exit status 1
gmake: *** [build] Error 1
gmake: Leaving directory `/root/xen/xen-netbsd/tools/python'

So this part "-DNDEBUG -O2 -DHAVE_DB_185_H -I/usr/include -I/usr/pkg/include" comes even before our passed CFLAGS.

My /usr/pkg/lib/python2.7/distutils/command/build_ext.py:

# Put the Python "system" include dir at the end, so that # any local include dirs take precedence. self.include_dirs.append(py_include)
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)

[...]

# Finally add the user include and library directories if requested if self.user:
user_include = os.path.join(USER_BASE, "include") user_lib = os.path.join(USER_BASE, "lib")
if os.path.isdir(user_include):
self.include_dirs.append(user_include)
if os.path.isdir(user_lib):
self.library_dirs.append(user_lib) self.rpath.append(user_lib)

So it says it puts them at the end, but it doesn't do so. I've looked at Python 2.7 original source, and this is not a NetBSD port specific bug.

Quoted 2 lines

Ian.

#7 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

Quoted 111 lines · Roger Pau Monne
Quoted 53 lines · Ian Campbell
Quoted 16 lines · Roger Pau Monne
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Roger Pau Monne

genwrap.py generates _pyxl_types.c, which includes libxl.h, but if libxl.h is already present in the include search path, the old one was included instead of the new one, giving compilation errors. Since _pyxl_types.c is generated at compilation time, we can safely set the path to libxl.h include.

Quoted 8 lines
Quoted 3 lines

I've only experienced this problem when compiling Xen on NetBSD with old header files in the include path, Linux seems to not have this problem.

Should this be include<> and not "", since libxl.h isn't in the current
dir in this case?

Is the right fix to make sure that the in-tree -I lines come first? Ian.

Quoted 7 lines

Actually I'm not sure if it's possible to make sure the in-tree -I lines come first, because the gcc options are automatically generated by python build tools (distutils& friends...), so we cannot touch much of this (I've looked at distutils.core options, and it seems to be no way of setting an order on compiler options, but I'm no expert on python C extensions building), so unless we craft our own makefile to build this python stuff I think we are stuck with something like this.

Surely distutils puts user supplied options first before system options? My /usr/lib/python2.5/distutils/command/build_ext.py says:

# Put the Python "system" include dir at the end, so that
# any local include dirs take precedence. self.include_dirs.append(py_include)
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)

So it seems like this is the intention.

Are you sure this isn't just a bug in your version of distutils or something like that?

My python xl builds end up as:
building 'xl' extension
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .build.d -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -mno-tls-direct-seg-refs -fPIC -I../../tools/include -I../../tools/libxl -I../../tools/libxc -Ixen/lowlevel/xl -I/usr/include/python2.6 -c xen/lowlevel/xl/xl.c -o build/temp.linux-i686-2.6/xen/lowlevel/xl/xl.o -fno-strict-aliasing -Werror

Quoted 2 lines

Which has our local -I options before all the others -- which is sensible. What do you see with your system?

This is what I see:

CC="gcc" CFLAGS="-O1 -fno-omit-frame-pointer -m64 -g

(quoted diff) +0 -3
-fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes 
-Wdeclaration-after-statement   -D__XEN_TOOLS__ -MMD -MF .build.d 
-fno-optimize-sibling-calls" python2.7 setup.py build

running build
running build_py
running build_ext
building 'xl' extension

gcc -DNDEBUG -O2 -DHAVE_DB_185_H -I/usr/include -I/usr/pkg/include -O1

(quoted diff) +0 -5
-fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall 
-Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD 
-MF .build.d -fno-optimize-sibling-calls -fPIC -I../../tools/include 
-I../../tools/libxl -I../../tools/libxc -Ixen/lowlevel/xl 
-I/usr/pkg/include/python2.7 -c xen/lowlevel/xl/_pyxl_types.c -o 

build/temp.netbsd-6.0_BETA-amd64-2.7/xen/lowlevel/xl/_pyxl_types.o -fno-strict-aliasing -Werror

xen/lowlevel/xl/_pyxl_types.c: In function 'genwrap__init':
xen/lowlevel/xl/_pyxl_types.c:4346:78: error:
'LIBXL_EVENT_TYPE_DOMAIN_CREATE_CONSOLE_AVAILABLE' undeclared (first use in this function)
xen/lowlevel/xl/_pyxl_types.c:4346:78: note: each undeclared identifier is reported only once for each function it appears in
error: command 'gcc' failed with exit status 1
gmake: *** [build] Error 1
gmake: Leaving directory `/root/xen/xen-netbsd/tools/python'

So this part "-DNDEBUG -O2 -DHAVE_DB_185_H -I/usr/include -I/usr/pkg/include" comes even before our passed CFLAGS.

My /usr/pkg/lib/python2.7/distutils/command/build_ext.py:

# Put the Python "system" include dir at the end, so that # any local include dirs take precedence. self.include_dirs.append(py_include)
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)

[...]

# Finally add the user include and library directories if requested if self.user:
user_include = os.path.join(USER_BASE, "include") user_lib = os.path.join(USER_BASE, "lib")
if os.path.isdir(user_include):
self.include_dirs.append(user_include)
if os.path.isdir(user_lib):
self.library_dirs.append(user_lib) self.rpath.append(user_lib)

Quoted 2 lines

So it says it puts them at the end, but it doesn't do so. I've looked at Python 2.7 original source, and this is not a NetBSD port specific bug.

You are sure this is that snippet of code adding this? Where does /usr/pkg/include come from? This only appears to add one -I and you have two extra.

You aren't using some EXTRA_CFLAGS or similar are you?

Ian.

Quoted 4 lines
Quoted 3 lines

Ian.

#8 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

Quoted 120 lines · Ian Campbell
Quoted 111 lines · Roger Pau Monne
Quoted 53 lines · Ian Campbell
Quoted 16 lines · Roger Pau Monne
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Roger Pau Monne

genwrap.py generates _pyxl_types.c, which includes libxl.h, but if libxl.h is already present in the include search path, the old one was included instead of the new one, giving compilation errors. Since _pyxl_types.c is generated at compilation time, we can safely set the path to libxl.h include.

Quoted 8 lines
Quoted 3 lines

I've only experienced this problem when compiling Xen on NetBSD with old header files in the include path, Linux seems to not have this problem.

Should this be include<> and not "", since libxl.h isn't in the current
dir in this case?

Is the right fix to make sure that the in-tree -I lines come first? Ian.

Quoted 7 lines

Actually I'm not sure if it's possible to make sure the in-tree -I lines come first, because the gcc options are automatically generated by python build tools (distutils& friends...), so we cannot touch much of this (I've looked at distutils.core options, and it seems to be no way of setting an order on compiler options, but I'm no expert on python C extensions building), so unless we craft our own makefile to build this python stuff I think we are stuck with something like this.

Surely distutils puts user supplied options first before system options? My /usr/lib/python2.5/distutils/command/build_ext.py says:

# Put the Python "system" include dir at the end, so that
# any local include dirs take precedence. self.include_dirs.append(py_include)
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)

So it seems like this is the intention.

Are you sure this isn't just a bug in your version of distutils or something like that?

My python xl builds end up as:
building 'xl' extension
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .build.d -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -mno-tls-direct-seg-refs -fPIC -I../../tools/include -I../../tools/libxl -I../../tools/libxc -Ixen/lowlevel/xl -I/usr/include/python2.6 -c xen/lowlevel/xl/xl.c -o build/temp.linux-i686-2.6/xen/lowlevel/xl/xl.o -fno-strict-aliasing -Werror

Quoted 2 lines

Which has our local -I options before all the others -- which is sensible. What do you see with your system?

This is what I see:

CC="gcc" CFLAGS="-O1 -fno-omit-frame-pointer -m64 -g

(quoted diff) +0 -3
-fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes 
-Wdeclaration-after-statement   -D__XEN_TOOLS__ -MMD -MF .build.d 
-fno-optimize-sibling-calls" python2.7 setup.py build

running build
running build_py
running build_ext
building 'xl' extension

gcc -DNDEBUG -O2 -DHAVE_DB_185_H -I/usr/include -I/usr/pkg/include -O1

(quoted diff) +0 -5
-fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall 
-Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD 
-MF .build.d -fno-optimize-sibling-calls -fPIC -I../../tools/include 
-I../../tools/libxl -I../../tools/libxc -Ixen/lowlevel/xl 
-I/usr/pkg/include/python2.7 -c xen/lowlevel/xl/_pyxl_types.c -o 

build/temp.netbsd-6.0_BETA-amd64-2.7/xen/lowlevel/xl/_pyxl_types.o -fno-strict-aliasing -Werror

xen/lowlevel/xl/_pyxl_types.c: In function 'genwrap__init':
xen/lowlevel/xl/_pyxl_types.c:4346:78: error:
'LIBXL_EVENT_TYPE_DOMAIN_CREATE_CONSOLE_AVAILABLE' undeclared (first use in this function)
xen/lowlevel/xl/_pyxl_types.c:4346:78: note: each undeclared identifier is reported only once for each function it appears in
error: command 'gcc' failed with exit status 1
gmake: *** [build] Error 1
gmake: Leaving directory `/root/xen/xen-netbsd/tools/python'

So this part "-DNDEBUG -O2 -DHAVE_DB_185_H -I/usr/include -I/usr/pkg/include" comes even before our passed CFLAGS.

My /usr/pkg/lib/python2.7/distutils/command/build_ext.py:

# Put the Python "system" include dir at the end, so that # any local include dirs take precedence. self.include_dirs.append(py_include)
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)

[...]

# Finally add the user include and library directories if requested if self.user:
user_include = os.path.join(USER_BASE, "include") user_lib = os.path.join(USER_BASE, "lib")
if os.path.isdir(user_include):
self.include_dirs.append(user_include)
if os.path.isdir(user_lib):
self.library_dirs.append(user_lib) self.rpath.append(user_lib)

Quoted 2 lines

So it says it puts them at the end, but it doesn't do so. I've looked at Python 2.7 original source, and this is not a NetBSD port specific bug.

You are sure this is that snippet of code adding this? Where does /usr/pkg/include come from? This only appears to add one -I and you have two extra.

Quoted 1 line

You aren't using some EXTRA_CFLAGS or similar are you?

/usr/pkg/include comes from setting PREPEND_LIB=/usr/pkg/include when running configure.

Christoph

Quoted 4 lines

Ian.

Quoted 2 lines
Quoted 2 lines

Ian.

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
#9 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

Quoted 5 lines · Christoph Egger
Quoted 2 lines

You aren't using some EXTRA_CFLAGS or similar are you?

/usr/pkg/include comes from setting PREPEND_LIB=/usr/pkg/include when running configure.

Shouldn't you be using APPEND_LIB for this instead?

Ian.

#10 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

In reply to Christoph Egger
Quoted 119 lines · Christoph Egger
Quoted 116 lines · Ian Campbell
Quoted 109 lines · Roger Pau Monne
Quoted 52 lines · Ian Campbell
Quoted 16 lines · Roger Pau Monne
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Roger Pau Monne

genwrap.py generates _pyxl_types.c, which includes libxl.h, but if libxl.h is already present in the include search path, the old one was included instead of the new one, giving compilation errors. Since _pyxl_types.c is generated at compilation time, we can safely set the path to libxl.h include.

Quoted 8 lines
Quoted 3 lines

I've only experienced this problem when compiling Xen on NetBSD with old header files in the include path, Linux seems to not have this problem.

Should this be include<> and not "", since libxl.h isn't in the current
dir in this case?

Is the right fix to make sure that the in-tree -I lines come first? Ian.

Quoted 7 lines

Actually I'm not sure if it's possible to make sure the in-tree -I lines come first, because the gcc options are automatically generated by
python build tools (distutils& friends...), so we cannot touch much of
this (I've looked at distutils.core options, and it seems to be no way of setting an order on compiler options, but I'm no expert on python C extensions building), so unless we craft our own makefile to build this python stuff I think we are stuck with something like this.

Surely distutils puts user supplied options first before system options? My /usr/lib/python2.5/distutils/command/build_ext.py says:

# Put the Python "system" include dir at the end, so that
# any local include dirs take precedence. self.include_dirs.append(py_include)
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)

So it seems like this is the intention.

Are you sure this isn't just a bug in your version of distutils or something like that?

My python xl builds end up as:
building 'xl' extension
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .build.d -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -mno-tls-direct-seg-refs -fPIC -I../../tools/include -I../../tools/libxl -I../../tools/libxc -Ixen/lowlevel/xl -I/usr/include/python2.6 -c xen/lowlevel/xl/xl.c -o build/temp.linux-i686-2.6/xen/lowlevel/xl/xl.o -fno-strict-aliasing -Werror

Quoted 2 lines

Which has our local -I options before all the others -- which is sensible. What do you see with your system?

This is what I see:

CC="gcc" CFLAGS="-O1 -fno-omit-frame-pointer -m64 -g

(quoted diff) +0 -3
-fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes
-Wdeclaration-after-statement   -D__XEN_TOOLS__ -MMD -MF .build.d
-fno-optimize-sibling-calls" python2.7 setup.py build

running build
running build_py
running build_ext
building 'xl' extension

gcc -DNDEBUG -O2 -DHAVE_DB_185_H -I/usr/include -I/usr/pkg/include -O1

(quoted diff) +0 -5
-fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD
-MF .build.d -fno-optimize-sibling-calls -fPIC -I../../tools/include
-I../../tools/libxl -I../../tools/libxc -Ixen/lowlevel/xl
-I/usr/pkg/include/python2.7 -c xen/lowlevel/xl/_pyxl_types.c -o

build/temp.netbsd-6.0_BETA-amd64-2.7/xen/lowlevel/xl/_pyxl_types.o -fno-strict-aliasing -Werror

xen/lowlevel/xl/_pyxl_types.c: In function 'genwrap__init':
xen/lowlevel/xl/_pyxl_types.c:4346:78: error:
'LIBXL_EVENT_TYPE_DOMAIN_CREATE_CONSOLE_AVAILABLE' undeclared (first use in this function)
xen/lowlevel/xl/_pyxl_types.c:4346:78: note: each undeclared identifier is reported only once for each function it appears in
error: command 'gcc' failed with exit status 1
gmake: *** [build] Error 1
gmake: Leaving directory `/root/xen/xen-netbsd/tools/python'

So this part "-DNDEBUG -O2 -DHAVE_DB_185_H -I/usr/include -I/usr/pkg/include" comes even before our passed CFLAGS.

My /usr/pkg/lib/python2.7/distutils/command/build_ext.py:

# Put the Python "system" include dir at the end, so that # any local include dirs take precedence. self.include_dirs.append(py_include)
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)

[...]

# Finally add the user include and library directories if requested if self.user:
user_include = os.path.join(USER_BASE, "include") user_lib = os.path.join(USER_BASE, "lib")
if os.path.isdir(user_include):
self.include_dirs.append(user_include)
if os.path.isdir(user_lib):
self.library_dirs.append(user_lib) self.rpath.append(user_lib)

Quoted 2 lines

So it says it puts them at the end, but it doesn't do so. I've looked at Python 2.7 original source, and this is not a NetBSD port specific bug.

You are sure this is that snippet of code adding this? Where does /usr/pkg/include come from? This only appears to add one -I and you have two extra.

Quoted 5 lines
Quoted 1 line

You aren't using some EXTRA_CFLAGS or similar are you?

/usr/pkg/include comes from setting PREPEND_LIB=/usr/pkg/include when running configure.

Nope, it came from Python itself, if you take a look at /usr/pkg/lib/python2.7/config/Makefile there's and OPT var that gets appended to every extension build, before the user supplied flags. Let's see if the Python pkg maintainer is happy to remove "OPT", since I don't think it does anything (pkg/46459).

Quoted 7 lines

Christoph

Quoted 3 lines

Ian.

Quoted 1 line
Quoted 1 line

Ian.

#11 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

In reply to Ian Campbell
Quoted 110 lines · Ian Campbell
Quoted 109 lines · Roger Pau Monne
Quoted 52 lines · Ian Campbell
Quoted 16 lines · Roger Pau Monne
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Roger Pau Monne

genwrap.py generates _pyxl_types.c, which includes libxl.h, but if libxl.h is already present in the include search path, the old one was included instead of the new one, giving compilation errors. Since _pyxl_types.c is generated at compilation time, we can safely set the path to libxl.h include.

Quoted 8 lines
Quoted 3 lines

I've only experienced this problem when compiling Xen on NetBSD with old header files in the include path, Linux seems to not have this problem.

Should this be include<> and not "", since libxl.h isn't in the current
dir in this case?

Is the right fix to make sure that the in-tree -I lines come first? Ian.

Quoted 7 lines

Actually I'm not sure if it's possible to make sure the in-tree -I lines come first, because the gcc options are automatically generated by
python build tools (distutils& friends...), so we cannot touch much of
this (I've looked at distutils.core options, and it seems to be no way of setting an order on compiler options, but I'm no expert on python C extensions building), so unless we craft our own makefile to build this python stuff I think we are stuck with something like this.

Surely distutils puts user supplied options first before system options? My /usr/lib/python2.5/distutils/command/build_ext.py says:

# Put the Python "system" include dir at the end, so that
# any local include dirs take precedence. self.include_dirs.append(py_include)
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)

So it seems like this is the intention.

Are you sure this isn't just a bug in your version of distutils or something like that?

My python xl builds end up as:
building 'xl' extension
gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -O1 -fno-omit-frame-pointer -m32 -march=i686 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .build.d -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -mno-tls-direct-seg-refs -fPIC -I../../tools/include -I../../tools/libxl -I../../tools/libxc -Ixen/lowlevel/xl -I/usr/include/python2.6 -c xen/lowlevel/xl/xl.c -o build/temp.linux-i686-2.6/xen/lowlevel/xl/xl.o -fno-strict-aliasing -Werror

Quoted 2 lines

Which has our local -I options before all the others -- which is sensible. What do you see with your system?

This is what I see:

CC="gcc" CFLAGS="-O1 -fno-omit-frame-pointer -m64 -g

(quoted diff) +0 -3
-fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes
-Wdeclaration-after-statement   -D__XEN_TOOLS__ -MMD -MF .build.d
-fno-optimize-sibling-calls" python2.7 setup.py build

running build
running build_py
running build_ext
building 'xl' extension

gcc -DNDEBUG -O2 -DHAVE_DB_185_H -I/usr/include -I/usr/pkg/include -O1

(quoted diff) +0 -5
-fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall
-Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD
-MF .build.d -fno-optimize-sibling-calls -fPIC -I../../tools/include
-I../../tools/libxl -I../../tools/libxc -Ixen/lowlevel/xl
-I/usr/pkg/include/python2.7 -c xen/lowlevel/xl/_pyxl_types.c -o

build/temp.netbsd-6.0_BETA-amd64-2.7/xen/lowlevel/xl/_pyxl_types.o -fno-strict-aliasing -Werror

xen/lowlevel/xl/_pyxl_types.c: In function 'genwrap__init':
xen/lowlevel/xl/_pyxl_types.c:4346:78: error:
'LIBXL_EVENT_TYPE_DOMAIN_CREATE_CONSOLE_AVAILABLE' undeclared (first use in this function)
xen/lowlevel/xl/_pyxl_types.c:4346:78: note: each undeclared identifier is reported only once for each function it appears in
error: command 'gcc' failed with exit status 1
gmake: *** [build] Error 1
gmake: Leaving directory `/root/xen/xen-netbsd/tools/python'

So this part "-DNDEBUG -O2 -DHAVE_DB_185_H -I/usr/include -I/usr/pkg/include" comes even before our passed CFLAGS.

My /usr/pkg/lib/python2.7/distutils/command/build_ext.py:

# Put the Python "system" include dir at the end, so that # any local include dirs take precedence. self.include_dirs.append(py_include)
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)

[...]

# Finally add the user include and library directories if requested if self.user:
user_include = os.path.join(USER_BASE, "include") user_lib = os.path.join(USER_BASE, "lib")
if os.path.isdir(user_include):
self.include_dirs.append(user_include)
if os.path.isdir(user_lib):
self.library_dirs.append(user_lib) self.rpath.append(user_lib)

Quoted 8 lines
Quoted 2 lines

So it says it puts them at the end, but it doesn't do so. I've looked at Python 2.7 original source, and this is not a NetBSD port specific bug.

You are sure this is that snippet of code adding this? Where does /usr/pkg/include come from? This only appears to add one -I and you have two extra.

You aren't using some EXTRA_CFLAGS or similar are you?

This fault was due to the way NetBSD pkgsrc builds Python, passing OPT="-I/usr/include -I/usr/pkg/include ..." to the configure script, which then gets saved to a Makefile that is parsed by distutils and appended to the build of every extension. A bug report has already been sent:

http://mail-index.netbsd.org/pkgsrc-bugs/2012/05/17/msg047735.html

Anyway, I don't think setting libxl.h path in genwrap.py is such a bad idea, this file gets regenerated during every build, and we can make sure we are always including the correct header (which should happen automatically unless there are some underlying problems with Python, like on NetBSD).

Quoted 6 lines

Ian.

Quoted 2 lines
Quoted 2 lines

Ian.

#12 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

Quoted 6 lines · Roger Pau Monne

This fault was due to the way NetBSD pkgsrc builds Python, passing OPT="-I/usr/include -I/usr/pkg/include ..." to the configure script, which then gets saved to a Makefile that is parsed by distutils and appended to the build of every extension. A bug report has already been sent:

Quoted 7 lines

http://mail-index.netbsd.org/pkgsrc-bugs/2012/05/17/msg047735.html

Anyway, I don't think setting libxl.h path in genwrap.py is such a bad idea, this file gets regenerated during every build, and we can make sure we are always including the correct header (which should happen automatically unless there are some underlying problems with Python, like on NetBSD).

I don't much like having absolute paths in includes. Imagine I moved my source tree, then very strange errors would occur. Also it should be unnecessary unless the underlying system has some very weird properties...

The right thing is to fix the underlying python problem, which it seems you have in hand.

I considered suggesting using a relative include here but I expect it would get resolved relative to each of the -I options in turn (e.g. /usr/include/../libxl/libxl.h or whatever) which would be even worse IMHO.

Ian.

#13 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

Quoted 15 lines · Ian Campbell
Quoted 6 lines · Roger Pau Monne

This fault was due to the way NetBSD pkgsrc builds Python, passing OPT="-I/usr/include -I/usr/pkg/include ..." to the configure script, which then gets saved to a Makefile that is parsed by distutils and appended to the build of every extension. A bug report has already been sent:

Quoted 7 lines

http://mail-index.netbsd.org/pkgsrc-bugs/2012/05/17/msg047735.html

Anyway, I don't think setting libxl.h path in genwrap.py is such a bad idea, this file gets regenerated during every build, and we can make sure we are always including the correct header (which should happen automatically unless there are some underlying problems with Python, like on NetBSD).

Quoted 4 lines

I don't much like having absolute paths in includes. Imagine I moved my source tree, then very strange errors would occur. Also it should be unnecessary unless the underlying system has some very weird properties...

So at least the correct fix would be to replace

#include "libxl.h"

with

#include <libxl.h>

right?

Quoted 2 lines

The right thing is to fix the underlying python problem, which it seems you have in hand.

Yes, I've send a PR, but the python port seems to have no specific maintainer, so I don't know how long it will take before someone picks it up...

Quoted 10 lines

I considered suggesting using a relative include here but I expect it would get resolved relative to each of the -I options in turn (e.g. /usr/include/../libxl/libxl.h or whatever) which would be even worse IMHO.

Ian.

#14 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

Quoted 23 lines · Roger Pau Monne
Quoted 15 lines · Ian Campbell
Quoted 6 lines · Roger Pau Monne

This fault was due to the way NetBSD pkgsrc builds Python, passing OPT="-I/usr/include -I/usr/pkg/include ..." to the configure script, which then gets saved to a Makefile that is parsed by distutils and appended to the build of every extension. A bug report has already been sent:

Quoted 7 lines

http://mail-index.netbsd.org/pkgsrc-bugs/2012/05/17/msg047735.html

Anyway, I don't think setting libxl.h path in genwrap.py is such a bad idea, this file gets regenerated during every build, and we can make sure we are always including the correct header (which should happen automatically unless there are some underlying problems with Python, like on NetBSD).

Quoted 4 lines

I don't much like having absolute paths in includes. Imagine I moved my source tree, then very strange errors would occur. Also it should be unnecessary unless the underlying system has some very weird properties...

So at least the correct fix would be to replace

Quoted 7 lines

#include "libxl.h"

with

#include <libxl.h>

right?

I think it ould be strictly speaking correct to make that change, although I'm not sure it would make a difference unless there was another libxl.h in tools/python somewhere.

Quoted 6 lines
Quoted 2 lines

The right thing is to fix the underlying python problem, which it seems you have in hand.

Yes, I've send a PR, but the python port seems to have no specific maintainer, so I don't know how long it will take before someone picks it up...

OK.

Ian.

#15 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

In reply to Roger Pau Monne

Roger Pau Monne writes ("[PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c"):

Quoted 5 lines

genwrap.py generates _pyxl_types.c, which includes libxl.h, but if libxl.h is already present in the include search path, the old one was included instead of the new one, giving compilation errors. Since _pyxl_types.c is generated at compilation time, we can safely set the path to libxl.h include.

I'm not sure what you mean by "the old one". Do you mean one in /usr/include ?

Quoted 3 lines

I've only experienced this problem when compiling Xen on NetBSD with old header files in the include path, Linux seems to not have this problem.

The build system should make sure that our own include directories come before system directories. Otherwise various other things aren't going to work either.

Ian.

#16 lore raw

Re: [PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c

Quoted 9 lines · Ian Jackson

Roger Pau Monne writes ("[PATCH v2 3/4] python: set absolute path to libxl.h on _pyxl_types.c"):

Quoted 5 lines

genwrap.py generates _pyxl_types.c, which includes libxl.h, but if libxl.h is already present in the include search path, the old one was included instead of the new one, giving compilation errors. Since _pyxl_types.c is generated at compilation time, we can safely set the path to libxl.h include.

I'm not sure what you mean by "the old one". Do you mean one in /usr/include ?

Yes, in NetBSD case the ones in /usr/pkg/include, that's where Xen headers would reside on a normal installation.

Quoted 8 lines
Quoted 4 lines

I've only experienced this problem when compiling Xen on NetBSD with old header files in the include path, Linux seems to not have this problem.

The build system should make sure that our own include directories come before system directories. Otherwise various other things aren't going to work either.

This only happened when building python extensions because the port build of python passes "OPT" to python configure that contains -I/usr/pkg/include. And that is used also when building extensions. A bug report is in place. The rest of the build system is fine.

Quoted 1 line

Ian.

#17 lore raw

PATCH v2 4/4 tools/build: change order of config/Tools.mk inclusion

In reply to Roger Pau Monne

Tools.mk contains variables that should be used when processing the top level Config.mk for the tools, specially the CONFIG_DIR variable, which is not honoring the PREFIX variable correctly, since when CONFIG_DIR is set the PREFIX var is still not defined.

Including config/Tools.mk before any other includes ensures that user-set options will be honored.

Cc Ian Jackson <[email protected]>
Cc Christoph Egger <[email protected]>
---
 tools/Rules.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/Rules.mk +1 -1
index a2a1a58..5ded544 100644
@@ -3,8 +3,8 @@
 # `all' is the default target
 all:
 
-include $(XEN_ROOT)/Config.mk
 -include $(XEN_ROOT)/config/Tools.mk
+include $(XEN_ROOT)/Config.mk
 
 export _INSTALL := $(INSTALL)
 INSTALL = $(XEN_ROOT)/tools/cross-install
Signature · 1 line
1.7.7.5 (Apple Git-26)
#18 lore raw

Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion

Roger Pau Monne writes ("[PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion"):

Quoted 4 lines

Tools.mk contains variables that should be used when processing the top level Config.mk for the tools, specially the CONFIG_DIR variable, which is not honoring the PREFIX variable correctly, since when CONFIG_DIR is set the PREFIX var is still not defined.

I'm not sure I really understand how PREFIX is supposed to work.

In a normal package PREFIX would be set to /usr, /usr/local, /opt, or whatever, by the person doing the installation.

The code in StdGNU.mk seems to be capable of generating paths like
/usr/local/var/run/xen
which is a bit mad.

Also PREFIX is set in StdGNU.mk. Why is it also set in Tools.mk ?

Ian.

#19 lore raw

Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion

Quoted 6 lines · Ian Jackson

Roger Pau Monne writes ("[PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion"):

Quoted 4 lines

Tools.mk contains variables that should be used when processing the top level Config.mk for the tools, specially the CONFIG_DIR variable, which is not honoring the PREFIX variable correctly, since when CONFIG_DIR is set the PREFIX var is still not defined.

Quoted 8 lines

I'm not sure I really understand how PREFIX is supposed to work.

In a normal package PREFIX would be set to /usr, /usr/local, /opt, or whatever, by the person doing the installation.

The code in StdGNU.mk seems to be capable of generating paths like
/usr/local/var/run/xen
which is a bit mad.

Not so much, NetBSD has /usr/pkg/etc for example, for configuration of packages installed from ports.

Maybe adding the following to config/Linux.mk would be suitable:

XEN_LOCK_DIR = /var/lib
XEN_RUN_DIR = /var/run/xen
XEN_PAGING_DIR = /var/lib/xen/xenpaging
CONFIG_DIR = /etc

So we don't end up putting those under /usr/local or some strange user supplied path.

Quoted 1 line

Also PREFIX is set in StdGNU.mk. Why is it also set in Tools.mk ?

Configure scripts have a very common option, --prefix, which is saved into Tools.mk as PREFIX, this is what should be used as prefix for installation.

#20 lore raw

Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion

Roger Pau Monne writes ("Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion"):

Quoted 6 lines
Quoted 1 line · Ian Jackson

Also PREFIX is set in StdGNU.mk. Why is it also set in Tools.mk ?

Configure scripts have a very common option, --prefix, which is saved into Tools.mk as PREFIX, this is what should be used as prefix for installation.

I know that. But given that the configure is just for the tools build, should we honour PREFIX from Config.mk (and ./.config or command line arguments) or from ./configure ?

Ian.

#21 lore raw

Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion

Quoted 11 lines · Ian Jackson

Roger Pau Monne writes ("Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion"):

Quoted 6 lines
Quoted 1 line · Ian Jackson

Also PREFIX is set in StdGNU.mk. Why is it also set in Tools.mk ?

Configure scripts have a very common option, --prefix, which is saved into Tools.mk as PREFIX, this is what should be used as prefix for installation.

I know that. But given that the configure is just for the tools build, should we honour PREFIX from Config.mk (and ./.config or command line arguments) or from ./configure ?

The one from configure. The point is that the other path variables also honour the prefix from configure.

Christoph

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
#22 lore raw

Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion

In reply to Ian Jackson
Quoted 10 lines · Ian Jackson

Roger Pau Monne writes ("Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion"):

Quoted 5 lines
Quoted 1 line · Ian Jackson

Also PREFIX is set in StdGNU.mk. Why is it also set in Tools.mk ?

Configure scripts have a very common option, --prefix, which is saved into Tools.mk as PREFIX, this is what should be used as prefix for installation.

I know that. But given that the configure is just for the tools build, should we honour PREFIX from Config.mk (and ./.config or command line arguments) or from ./configure ?

I think the one from configure, since we have a configure script, better make use of it, that is what users expect. I will resend this patch with the above changes to config/Linux.mk, is that ok?

#23 lore raw

Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion

Roger Pau Monne writes ("Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion"):

Quoted 7 lines
Quoted 3 lines · Ian Jackson

I know that. But given that the configure is just for the tools build, should we honour PREFIX from Config.mk (and ./.config or command line arguments) or from ./configure ?

I think the one from configure, since we have a configure script, better make use of it, that is what users expect.

I guess so.

Quoted 2 lines

I will resend this patch with the above changes to config/Linux.mk, is that ok?

I don't think prefixing paths in /var with PREFIX is ever right. Overriding it in Linux.mk seems like a band-aid.

Ian.

#24 lore raw

Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion

Quoted 9 lines · Ian Jackson

Roger Pau Monne writes ("Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion"):

Quoted 7 lines
Quoted 3 lines · Ian Jackson

I know that. But given that the configure is just for the tools build, should we honour PREFIX from Config.mk (and ./.config or command line arguments) or from ./configure ?

I think the one from configure, since we have a configure script, better make use of it, that is what users expect.

Quoted 7 lines

I guess so.

Quoted 2 lines

I will resend this patch with the above changes to config/Linux.mk, is that ok?

I don't think prefixing paths in /var with PREFIX is ever right. Overriding it in Linux.mk seems like a band-aid.

One suggestion:

Move all path variables out of config/*.mk and let configure generate a config/paths.mk.

Christoph

Signature · 6 lines
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
#25 lore raw

Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion

Quoted 13 lines · Christoph Egger
Quoted 11 lines · Ian Jackson

Roger Pau Monne writes ("Re: [PATCH v2 4/4] tools/build: change order of config/Tools.mk inclusion"):

Quoted 6 lines
Quoted 3 lines · Ian Jackson

I know that. But given that the configure is just for the tools build, should we honour PREFIX from Config.mk (and ./.config or command line arguments) or from ./configure ?

I think the one from configure, since we have a configure script, better make use of it, that is what users expect.

I guess so.

Quoted 2 lines

I will resend this patch with the above changes to config/Linux.mk, is that ok?

Quoted 8 lines
Quoted 2 lines

I don't think prefixing paths in /var with PREFIX is ever right. Overriding it in Linux.mk seems like a band-aid.

One suggestion:

Move all path variables out of config/*.mk and let configure generate a config/paths.mk.

What should we do about this? Should I try to fix StdGNU.mk/Linux.mk/NetBSD.mk or are we going to move all paths from config/*.mk and put them in a single file generated by configure?

Acked-by on v2 1/4
#26 lore raw
In reply to Roger Pau Monne
Quoted 23 lines · Roger Pau Monne

NetBSD doesn't have a gntdev, so libvchan is unable to build due to the lack of the header files gntalloc.h.

This is the error:

gcc -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing

(quoted diff) +0 -7
-std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement
-D__XEN_TOOLS__ -MMD -MF .init.o.d -fno-optimize-sibling-calls
-I../include -I.
-I/root/xen/xen-netbsd/tools/libvchan/../../tools/xenstore
-I/root/xen/xen-netbsd/tools/libvchan/../../tools/include
-I/root/xen/xen-netbsd/tools/libvchan/../../tools/libxc
-I/root/xen/xen-netbsd/tools/libvchan/../../tools/include  -c -o

init.o init.c
init.c:45:30: fatal error: xen/sys/gntalloc.h: No such file or directory
compilation terminated.
gmake[3]: *** [init.opic] Error 1
gmake[3]: *** Waiting for unfinished jobs.... init.c:45:30: fatal error: xen/sys/gntalloc.h: No such file or directory
compilation terminated.

Quoted 2 lines
Quoted 17 lines
---
 tools/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/Makefile +1 -1
index 7b14678..fbdf716 100644
@@ -30,7 +30,7 @@ SUBDIRS-$(CONFIG_NetBSD) += blktap2
 SUBDIRS-$(CONFIG_NetBSD) += xenbackendd
 SUBDIRS-y += libfsimage
 SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
-SUBDIRS-y += libvchan
+SUBDIRS-$(CONFIG_Linux) += libvchan
 
 # do not recurse in to a dir we are about to delete
 ifneq "$(MAKECMDGOALS)" "distclean"