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: Specifying multiple lib and include directories on linux
Type: enhancement Stage:
Components: Build, Installation, macOS Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: Arfrever, eric.araujo, loewis, ronaldoussoren, rpq
Priority: normal Keywords: patch

Created on 2011-11-30 20:07 by rpq, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
setup.py.diff rpq, 2011-11-30 20:24
Messages (14)
msg148681 - (view) Author: Ray (rpq) Date: 2011-11-30 20:07
For ./configure, --includedir and --libdir both cannot handle multiple packages. 

e.g. 

/configure --includedir=/home/user/.local/sqlite3-3.7.9/include --includedir=/home/user/.local/readline-6.2/include --libdir=/home/user/.local/sqlite3-3.7.9/lib --libdir=/home/user/.local/readline-6.2/lib

and 

/configure --includedir="/home/user/.local/sqlite3-3.7.9/include /home/user/.local/readline-6.2/include" --libdir="/home/user/.local/sqlite3-3.7.9/lib /home/user/.local/readline-6.2/lib"

The only way I could get the desired functionality was to set CFLAGS and LDFLAGS:

export CFLAGS="-I/home/user/.local/readline-6.2/include/ -I/home/user/.local/sqlite3-3.7.9/include/" && export LDFLAGS="-L/home/user/.local/readline-6.2/lib/ -L/home/user/.local/sqlite3-3.7.9/lib/"
msg148683 - (view) Author: Ray (rpq) Date: 2011-11-30 20:24
I should mention, I had to modify setup.py in order for the export line in my original post to work on my linux machine.
msg148806 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-12-03 14:59
> For ./configure, --includedir and --libdir both cannot handle multiple packages.
I see “packages” means “directories” here.  Is it a standard configure feature to support multiple --includedir and --libdir?  Does it work if you pass --includedir one:two instead?  Links would be welcome.
msg148948 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2011-12-07 02:01
You should request this new feature on autoconf@gnu.org or bug-autoconf@gnu.org mailing list.
msg149045 - (view) Author: Ray (rpq) Date: 2011-12-08 17:22
Compiling using the includedir/libdir flags with colon as separators for the multiple directories got me an error after performing 'make':

Makefile:782: *** target pattern contains no `%'.  Stop.

Additionally, I would like to emphasize the fact that I could not find another way to specify multiple lib and include directories when compiling Python 2.7 on Linux using the current setup.py.
msg150003 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-12-21 16:04
You haven’t answered my question: Is it a standard configure feature to support multiple --includedir and --libdir?

If it’s a standard feature used by people, then you can argue it’s a build bug for all active versions (2.7, 3.2, 3.3).

If it’s a request for something specific to CPython, then as a new feature it would go into 3.3 only.
msg150007 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2011-12-21 16:15
Parsing of options is implemented inside autoconf. The feature would have to be implemented in autoconf and then 'configure' would have to be regenerated from 'configure.in' using new version of autoconf.
msg150178 - (view) Author: Ray (rpq) Date: 2011-12-23 16:12
Whether or not includedir and libdir are supposed to allow multiple packages is beyond me at this point so I'll change the topic to more reflect the problem I am having.  More importantly (and possibly related to includedir and libdir) is the fact that python 2.7 does not allow specifying multiple lib and include directories in linux.  Is there one way to do this that I overlooked? I included the bit about includedir, libdir, CFLAGS, and LDFLAGS in my original post to show what I tried.  

Is it a standard for CFLAGS AND LDFLAGS to accept multiple directories? I would think so.  With the current python 2.7 and linux, that simply does not work.  But it does for darwin platforms?

From setup.py:

>         if platform == 'darwin':
>             # This should work on any unixy platform ;-)
>             # If the user has bothered specifying additional -I and -L flags
>             # in OPT and LDFLAGS we might as well use them here.
msg150464 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-01-02 17:11
> Whether or not includedir and libdir are supposed to allow multiple packages is beyond me at this
> point so I'll change the topic to more reflect the problem I am having.  More importantly (and
> possibly related to includedir and libdir) is the fact that python 2.7 does not allow specifying
> multiple lib and include directories in linux.  Is there one way to do this that I overlooked? I
> included the bit about includedir, libdir, CFLAGS, and LDFLAGS in my original post to show what I
> tried.

At present I know less than you about these.  Maybe Martin can chime in?

If it’s not possible to use multiple directories to configure Python, then it’s a limitation, and changing it would qualify as a new feature given our policy, and as such be inappropriate for 2.7.
msg150687 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-01-05 20:48
See http://www.gnu.org/software/autoconf/manual/autoconf.html
for a description of the includedir and libdir options:

— Variable: includedir
The directory for installing C header files.
— Variable: libdir
The directory for installing object code libraries.

So it just doesn't make sense to have multiple directories in these options, and you shouldn't be passing directories that that you want to be searched.

Closing this report as invalid.
msg150737 - (view) Author: Ray (rpq) Date: 2012-01-06 16:33
Martin, did you read my last post? Did you read the updated topic? libdir and includedir are *not* the issue.

So it makes sense to allow configuring multiple directories for python installation for darwin but not linux? Why?
msg150774 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-01-06 22:16
No, I only read the original message. I find it too tedious to read the entire set of messages just to find out what the issue may be. If an issue has sufficiently deviated from the original report, it is better closed, and a new issue is opened.

Even after scanning the messages, I still cannot figure out what the issue is. Your last message is particularly mysterious to me.

So if you think there still is an issue, please report a new one. Make sure to include reproducable test cases, and a clear statement of what you expected to happen (in addition to reporting what actually happened).
msg150788 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2012-01-07 10:52
He's probably referring to this fragment in setup.py:


        if platform == 'darwin':
            # This should work on any unixy platform ;-)
            # If the user has bothered specifying additional -I and -L flags
            # in OPT and LDFLAGS we might as well use them here.
            #   NOTE: using shlex.split would technically be more correct, but
            # also gives a bootstrap problem. Let's hope nobody uses directories
            # with whitespace in the name to store libraries.
            cflags, ldflags = sysconfig.get_config_vars(
                    'CFLAGS', 'LDFLAGS')
            for item in cflags.split():
                if item.startswith('-I'):
                    inc_dirs.append(item[2:])
            for item in ldflags.split():
                if item.startswith('-L'):
                    lib_dirs.append(item[2:])


The entire block was added when I worked on the Mac port with Jack Jansen.  It ensures that additional include and lib directories specified through the 'OPT' and 'LDFLAGS' shell variables get added to the search path used by distutils.

As the comment says this should be safe all unity platforms, not just OSX.  IIRC the platform test is there because we couldn't easily test on other platforms and didn't want to accidentally break stuff (this was before we had a good buildbot setup).
msg152886 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-02-08 16:35
Ronald, is “unity platforms” a typo for “unixy platforms”?  IOW, are you expressing a +1 to the feature request, despite Martin’s rejection (with which I agree)?
History
Date User Action Args
2022-04-11 14:57:24adminsetgithub: 57720
2012-02-08 16:35:32eric.araujosetmessages: + msg152886
2012-01-07 10:52:34ronaldoussorensetmessages: + msg150788
2012-01-06 22:16:18loewissetmessages: + msg150774
2012-01-06 16:33:43rpqsetmessages: + msg150737
2012-01-05 20:48:21loewissetstatus: open -> closed
resolution: not a bug
messages: + msg150687
2012-01-02 17:11:25eric.araujosetnosy: + loewis

messages: + msg150464
versions: - Python 2.7
2011-12-23 16:12:38rpqsettitle: Let ./configure accept multiple --includedir and --libdir options -> Specifying multiple lib and include directories on linux
messages: + msg150178
versions: + Python 2.7
2011-12-21 16:15:44Arfreversetmessages: + msg150007
2011-12-21 16:04:39eric.araujosettype: behavior -> enhancement
title: ./configure --includedir, --libdir accept multiple -> Let ./configure accept multiple --includedir and --libdir options
messages: + msg150003
versions: - Python 2.7
2011-12-08 17:22:08rpqsetmessages: + msg149045
2011-12-07 02:01:01Arfreversetnosy: + Arfrever
messages: + msg148948
2011-12-03 14:59:23eric.araujosetnosy: + eric.araujo
messages: + msg148806
2011-11-30 20:24:09rpqsetfiles: + setup.py.diff
keywords: + patch
messages: + msg148683
2011-11-30 20:07:40rpqcreate