|
Boost-Build : |
Subject: Re: [Boost-build] Building Boost with multiple python versions
From: Edward Diener (eldiener_at_[hidden])
Date: 2017-02-15 00:20:21
On 2/14/2017 6:15 PM, Stefan Seefeld via Boost-build wrote:
> On 13.02.2017 23:53, Rene Rivera via Boost-build wrote:
>> Warning: This is only a quick reply after some investigation. I would
>> have to delve deeper to figure out more of the why things are the way
>> they are (for better or worse)..
>>
>> On Mon, Feb 13, 2017 at 9:35 AM, Stefan Seefeld via Boost-build
>> <boost-build_at_[hidden] <mailto:boost-build_at_[hidden]>> wrote:
>>
>> Hello,
>>
>> having learned a bit more about Boost.Build and its internals, I'm
>> trying to apply my understanding.
>>
>>
>> My user-config.jam file contains
>>
>> using python : 2.7 ;
>> using pyhon : 3.5 ;
>>
>> Then I issue this command:
>>
>> ./b2 --with-python python=2.7
>>
>>
>> Inside my Jamfile, I see that `feature.values python` reports "2.7
>> 3.5",
>> independently on what I specify on the command-line.
>>
>>
>> The "python" feature is composed of *all* the configured version of
>> python.
>
> I find that quite counter-intuitive.
>
>> If you had no python installed or configured it would be empty.
>>
>>
>> So it seems I'm
>> missing something:
>>
>> What is b2's interpretation of the above user-config.jam file ?
>>
>>
>> It configures two python interpreters, and potentially libraries and
>> headers.
>
> That makes sense.
>
>>
>>
>> And what does it mean to provide the `python=2.7` option on the
>> command-line ?
>>
>>
>> It means to add the "<python>2.7" as a build request to match against
>> the targets to build.
>
> OK, makes sense, too. So let me paraphrase, to make sure I understand
> the idea:
>
> Having the two "using python" lines above means that those two python
> configurations are made available for future reference (in Jamfiles, as
> well as command-line). It does *not* imply that both are being used (as
> feature values) automatically (i.e. not without some other code
> elsewhere to specify that "all" is indeed what the Jamfile requests.)
>
>
>>
>>
>> How can I specify that I want to
>>
>> * build with Python 2.7 only
>>
>>
>> You can't [1].
>>
>>
>> * build with Python 3.5 only
>>
>>
>> You can't [1]
>>
>>
>> * build both variants at the same time
>>
>>
>> [1] The way the BPL build file is written by default it builds both a
>> 2 and 3 version of the library if both a 2 and 3 python version are
>> configured. Now.. Theoretically it would be possible that specifying
>> the version on the command would limit it to just that version to
>> build. But it seems that the way the python.jam module sets up python
>> libraries it fails to trigger the b2 target requirements selection
>> mechanics. Or simply put.. It's broken. And I don't know entirely why
>> yet. I'll keep looking at it so see if I can resolve this better
>> eventually.
>
> OK, so can we agree that this is a bug (no matter where) ? After all I
> have read about b2, it would seem logical that the above amounts to
> declaring a "python" feature, with two possible values, such that a
> command-line option of "python=2.7" would then pick one of the two.
>
> However, this example raises another question (already asked by Tom): As
> in the above the discriminating label is the version number, it isn't
> clear how one can declare multiple python configurations that use the
> same version. So if, as per Tom's example, I configure two Python 2.7
> variants (one for 32-bit and one for 64-bit builds), how can I refer to
> them unambiguously ? The version string clearly isn't enough. Is that
> also a bug / limitation in the python.jam file ?
For compilers one can always do:
using some_compiler : n.n ; some_path : some_requirements ;
using some_compiler : n.nsome_string ; some_path : some_requirements ;
as in:
using gcc : 6.3 :
C:/Utilities/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/g++ ;
using gcc : 6.3c03 :
C:/Utilities/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/bin/g++
: <cxxflags>-std=c++03 ;
and if I run 'b2 toolset=gcc-6.3 etc.' it will use the first of the
using statements and if I run 'b2 toolset=gcc-6.3c03 etc.' it will use
the second of the two using statements.
Ideally one should be able to do something similar with python.
I have no idea how these things work internally, but just mention what I
have noticed works for me.
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk