After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 509023 - Incorrect assumptions about locations of python headers/libs
Incorrect assumptions about locations of python headers/libs
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Compilation
1.8.x
Other All
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2008-01-12 20:59 UTC by Daniel Macks
Modified: 2008-01-14 19:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Get -I and -L paths from python itself (1.42 KB, patch)
2008-01-12 21:38 UTC, Daniel Macks
needs-work Details | Review
More flexible over-riding opportunities (1.43 KB, patch)
2008-01-13 00:52 UTC, Daniel Macks
none Details | Review

Description Daniel Macks 2008-01-12 20:59:47 UTC
gnumeric-1.8.0 configure makes some non-portable assumptions about how python installed (certain specific subdirs of sys.prefix), and as a result needs lots of manual intervention (env vars) to get the python headers and libraries accessed correctly. Instead of assuming a certain filesystem layout, much simpler to just query python itself, which already knows the location of the headers and library (on *all* platforms, including I presume win32, and even if python was installed in a non-standard way).

The directory containing the python headers is:

distutils.sysconfig.get_python_inc()

and the directory containing the libpython shared library is:

distutils.sysconfig.get_config_var("LIBPL")
Comment 1 Daniel Macks 2008-01-12 21:38:15 UTC
Created attachment 102690 [details] [review]
Get -I and -L paths from python itself
Comment 2 Jody Goldberg 2008-01-12 22:36:54 UTC
Unfortunately we can't do that.  It breaks win32 cross compilation, which is the only way we do a windows build just now.   An acceptable alternative would be to use python to extract the paths by default, but allow the env vars to override that.
Comment 3 Daniel Macks 2008-01-12 22:57:24 UTC
I don't know the details of the cross-compiling you are doing, but PY_PREFIX is not used except for setting PY_INCLUDE_DIR and PY_LIB_DIR, and I intentionally did leave those two variables overrideable by the shell. Thus the include and lib paths could be set to whatever cross-compiling locations are needed (libs/ instead of lib/, some non-standard headers location, etc).
Comment 4 Morten Welinder 2008-01-13 00:19:21 UTC
These are the lines you should concentrate on:

PY_INCLUDE_DIR="$PY_PREFIX/include/python$PY_VERSION"
PY_LIB_DIR="$PY_PREFIX/lib"

They can go and ask python if that is useful, but everything needs to be
overrideable for any kind of cross compilation -- the compile system's
python simply cannot know about the target system's python.
Comment 5 Daniel Macks 2008-01-13 00:52:14 UTC
Created attachment 102699 [details] [review]
More flexible over-riding opportunities

My original patch allows complete over-riding and ignoring of the compile-system's python using PY_INCLUDE_DIR and PY_LIB_DIR exactly as in the existing configure script (the compile machine's python is interrogated *only if* those variables are not already set). If you prefer to keep PY_PREFIX as an alternative as well, here's the more limited patch.
Comment 6 Daniel Macks 2008-01-13 00:55:39 UTC
NB, my patches also include fix for Bug #508988...that breakage interfered with my ability to test the situation at hand here.
Comment 7 Morten Welinder 2008-01-14 00:45:27 UTC
Visually looks fine to me, except for this:

-    GNM_PY_CFLAGS="-I $PY_INCLUDE_DIR $PYGOBJECT_CFLAGS"
-    GNM_PY_LDFLAGS="-L $PY_LIB_DIR -lpython$PY_VERSION $PYGOBJECT_LDFLAGS"
+    GNM_PY_CFLAGS="-I$PY_INCLUDE_DIR $PYGOBJECT_CFLAGS"
+    GNM_PY_LDFLAGS="-L$PY_LIB_DIR -lpython$PY_VERSION $PYGOBJECT_LIBS"

Is there a reason for mucking with the whitespace that I cannot think of?
Comment 8 Daniel Macks 2008-01-14 05:10:38 UTC
> Is there a reason for mucking with the whitespace that I cannot think of?
> 

Please read Comment #6.
Comment 9 Morten Welinder 2008-01-14 19:11:20 UTC
Your patch didn't apply cleanly, so I had to hand-edit a bit.


This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.