boostorg / boostorg/build

Python path detection incorrect on macOS + brew + clang, but disallowed to pass multiple lib paths via jamfile to fix issue

Open
#374 3 comments 0 reactions 0 assignees View on GitHub
transition
Dominant language
C++
Stars
251
Forks
63
PR merge metrics
No merged PRs in 30d

Description

Hello,

When building Boost on macOS Mojave with Homebrew and LLVM+Clang 7.0.0:

First:
- Install Homebrew
- brew install llvm (includes clang 7.0.0)
- brew install python@3
- configure clang and environment correctly

Next, build boost:
1) `./bootstrap.sh --with-toolset=clang --with-python=/usr/local/bin/python3 --with-python-version=3.7`
2) Small issue: This will cause the build to fail because you also have to provide "--with-python-root=/usr/local/bin/python3 " otherwise path detection is incorrect. Providing the path to the binary twice might be confusing for the user.

So fixing that:

1) `./bootstrap.sh --with-toolset=clang --with-python=/usr/local/bin/python3 --with-python-root=/usr/local/bin/python3 --with-python-version=3.7`

Now Python paths will be detected incorrectly. (Build will fail later on):

```
notice: [python-cfg] Configuring python...
notice: [python-cfg] user-specified version: "3.7"
notice: [python-cfg] user-specified cmd-or-prefix: "/usr/local/bin/python3"
notice: [python-cfg] Checking interpreter command "/usr/local/bin/python3"...
notice: [python-cfg] running command '/usr/local/bin/python3 -c "from sys import *; print('version=%d.%d\nplatform=%s\nprefix=%s\nexec_prefix=%s\nexecutable=%s' % (version_info[0],version_info[1],platform,prefix,exec_prefix,executable))" 2>&1'
notice: [python-cfg] ...requested configuration matched!
notice: [python-cfg] Details of this Python configuration:
notice: [python-cfg] interpreter command: "/usr/local/bin/python3"
notice: [python-cfg] include path: "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7"
notice: [python-cfg] library path: "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config" "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib"
```

- The detected "include path" path is incorrect, because it is missing the "m in "python3.7m"
The correct path is `/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m`

- The detected config path of the "library path" is incorrect. The correct config path should be:
`/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin`
It is using only 'config' and not 'config-3.7m-darwin'

Therefore I modify the project-config.jam file to add the paths manually:

```
using python
: 3.7
: /usr/local/bin/python3
: /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m
: /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin
/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib
;
```

However this produces a build error:
```
*** argument error
* rule python.init ( version ? : cmd-or-prefix ? : includes * : libraries ? : condition * : extension-suffix ? )
* called with: ( 3.7 : /usr/local/bin/python3 : /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m : /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin
/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib : : : : )
* extra argument /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib
```

Because only a single argument is allowed to be passed via libraries.
But manually replacing all incorrectly detected paths requires passing multiple paths.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.