Re: [Xen-devel] [PATCH v2 3/4] m4/python: fix checks for Python library support

2016-03-01 Thread Ian Jackson
Doug Goldstein writes ("Re: [PATCH v2 3/4] m4/python: fix checks for Python 
library support"):
> You need to put your libraries after the sources. e.g.
> gcc -W -march=native -Llibs -o program program.c -lm -lcustom

Of course.  I really was quite thick last week!  I have queued this
patch now.

Acked-by: Ian Jackson 

Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v2 3/4] m4/python: fix checks for Python library support

2016-02-22 Thread Doug Goldstein
On 2/22/16 10:22 AM, Ian Jackson wrote:
> Doug Goldstein writes ("[PATCH v2 3/4] m4/python: fix checks for Python 
> library support"):
>> AC_CHECK_LIB() was running gcc -Llib -lm -lutils conftest.c which on
>> platforms that do as needed operations by default will result in
>> underlinking. Instead AC_CHECK_LIB() suggests supplying the extra
>> libraries necessary in a 5th argument.
> 
> I'm afraid I don't quite follow why the code in the patch has the
> effect you desire.  Why does setting LDFLAGS not work ?  Forgive me if
> I'm being dense - I'm afraid I have a cold.
> 
> Regards,
> Ian.
> 

In fact this pattern is repeated all over the code base in makefiles:

libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
$(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG)
-Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
$(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab)
$(LDLIBS_libxengntshr) $(LDLIBS_libxencall)
$(LDLIBS_libxenforeignmemory) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)


COMPILER CFLAGS/LDFLAGS -o TARGET SOURCE LIBS


-- 
Doug Goldstein



signature.asc
Description: OpenPGP digital signature
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v2 3/4] m4/python: fix checks for Python library support

2016-02-22 Thread Doug Goldstein
On 2/22/16 10:22 AM, Ian Jackson wrote:
> Doug Goldstein writes ("[PATCH v2 3/4] m4/python: fix checks for Python 
> library support"):
>> AC_CHECK_LIB() was running gcc -Llib -lm -lutils conftest.c which on
>> platforms that do as needed operations by default will result in
>> underlinking. Instead AC_CHECK_LIB() suggests supplying the extra
>> libraries necessary in a 5th argument.
> 
> I'm afraid I don't quite follow why the code in the patch has the
> effect you desire.  Why does setting LDFLAGS not work ?  Forgive me if
> I'm being dense - I'm afraid I have a cold.
> 
> Regards,
> Ian.
> 

You need to put your libraries after the sources. e.g.

gcc -W -march=native -Llibs -o program program.c -lm -lcustom

Not before. That's why there's a difference between LIBS and LDFLAGS.
The proper order is:

COMPILER CFLAGS LDFLAGS SOURCES LIBS

The reason is the compiler reduces the symbols to only the symbols used
in each stage. By putting the libraries first the symbols are all
reduced out and the result is a compiler failure.

I can link you to the Gentoo docs on this:
https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed#Failure_in_..2Fconfigure


-- 
Doug Goldstein



signature.asc
Description: OpenPGP digital signature
___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v2 3/4] m4/python: fix checks for Python library support

2016-02-22 Thread Ian Jackson
Doug Goldstein writes ("[PATCH v2 3/4] m4/python: fix checks for Python library 
support"):
> AC_CHECK_LIB() was running gcc -Llib -lm -lutils conftest.c which on
> platforms that do as needed operations by default will result in
> underlinking. Instead AC_CHECK_LIB() suggests supplying the extra
> libraries necessary in a 5th argument.

I'm afraid I don't quite follow why the code in the patch has the
effect you desire.  Why does setting LDFLAGS not work ?  Forgive me if
I'm being dense - I'm afraid I have a cold.

Regards,
Ian.

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 3/4] m4/python: fix checks for Python library support

2016-02-18 Thread Doug Goldstein
AC_CHECK_LIB() was running gcc -Llib -lm -lutils conftest.c which on
platforms that do as needed operations by default will result in
underlinking. Instead AC_CHECK_LIB() suggests supplying the extra
libraries necessary in a 5th argument.

Signed-off-by: Doug Goldstein 
---
CC: Ian Jackson 
CC: Stefano Stabellini 
CC: Ian Campbell 
CC: Wei Liu 

change since v1:
- don't screw up the white space
---
 m4/python_devel.m4 | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/m4/python_devel.m4 b/m4/python_devel.m4
index deff19e..05ea4ef 100644
--- a/m4/python_devel.m4
+++ b/m4/python_devel.m4
@@ -10,9 +10,9 @@ AS_IF([test x"$pyconfig" = x"no"], [
 print "-I" + distutils.sysconfig.get_config_var("INCLUDEPY")'`"
 CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \
 print distutils.sysconfig.get_config_var("CFLAGS")'`"
-LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+PYTHON_LIBS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
 print distutils.sysconfig.get_config_var("LIBS")'`"
-LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
+PYTHON_LIBS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
 print distutils.sysconfig.get_config_var("SYSLIBS")'`"
 LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
 print "-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
@@ -25,12 +25,14 @@ AS_IF([test x"$pyconfig" = x"no"], [
 dnl If python-config is found use it
 CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
 LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
+PYTHON_LIBS="$LIBS `$PYTHON-config --libs`"
 ])
 
 AC_CHECK_HEADER([Python.h], [],
 [AC_MSG_ERROR([Unable to find Python development headers])],)
 AC_CHECK_LIB(python$ac_python_version, PyArg_ParseTuple, [],
-[AC_MSG_ERROR([Unable to find a suitable python development library])])
+[AC_MSG_ERROR([Unable to find a suitable python development library])],
+[$PYTHON_LIBS])
 CPPFLAGS=$ac_previous_cppflags
 LDFLAGS=$ac_previous_ldflags
 ])
-- 
2.4.10


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel