This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pyconfig.h is not placed in --includedir
Type: behavior Stage: needs patch
Components: Installation Versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, goeran, loewis, lotheac, morth
Priority: low Keywords: patch

Created on 2004-02-13 08:24 by goeran, last changed 2022-04-11 14:56 by admin.

Files
File name Uploaded Description Edit
pyconfig-includedir.patch lotheac, 2014-09-05 19:41 review
Messages (8)
msg19983 - (view) Author: Göran Uddeborg (goeran) Date: 2004-02-13 08:24
When configuring Python with an explicit --includedir
most of the header files do turn up in this directory.
 But the pyconfig.h is still placed in $(prefix)/include.

I assume it is a bug, and this file too should be
placed according to --includedir.
msg19984 - (view) Author: Pelle Johansson (morth) Date: 2004-10-23 13:52
Logged In: YES 
user_id=180081

Actually, pyconfig.h is placed in $(exec-prefix)/include.
This is fine as the file is architecture dependant.
However the other header files use a local
#include "pyconfig.h"
which will not match if it's not the same dir. If you like
me want a common directory for all archindependant files and
then separate for each arch it causes additional headache,
since there's no easy way for me to symlink from the arch
include/ dir to the archindependant, as they have a common
subdir (python2.3/ in my case).

Currently it seems I'll have to symlink each header file
individually from the archindependent dir to the arch ones.
Ideally pyconfig.h would be put directly in
$(exec-prefix)/include/ and be refered to as <pyconfig.h>. I
could then just symlink the subdir.

Whether to honor includedir or not I don't know, I'll leave
that problem to the project.
msg19985 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-12 08:05
Logged In: YES 
user_id=21627

I don't think I will do anything about this anytime soon, so
unassigning myself.
msg59177 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-03 23:33
I'm able to reproduce the bug with 2.6
msg114322 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-19 05:50
Is this still a problem, sorry I don't have a box to test it on?
msg114420 - (view) Author: Göran Uddeborg (goeran) Date: 2010-08-20 08:33
I tried by building Python 3.1.2 with the configuration

... --prefix=$home/ptest --includedir=$home/ptest/myspecialincludedir

pyconfig.h still wound up in $prefix/include/python3.1, while all other header files were correctly placed in $prefix/myspecialincludedir/python3.1.

So yes, it is still a problem.
msg192579 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-07 18:37
I found the reason for the issue. pyconfig.h is installed to CONFINCLUDEPY. The other header files are copied to INCLUDEPY

INCLUDEDIR=     @includedir@
CONFINCLUDEDIR= $(exec_prefix)/include

INCLUDEPY=      $(INCLUDEDIR)/python$(LDVERSION)
CONFINCLUDEPY=  $(CONFINCLUDEDIR)/python$(LDVERSION)


        @for i in $(srcdir)/Include/*.h; \
        do \
                echo $(INSTALL_DATA) $$i $(INCLUDEPY); \
                $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \
        done
        $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h
msg226448 - (view) Author: Lauri Tirkkonen (lotheac) Date: 2014-09-05 19:41
Patch attached to set CONFINCLUDEDIR to --includedir. There's additionally some hardcoded assumptions in sysconfig and distutils.sysconfig about the include paths, of which this patch fixes some.

What it doesn't address is sysconfig.get_path with 'include' or 'platinclude'. There 'include', however, were already broken if python was configured with --includedir ('platinclude' was correct because it was hardcoded, and pyconfig.h always installed to the same place). I think those should also be fixable by getting the correct directories from _sysconfigdata instead of hardcoding possible 'installation schemes' and trying some de-facto paths based on those. I suspect this is also a problem for library paths, but this issue is only concerned with includedir.

I suspect the problem that 'CONFINCLUDEDIR' was trying to solve is separating platform-dependent headers from platform-independent ones, but it doesn't actually solve that problem correctly: pyconfig.h does not go in --includedir AND the hardcoded include path for pyconfig.h doesn't go in "python-config --includes" output.
History
Date User Action Args
2022-04-11 14:56:02adminsetgithub: 39936
2020-07-03 05:43:58ned.deilysetnosy: - Mario Gonzalez
2020-07-03 05:41:06ned.deilysetmessages: - msg372730
2020-07-01 04:25:57Mario Gonzalezsetnosy: + Mario Gonzalez
messages: + msg372730
2014-09-05 19:41:35lotheacsetfiles: + pyconfig-includedir.patch

nosy: + lotheac
messages: + msg226448

keywords: + patch
2014-02-03 17:05:53BreamoreBoysetnosy: - BreamoreBoy
2013-07-07 18:37:31christian.heimessetstage: needs patch
messages: + msg192579
versions: + Python 3.3, Python 3.4, Python 3.5
2010-08-20 08:33:34goeransetmessages: + msg114420
2010-08-19 05:50:40BreamoreBoysetnosy: + BreamoreBoy

messages: + msg114322
versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6, Python 3.0
2009-02-14 11:32:18ajaksu2settype: behavior
2008-01-03 23:33:54christian.heimessetpriority: normal -> low
nosy: + christian.heimes
messages: + msg59177
severity: normal -> minor
versions: + Python 2.6, Python 3.0, - Python 2.2
2004-02-13 08:24:58goerancreate