community icon indicating copy to clipboard operation
community copied to clipboard

Boost Python 1.66.0: building cannot find -lpython27 or -lpython36 on Msys2

Open ArekPiekarz opened this issue 7 years ago • 27 comments
trafficstars

Description of Problem

Building Boost Python on Msys2 results in a linking error, where it cannot find -lpython27 or -lpython36.

Packages with Python 2 and 3 in Msys2 respectively contain files libpython2.7.dll.a and libpython3.6.dll.a. A workaround for now is to create a symlink without the dot between the numbers:

cd /mingw64/lib/
ln -s libpython2.7.dll.a libpython27.dll.a
# and/or
ln -s libpython3.6.dll.a libpython36.dll.a

Package Details

  • Package Name/Version: boost_python/1.66.0@bincrafters/stable
  • Operating System: Windows 10 x64
  • Compiler+version: gcc-7.3.0 x64
  • Conan version: 1.0.4

Steps to reproduce

On Msys2 install Python 2 or 3, for instance x64 version: pacboy sync python2:x or pacboy sync python3:x

Create project folder:

mkdir conan-boost-python-test
cd conan-boost-python-test

Create conanfile.txt containing:

[requires]
boost_python/1.66.0@bincrafters/stable

[generators]
cmake

Create CMakeLists.txt with:

project(conan-boost-python-test)
cmake_minimum_required(VERSION 3.0)
add_definitions("-std=c++11")

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_library(${PROJECT} SHARED main.cpp)
target_link_libraries(${PROJECT} ${CONAN_LIBS})

Create main.cpp with a simple example taken from http://www.boost.org/doc/libs/1_66_0/libs/python/doc/html/tutorial/index.html:

#include <boost/python.hpp>

char const* greet()
{
   return "hello, world";
}

BOOST_PYTHON_MODULE(hello_ext)
{
    using namespace boost::python;
    def("greet", greet);
}

Build the dependencies:

mkdir build
cd build
conan install .. --build missing

Expected result

Boost Python should be built correctly.

Actual result

Building Boost Python fails with:

gcc.link.dll bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python.dll.a
D:/app/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython27
collect2.exe: error: ld returned 1 exit status

    "g++" -L"D:\app\msys64\mingw64\libs" -Wl,-rpath -Wl,"/D:/app/msys64/mingw64" -Wl,-rpath -Wl,"/D:/app/msys64/mingw64/libs" "-Wl,--out-implib,bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python.dll.a" -o "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python.dll" -Wl,-h -Wl,libboost_python.dll -shared -Wl,--start-group "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\list.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\long.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\dict.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\tuple.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\str.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\slice.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\from_python.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\registry.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\type_id.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\enum.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\class.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\function.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\inheritance.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\life_support.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\pickle_support.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\errors.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\module.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\builtin_converters.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\arg_to_python_base.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\iterator.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\stl_iterator.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object_protocol.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object_operators.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\wrapper.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\import.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\exec.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\function_doc_signature.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lpython27 -Wl,--end-group -g -mthreads -m64 -std=c++11

...failed gcc.link.dll bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python.dll.a bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python.dll...
...skipped <ppython\lib>libboost_python.dll.a for lack of <pbin\python\build\3e3f2f3655644799d26375053fc0b3a0>libboost_python.dll.a...
...skipped <ppython\lib>libboost_python.dll for lack of <pbin\python\build\3e3f2f3655644799d26375053fc0b3a0>libboost_python.dll...
...failed updating 2 targets...
...skipped 2 targets...
...updated 38 targets...
boost_python/1.66.0@bincrafters/stable:
boost_python/1.66.0@bincrafters/stable: ERROR: Package 'fb1e48e0e2556ee4ac7fe311e918fa49ead4821b' build failed
boost_python/1.66.0@bincrafters/stable: WARN: Build folder C:/.conan/fj7bv6zf/1
ERROR: boost_python/1.66.0@bincrafters/stable: Error in build() method, line 135
        boost_package_tools.build(self)
        ConanException: Error 1 while executing b2 -j8 -a --hash=yes --debug-configuration --layout=system  include=graph/include include=multi_index/include include=parameter/include 
```include=property_map/include include=serialization/include include=unordered/include python-build

Full logs

log.txt

Conan profile

$ cat /c/Users/Fazer/.conan/profiles/default
[build_requires]
[settings]
os=Windows
arch=x86_64
compiler=gcc
compiler.version=7
compiler.libcxx=libstdc++11
build_type=Debug
arch_build=x86_64
os_build=Windows
[options]
*:shared=True
[env]

ArekPiekarz avatar Feb 14 '18 19:02 ArekPiekarz

I've reimplemented the python detection and support in the testing/1.66.0 branches. There is now a python_dev_config package that handles all the information from the given python exec. To use add the following options while building:

  • python_dev_config:python=<path-to-python-exe> (if not specified the default is python as before)
  • boost_python:python_version=<X.Y> (must match the version of the python exec above)

Could you give the new packages a try to see if resolves your issue?

grafikrobot avatar Mar 13 '18 14:03 grafikrobot

Unfortunately, building with shared libraries still fails with the same error.

$ conan install .. --build missing
(...)
gcc.compile.c++ bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\inheritance.o
gcc.link.dll bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python3.dll.a
D:/app/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython36
collect2.exe: error: ld returned 1 exit status

    "g++" -L"D:\app\msys64\mingw64\lib\libs" -Wl,-rpath -Wl,"/D:/app/msys64/mingw64" -Wl,-rpath -Wl,"/D:/app/msys64/mingw64/lib/libs" "-Wl,--out-implib,bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python3.dll.a" -o "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python3.dll" -Wl,-h -Wl,libboost_python3.dll -shared -Wl,--start-group "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\list.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\long.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\dict.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\tuple.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\str.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\slice.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\from_python.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\registry.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\type_id.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\enum.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\class.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\function.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\inheritance.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\life_support.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\pickle_support.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\errors.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\module.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\builtin_converters.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\arg_to_python_base.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\iterator.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\stl_iterator.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object_protocol.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object_operators.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\wrapper.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\import.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\exec.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\function_doc_signature.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lpython36 -Wl,--end-group -g -mthreads -m64 -std=c++11

...failed gcc.link.dll bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python3.dll.a bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python3.dll...
...skipped <ppython\lib>libboost_python3.dll.a for lack of <pbin\python\build\3e3f2f3655644799d26375053fc0b3a0>libboost_python3.dll.a...
...skipped <ppython\lib>libboost_python3.dll for lack of <pbin\python\build\3e3f2f3655644799d26375053fc0b3a0>libboost_python3.dll...
...failed updating 2 targets...
...skipped 2 targets...
...updated 38 targets...
boost_python/1.66.0@bincrafters/testing:
boost_python/1.66.0@bincrafters/testing: ERROR: Package '41836a7b9bc9a8af43163160e8cfdc37fa15610a' build failed
boost_python/1.66.0@bincrafters/testing: WARN: Build folder C:/.conan/mzbovrk8/1
ERROR: boost_python/1.66.0@bincrafters/testing: Error in build() method, line 80
        boost_package_tools.build(self)
        ConanException: Error 1 while executing b2 -j8 -a --hash=yes --debug-configuration --layout=system  include=graph/include include=multi_index/include include=parameter/include include=property_map/include include=serialization/include include=unordered/include python-build

Full logs: conan-install-output.txt

My conanfile.txt:

[requires]
boost_python/1.66.0@bincrafters/testing

[options]
python_dev_config:python=python3
boost_python:python_version=3.6

[generators]
cmake

"python" in libraries path:

$ ll /mingw64/lib | ag python
-rw-r--r-- 1 Fazer Brak  3.3M Dec 22 06:20 libboost_python-mt.a
-rw-r--r-- 1 Fazer Brak  254K Dec 22 06:12 libboost_python-mt.dll.a
-rw-r--r-- 1 Fazer Brak  3.3M Dec 22 06:20 libboost_python3-mt.a
-rw-r--r-- 1 Fazer Brak  252K Dec 22 06:12 libboost_python3-mt.dll.a
-r--r--r-- 1 Fazer Brak  683K Jan 24 12:39 libpython2.7.dll.a
-rw-r--r-- 1 Fazer Brak  935K Jan 22 21:17 libpython3.6.dll.a
-rw-r--r-- 1 Fazer Brak  935K Jan 22 21:17 libpython3.6m.dll.a
drwxr-xr-x 1 Fazer Brak     0 Jan 31 19:50 python2.7
drwxr-xr-x 1 Fazer Brak     0 Jun 21  2017 python3.5
drwxr-xr-x 1 Fazer Brak     0 Jan 23 20:26 python3.6

"python" in binaries path:

$ ll /mingw64/bin | ag python
-rwxr-xr-x   1 Fazer Brak  392K Dec 22 06:19 libboost_python-mt.dll
-rwxr-xr-x   1 Fazer Brak  386K Dec 22 06:19 libboost_python3-mt.dll
-rwxr-xr-x   1 Fazer Brak  1.6M Jan 24 12:39 libpython2.7.dll
-rwxr-xr-x   1 Fazer Brak  2.3M Jan 22 21:17 libpython3.6m.dll
-rwxr-xr-x   1 Fazer Brak  1.7K Jan 24 12:39 python-config
-rwxr-xr-x   1 Fazer Brak   291 Jan 24 12:39 python-config-u.sh
-rwxr-xr-x   1 Fazer Brak  3.7K Jan 24 12:39 python-config.sh
-rwxr-xr-x   1 Fazer Brak   18K Jan 24 12:39 python.exe
-rwxr-xr-x   1 Fazer Brak  1.7K Jan 24 12:39 python2-config
-rwxr-xr-x   1 Fazer Brak  1.7K Jan 24 12:39 python2.7-config
-rwxr-xr-x   1 Fazer Brak   18K Jan 24 12:39 python2.7.exe
-rwxr-xr-x   1 Fazer Brak   18K Jan 24 12:39 python2.exe
-rwxr-xr-x   1 Fazer Brak   18K Jan 24 12:39 python2w.exe
-rwxr-xr-x   1 Fazer Brak  3.7K Jan 22 21:17 python3-config
-rwxr-xr-x   1 Fazer Brak  3.7K Jan 22 21:17 python3.6-config
-rwxr-xr-x   1 Fazer Brak  121K Jan 22 21:17 python3.6.exe
-rwxr-xr-x   1 Fazer Brak  3.7K Jan 22 21:17 python3.6m-config
-rwxr-xr-x   1 Fazer Brak  121K Jan 22 21:17 python3.6m.exe
-rwxr-xr-x   1 Fazer Brak  121K Jan 22 21:17 python3.exe
-rwxr-xr-x   1 Fazer Brak  120K Jan 22 21:17 python3w.exe

Python version:

$ python3 --version
Python 3.6.4

Building static libraries works, but then building of project fails at cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Debug step with an error Cannot specify link libraries for target "boost_python3" which is not built by this project.

ArekPiekarz avatar Mar 13 '18 21:03 ArekPiekarz

I think I have a fix for the latest problem up in bintray now. Could you try the testing packages again?

grafikrobot avatar Mar 20 '18 12:03 grafikrobot

I checked it now and the problem is still there, the output is almost the same. (I hope I used the right command to update the recipes.) Let me know if there is any other way I could help with this.

Fazer@fazer-laptop MINGW64 /d/dev/project/test/conan-boost-python-test/build
$ conan install .. --update --build missing
boost_python/1.66.0@bincrafters/testing: Retrieving from remote 'bincrafters'...
Downloading conanmanifest.txt
[==================================================] 103B/103B
Downloading conanfile.py
[==================================================] 3.7KB/3.7KB
Downloading conan_export.tgz
[==================================================] 758B/758B
boost_python/1.66.0@bincrafters/testing: Updated!
python_dev_config/0.2@bincrafters/stable: Not found in local cache, looking in remotes...
python_dev_config/0.2@bincrafters/stable: Trying with 'conan-center'...
python_dev_config/0.2@bincrafters/stable: Trying with 'bincrafters'...
Downloading conanmanifest.txt
[==================================================] 58B/58B
Downloading conanfile.py
[==================================================] 4.7KB/4.7KB
PROJECT: Installing D:/dev/project/test/conan-boost-python-test/conanfile.txt

(...)

gcc.link.dll bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python3.dll.a
D:/app/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython36
collect2.exe: error: ld returned 1 exit status

    "g++" -L"D:\app\msys64\mingw64\lib\libs" -Wl,-rpath -Wl,"/D:/app/msys64/mingw64" -Wl,-rpath -Wl,"/D:/app/msys64/mingw64/lib/libs" "-Wl,--out-implib,bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python3.dll.a" -o "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python3.dll" -Wl,-h -Wl,libboost_python3.dll -shared -Wl,--start-group "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\list.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\long.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\dict.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\tuple.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\str.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\slice.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\from_python.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\registry.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\type_id.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\enum.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\class.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\function.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\inheritance.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\life_support.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\pickle_support.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\errors.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\module.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\builtin_converters.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\converter\arg_to_python_base.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\iterator.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\stl_iterator.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object_protocol.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object_operators.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\wrapper.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\import.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\exec.o" "bin\python\build\3e3f2f3655644799d26375053fc0b3a0\object\function_doc_signature.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lpython36 -Wl,--end-group -g -mthreads -m64 -std=c++11

...failed gcc.link.dll bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python3.dll.a bin\python\build\3e3f2f3655644799d26375053fc0b3a0\libboost_python3.dll...
...skipped <ppython\lib>libboost_python3.dll.a for lack of <pbin\python\build\3e3f2f3655644799d26375053fc0b3a0>libboost_python3.dll.a...
...skipped <ppython\lib>libboost_python3.dll for lack of <pbin\python\build\3e3f2f3655644799d26375053fc0b3a0>libboost_python3.dll...
...failed updating 2 targets...
...skipped 2 targets...
...updated 38 targets...
boost_python/1.66.0@bincrafters/testing:
boost_python/1.66.0@bincrafters/testing: ERROR: Package 'daa978cd212e1a52207de9950b6f8f64012d8985' build failed
boost_python/1.66.0@bincrafters/testing: WARN: Build folder C:/.conan/wdvgksiv/1
ERROR: boost_python/1.66.0@bincrafters/testing: Error in build() method, line 80
        boost_package_tools.build(self)
        ConanException: Error 1 while executing b2 -j8 -a --hash=yes --debug-configuration --layout=system  include=graph/include include=multi_index/include include=parameter/include include=property_map/include include=serialization/include include=unordered/include python-build

Full logs: conan-install-output2.txt

ArekPiekarz avatar Mar 20 '18 20:03 ArekPiekarz

Since I can't seem to get past a variety of errors when trying to use msys2_installer.. Could you post the output of python3 -c "import sysconfig; import pprint; pprint.printt(sysconfig.get_config_vars()?

grafikrobot avatar Mar 21 '18 03:03 grafikrobot

Here is the output of the corrected command (there were some typos in your version): python3 -c "import sysconfig; import pprint; pprint.pprint(sysconfig.get_config_vars())"

python-config-vars.txt

BTW I don't know how you're trying to install Msys2, I got it manually from the official page, not through Conan's build_requires. The link I used was http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20161025.exe.

ArekPiekarz avatar Mar 21 '18 18:03 ArekPiekarz

@ArekPiekarz I'm trying to follow your repro steps, i.e. installing the full msys2 (and everything else). But ran into the simple problem that pip is not installed when installing python3. And installing manually with get-pip.py fails. I stand by my conviction that anything based on cygwin is an abomination. Could you write me up some steps to get msys2 plus everything else I need to install to repro from a clean slate?

grafikrobot avatar Mar 23 '18 04:03 grafikrobot

Update: I noticed some errors in instructions, they'll be corrected soon. Update 2: I fixed conanfile.txt and added output of conan install.

Sorry you had troubles, here are the instructions for doing it from scratch. I tested them now, but let me know if there is any problem:

Setup Msys2

Download the Msys2 64-bit binary from www.msys2.org (currently http://repo.msys2.org/distrib/x86_64/msys2-x86_64-20161025.exe). Run it, click through the installer. At the end by default it will launch Msys shell, close it. Assuming you used default location, launch C:\msys64\mingw64.exe shell.

Note: For explanation of Msys2 subsystems and shells, see https://github.com/msys2/msys2/wiki/MSYS2-introduction#msys2-susbsystems. If you want Ctrl+Shift+V and Ctrl+Shift+C shortcuts to work, right click on the title bar -> Options -> Keys -> "Ctrl+Shift+letter shortcuts", click Save.

Run pacboy remove catgets: (otherwise you will get questions about conflict in the next command).

Note: pacboy is a wrapper for pacman, the package manager from Arch Linux, but with with easier syntax. ":" at the end of the package disables translation of name, ":x" means 64-bit only, ":i" means 32-bit only. You can search for packages with pacboy find. You can also use pacman itself if you're familiar with it, but you'd have to use full package names like mingw-w64-x86_64-python3.

Run pacboy update. At the end you will get a warning "terminate MSYS2 without returning to shell and check for updates again". Close the window, you will get a warning "Processes are running in session. Close anyway?". Choose OK. Launch C:\msys64\mingw64.exe again. Run again pacboy update.

Get packages

pacboy sync cmake:x gcc:x python3:x python3-pip:x pip3 install conan

Configure Conan

cat > /c/Users/$USER/.conan/profiles/default
[build_requires]
[settings]
os=Windows
arch=x86_64
compiler=gcc
compiler.version=7
compiler.libcxx=libstdc++11
build_type=Debug
arch_build=x86_64
os_build=Windows
os.subsystem=msys2
[options]
*:shared=True
[env]

(Note: you can end cat command with Ctrl+D)

conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan

Setup project

mkdir conan-boost-python-test cd conan-boost-python-test

cat > conanfile.txt
[requires]
boost_python/1.66.0@bincrafters/testing

[options]
python_dev_config:python=python3
boost_python:python_version=3.6

[generators]
cmake
cat > CMakeLists.txt
project(conan-boost-python-test)
cmake_minimum_required(VERSION 3.0)
add_definitions("-std=c++11")

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_library(${PROJECT} SHARED main.cpp)
target_link_libraries(${PROJECT} ${CONAN_LIBS})
cat > main.cpp
#include <boost/python.hpp>

char const* greet()
{
   return "hello, world";
}

BOOST_PYTHON_MODULE(hello_ext)
{
    using namespace boost::python;
    def("greet", greet);
}

Build project

mkdir build cd build conan install .. --build missing

Output

Short version:

boost_build/1.66.0@bincrafters/testing: Calling build()
Bootstrapping the build engine
'cl' is not recognized as an internal or external command,
operable program or batch file.

Failed to bootstrap the build engine
Please consult bootstrap.log for furter diagnostics.

could not find "vswhere"
###
### Using 'msvc' toolset.
###

C:\Users\Fazer\.conan\data\boost_build\1.66.0\bincrafters\testing\build\3b91f3b23c08201caa85611262cd93a235370ed7\build\src\engine>if exist bootstrap rd /S /Q bootstrap

C:\Users\Fazer\.conan\data\boost_build\1.66.0\bincrafters\testing\build\3b91f3b23c08201caa85611262cd93a235370ed7\build\src\engine>md bootstrap

C:\Users\Fazer\.conan\data\boost_build\1.66.0\bincrafters\testing\build\3b91f3b23c08201caa85611262cd93a235370ed7\build\src\engine>cl /nologo /GZ /Zi /MLd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG kernel32.lib advapi32.lib user32.lib /Febootstrap\jam0  command.c compile.c constants.c debug.c execcmd.c execnt.c filent.c frames.c function.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c object.c option.c output.c parse.c pathnt.c pathsys.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c md5.c class.c cwd.c w32_getreg.c native.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c

C:\Users\Fazer\.conan\data\boost_build\1.66.0\bincrafters\testing\build\3b91f3b23c08201caa85611262cd93a235370ed7\build\src\engine>exit /b 9009
boost_build/1.66.0@bincrafters/testing:
boost_build/1.66.0@bincrafters/testing: ERROR: Package '3b91f3b23c08201caa85611262cd93a235370ed7' build failed
boost_build/1.66.0@bincrafters/testing: WARN: Build folder C:/Users/Fazer/.conan/data/boost_build/1.66.0/bincrafters/testing/build/3b91f3b23c08201caa85611262cd93a235370ed7
ERROR: boost_build/1.66.0@bincrafters/testing: Error in build() method, line 39
        self.run(command)
        ConanException: Error 9009 while executing bootstrap

Fulll version: conan-boost-python-output.txt

ArekPiekarz avatar Mar 23 '18 18:03 ArekPiekarz

BTW Conan recommends Msys2 as the subsystem on Windows - http://docs.conan.io/en/latest/systems_cross_building/windows_subsystems.html?highlight=msys2 But if you have other suggestions for developing with GCC on that system, I'm all ears ;-)

ArekPiekarz avatar Mar 23 '18 21:03 ArekPiekarz

I use msys2 shell only (never mingw!) with this conan profile:

`klein@MSYS ~/.conan/profiles $ cat msys2 [build_requires] #NO! mingw_installer/1.0@conan/stable #NO! msys2_installer/latest@bincrafters/stable

[settings] os_build=Windows os=Windows os.subsystem=msys2 arch=x86_64 arch_build=x86_64 compiler=gcc compiler.version=6.4 compiler.exception=seh compiler.libcxx=libstdc++ compiler.threads=posix build_type=Release

[options] *:cxx_14=True *:shared=False *:header_only=True

###FIXME --build=zlib failed! CK
# OpenSSL:no_zlib=True
# Poco:enable_zip=False
# Poco:enable_crypto=False
# Poco:enable_netssl=False
# Poco:enable_netssl_win=False
# asio:force_openssl=False

[env] CC=/usr/bin/gcc CXX=/usr/bin/g++ CXXFLAGS=-std=c++14

CONAN_RUN_TESTS=True CONAN_CMAKE_SYSTEM_NAME="MSYS" CONAN_CMAKE_SYSTEM_VERSION="2.10.0(0.325/5/3)" CONAN_CMAKE_GENERATOR=Ninja CMAKE_LEGACY_CYGWIN_WIN32=0 CONAN_BASH_PATH=/usr/bin/bash

`

ClausKlein avatar Apr 03 '18 15:04 ClausKlein

@ClausKlein You have given us only your environment setup, but not if and how the bug affects you.

ArekPiekarz avatar Apr 04 '18 16:04 ArekPiekarz

@ArekPiekarz I've tried to follow your steps, but got different error:

boost_python/1.66.0@bincrafters/testing: WARN: Trying to remove corrupted source folder
boost_python/1.66.0@bincrafters/testing: WARN: This can take a while for big packages
ERROR: boost_python/1.66.0@bincrafters/testing: Error in source() method, line 75
        getattr(self, "source_additional", lambda:None)()
while calling 'source_additional', line 57
        raise Exception("Python version does not match with configured python dev, expected %s but got %s." % (self.options.python_version, self.deps_user_info['python_dev_config'].python_version))
        Exception: Python version does not match with configured python dev, expected 3.6 but got 3.7.

investigating...

SSE4 avatar Aug 23 '18 16:08 SSE4

okay, this one was trivial - MSYS2 has updated to python 3.7, so I've edited your conanfile.txt:

cat > conanfile.txt
[requires]
boost_python/1.66.0@bincrafters/testing

[options]
python_dev_config:python=python3
boost_python:python_version=3.6

[generators]
cmake

after that, I've got a new error:

python\src\converter\builtin_converters.cpp:51:35: error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
       return PyUnicode_Check(obj) ? _PyUnicode_AsString(obj) : 0;

    "g++"   -O0 -fno-inline -Wall -g -mthreads -m64 -std=c++11 -DBOOST_ALL_NO_LIB=1 -DBOOST_PYTHON_SOURCE -D_GLIBCXX_USE_CXX11_ABI=1  -I"C:\CONAN~1\078a6vqf\1\foreach\include" -I"C:\CONAN~1\0umg93lz\1\THROW_~1\include" -I"C:\CONAN~1\10xo_20u\1\move\include" -I"C:\CONAN~1\3bci19gn\1\tuple\include" -I"C:\CONAN~1\6yuh3bec\1\assert\include" -I"C:\CONAN~1\8rq5axd0\1\array\include" -I"C:\CONAN~1\93cxkmr8\1\config\include" -I"C:\CONAN~1\9frzlhjy\1\SMART_~1\include" -I"C:\CONAN~1\bhrnds35\1\NUMERI~1\include" -I"C:\CONAN~1\e983ews4\1\regex\include" -I"C:\CONAN~1\eb9p62xd\1\TYPE_T~1\include" -I"C:\CONAN~1\jnrjd99u\1\STATIC~1\include" -I"C:\CONAN~1\m3m9nbj_\1\integer\include" -I"C:\CONAN~1\mq8dyax7\1\range\include" -I"C:\CONAN~1\npw74thd\1\lambda\include" -I"C:\CONAN~1\q769djgx\1\bind\include" -I"C:\CONAN~1\qp9uzde7\1\CONTAI~1\include" -I"C:\CONAN~1\s3qhuw2q\1\LEXICA~1\include" -I"C:\CONAN~1\s3qhuw2q\1\math\include" -I"C:\CONAN~1\s65a9qgp\1\PREPRO~1\include" -I"C:\CONAN~1\v43j1j3c\1\INTRUS~1\include" -I"C:\CONAN~1\weywdw0g\1\atomic\include" -I"C:\CONAN~1\xh_ka1j2\1\CONCEP~1\include" -I"C:\CONAN~1\xh_ka1j2\1\CONVER~1\include" -I"C:\CONAN~1\xh_ka1j2\1\detail\include" -I"C:\CONAN~1\xh_ka1j2\1\function\include" -I"C:\CONAN~1\xh_ka1j2\1\FUNCTI~1\include" -I"C:\CONAN~1\xh_ka1j2\1\FUNCTI~2\include" -I"C:\CONAN~1\xh_ka1j2\1\fusion\include" -I"C:\CONAN~1\xh_ka1j2\1\iterator\include" -I"C:\CONAN~1\xh_ka1j2\1\mpl\include" -I"C:\CONAN~1\xh_ka1j2\1\optional\include" -I"C:\CONAN~1\xh_ka1j2\1\TYPE_I~1\include" -I"C:\CONAN~1\xh_ka1j2\1\typeof\include" -I"C:\CONAN~1\xh_ka1j2\1\utility\include" -I"C:\CONAN~1\z916unoi\1\predef\include" -I"C:\CONAN~1\zuiy43p8\1\core\include" -I"C:\MSYS64~1\mingw64\include\python3.7m" -I"graph\include" -I"multi_index\include" -I"parameter\include" -I"property_map\include" -I"python\include" -I"serialization\include" -I"unordered\include" -c -o "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\converter\builtin_converters.o" "python\src\converter\builtin_converters.cpp"

...failed gcc.compile.c++ bin\python\build\540357c0269b1fe8294ca49f2ddb13be\converter\builtin_converters.o...

looking...

SSE4 avatar Aug 23 '18 16:08 SSE4

found a fix, will try to apply it: https://github.com/boostorg/python/commit/660487c43fde76f3e64f1cb2e644500da92fe582#diff-467cabb22a6c637452d730accca26d2e

SSE4 avatar Aug 23 '18 16:08 SSE4

after applying the patch, the error is:

gcc.link.dll bin\python\build\540357c0269b1fe8294ca49f2ddb13be\libboost_python3.dll.a
C:/msys64_conan/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython37
collect2.exe: error: ld returned 1 exit status

    "g++" -L"C:\MSYS64~1\mingw64\lib" -Wl,-rpath -Wl,"/C:/msys64_conan/mingw64" -Wl,-rpath -Wl,"/C:/msys64_conan/mingw64/lib" "-Wl,--out-implib,bin\python\build\540357c0269b1fe8294ca49f2ddb13be\libboost_python3.dll.a" -o "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\libboost_python3.dll" -Wl,-h -Wl,libboost_python3.dll -shared -Wl,--start-group "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\list.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\long.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\dict.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\tuple.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\str.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\slice.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\converter\from_python.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\converter\registry.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\converter\type_id.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\object\enum.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\object\class.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\object\function.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\object\inheritance.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\object\life_support.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\object\pickle_support.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\errors.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\module.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\converter\builtin_converters.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\converter\arg_to_python_base.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\object\iterator.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\object\stl_iterator.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\object_protocol.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\object_operators.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\wrapper.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\import.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\exec.o" "bin\python\build\540357c0269b1fe8294ca49f2ddb13be\object\function_doc_signature.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lpython37 -Wl,--end-group -g -mthreads -m64 -std=c++11

...failed gcc.link.dll bin\python\build\540357c0269b1fe8294ca49f2ddb13be\libboost_python3.dll.a bin\python\build\540357c0269b1fe8294ca49f2ddb13be\libboost_python3.dll...

which appears to be the same as an initial issue

SSE4 avatar Aug 23 '18 16:08 SSE4

okay, now issue seems to be completely clean: boost generator sets python library directory (-L option), but doesn't override python library name for some reason - it's just ignored for some reason, but should be:

>>> print(sysconfig.get_config_var('LDLIBRARY'))
libpython3.7m.dll.a

SSE4 avatar Aug 23 '18 16:08 SSE4

@grafikrobot do you have an idea how to specify python library name for boost? according to the https://www.boost.org/doc/libs/1_68_0/libs/python/doc/html/building/configuring_boost_build.html, 3rd parameter must be the path to Python library binaries. however, you seems to be passing only directory of python libraries in boost generator (I've tried to change it to pass full paths, but it didn't work either). so, library name seems to be somehow deduced?

SSE4 avatar Aug 24 '18 02:08 SSE4

@SSE4 do you still need an answer on this from @grafikrobot ?

solvingj avatar Feb 17 '19 23:02 solvingj

@solvingj nope, I was able to get it working with boost package (non-modular one), I just need to merge my changes

SSE4 avatar Feb 17 '19 23:02 SSE4

reproduced with latest build (1.69.0):

gcc.link.dll bin/python/build/91f4860ef2a4c64e13a521917e650b61/libboost_python36.dll.a
/usr/lib/gcc/x86_64-pc-msys/6.4.0/../../../../x86_64-pc-msys/bin/ld: cannot find -lpython3.6
collect2: error: ld returned 1 exit status

    "/usr/bin/g++" -L"/usr/lib" -Wl,-rpath -Wl,"/usr/lib" "-Wl,--out-implib,bin/python/build/91f4860ef2a4c64e13a521917e650b61/libboost_python36.dll.a" -o "bin/python/build/91f4860ef2a4c64e13a521917e650b61/libboost_python36.dll" -Wl,-h -Wl,libboost_python36.dll -shared -Wl,--start-group "bin/python/build/91f4860ef2a4c64e13a521917e650b61/list.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/long.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/dict.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/tuple.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/str.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/slice.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/converter/from_python.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/converter/registry.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/converter/type_id.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/object/enum.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/object/class.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/object/function.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/object/inheritance.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/object/life_support.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/object/pickle_support.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/errors.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/module.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/converter/builtin_converters.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/converter/arg_to_python_base.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/object/iterator.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/object/stl_iterator.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/object_protocol.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/object_operators.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/wrapper.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/import.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/exec.o" "bin/python/build/91f4860ef2a4c64e13a521917e650b61/object/function_doc_signature.o"  -Wl,-Bstatic  -Wl,-Bdynamic -ldl -lpthread -lpython3.6 -lutil -Wl,--end-group -m64 -mthreads

...failed gcc.link.dll bin/python/build/91f4860ef2a4c64e13a521917e650b61/libboost_python36.dll.a bin/python/build/91f4860ef2a4c64e13a521917e650b61/libboost_python36.dll...
...skipped <ppython/lib>libboost_python36.dll.a for lack of <pbin/python/build/91f4860ef2a4c64e13a521917e650b61>libboost_python36.dll.a...
...skipped <ppython/lib>libboost_python36.dll for lack of <pbin/python/build/91f4860ef2a4c64e13a521917e650b61>libboost_python36.dll...
...failed updating 2 targets...
...skipped 2 targets...
...updated 38 targets...

SSE4 avatar Feb 17 '19 23:02 SSE4

@ArekPiekarz I was able to fix the issue, fixes are in 1.69.0 branch (testing/stable), please give an another try

SSE4 avatar Feb 18 '19 12:02 SSE4

Thanks. Just FYI after today's attempt of setting up the environment I got stuck on Python not being able to load the ssl module in Msys2. I will try again tomorrow.

ArekPiekarz avatar Feb 19 '19 21:02 ArekPiekarz

Good news, Conan has successfully built Boost.Python :-)

But after that I tried the next step by invoking CMake and got this error:

/d/dev/project/test/conan-boost-python-test/build
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 8.2.1
-- The CXX compiler identification is GNU 8.2.1
-- Check for working C compiler: D:/dev/app/msys64/mingw64/bin/cc.exe
-- Check for working C compiler: D:/dev/app/msys64/mingw64/bin/cc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: D:/dev/app/msys64/mingw64/bin/c++.exe
-- Check for working CXX compiler: D:/dev/app/msys64/mingw64/bin/c++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Current conanbuildinfo.cmake directory: D:/dev/project/test/conan-boost-python-test/build
-- Conan: Compiler GCC>=5, checking major version 8
-- Conan: Checking correct version: 8
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
CMake Error at CMakeLists.txt:9 (target_link_libraries):
  Cannot specify link libraries for target "boost_python37" which is not
  built by this project.


-- Configuring incomplete, errors occurred!
See also "D:/dev/project/test/conan-boost-python-test/build/CMakeFiles/CMakeOutput.log".

I'll look at it tomorrow.

ArekPiekarz avatar Feb 20 '19 23:02 ArekPiekarz

Can you post your conanbuildinfo.cmake?

solvingj avatar Feb 21 '19 00:02 solvingj

My celebration was premature. Yesterday I have built Conan packages as static and tried to create dynamic library with CMake and/or I mixed debug/release modes. So today I tried to built packages as shared and it failed with a following error:

gcc.link.dll bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\libboost_python37.dll.a
D:/dev/app/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython37
collect2.exe: error: ld returned 1 exit status

    "g++" -L"D:\dev\app\msys64\mingw64\lib\LIBPYT~2.A" -Wl,-rpath -Wl,"D:\dev\app\msys64\mingw64" -Wl,-rpath -Wl,"D:\dev\app\msys64\mingw64\lib\LIBPYT~2.A" "-Wl,--out-implib,bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\libboost_python37.dll.a" -o "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\libboost_python37.dll" -Wl,-h -Wl,libboost_python37.dll -shared -Wl,--start-group "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\list.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\long.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\dict.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\tuple.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\str.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\slice.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\converter\from_python.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\converter\registry.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\converter\type_id.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\object\enum.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\object\class.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\object\function.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\object\inheritance.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\object\life_support.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\object\pickle_support.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\errors.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\module.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\converter\builtin_converters.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\converter\arg_to_python_base.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\object\iterator.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\object\stl_iterator.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\object_protocol.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\object_operators.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\wrapper.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\import.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\exec.o" "bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\object\function_doc_signature.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lpython37 -Wl,--end-group -m64 -mthreads -std=c++11

...failed gcc.link.dll bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\libboost_python37.dll.a bin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7\libboost_python37.dll...
...skipped <ppython\lib>libboost_python37.dll.a for lack of <pbin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7>libboost_python37.dll.a...
...skipped <ppython\lib>libboost_python37.dll for lack of <pbin\python\build\dea8f06e6520bb45ccf7ea7fbe02a9e7>libboost_python37.dll...
...failed updating 2 targets...
...skipped 2 targets...
...updated 38 targets...
boost_python/1.69.0@bincrafters/stable:
boost_python/1.69.0@bincrafters/stable: ERROR: Package '119653a4d244d588163c49c89a3275df6c12c4a8' build failed
boost_python/1.69.0@bincrafters/stable: WARN: Build folder C:/.conan/55971b/1
ERROR: boost_python/1.69.0@bincrafters/stable: Error in build() method, line 147
        self._build_common()
while calling '_build_common', line 170
        self.run(" ".join(b2_command))
        ConanException: Error 1 while executing b2 -j8 -d+1 -a --hash=yes --debug-configuration --layout=system  include=graph/include include=integer/include include=multi_index/include include=parameter/include include=property_map/include include=serialization/include include=unordered/include  python-build

Full log: log-2019-02-21.txt

Conan profile:

[settings]
os=Windows
os_build=Windows
os.subsystem=msys2
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=8
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]

conanfile.txt:

[requires]
boost_python/1.69.0@bincrafters/stable

[options]
python_dev_config:python=python3
boost_python:python_version=3.7
*:shared=True

[generators]
cmake

CMakeLists.txt:

project(conan-boost-python-test)
cmake_minimum_required(VERSION 3.0)
add_definitions("-std=c++17")

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_library(${PROJECT} SHARED main.cpp)
target_link_libraries(${PROJECT} ${CONAN_LIBS})

main.cpp:

#include <boost/python.hpp>

char const* greet()
{
   return "hello, world";
}

BOOST_PYTHON_MODULE(hello_ext)
{
    using namespace boost::python;
    def("greet", greet);
}

Environment: GCC - 8.2.1 Conan - 1.12.3 Python - 3.7 (all x64)

ArekPiekarz avatar Feb 21 '19 18:02 ArekPiekarz

weird, it have successfully found python library:

D:/dev/app/msys64/mingw64/lib/libpython3.7m.dll.a

but tries to link with -lpython37 for some reason. the path look a bit weird for MSYS, but I think it's still okay. also, what does it mean System nie mo▒e odnale▒▒ okre▒lonej ▒cie▒ki.? I see it a lot within the log.

SSE4 avatar Feb 21 '19 18:02 SSE4

System nie mo▒e odnale▒▒ okre▒lonej ▒cie▒ki. is a broken form of Polish System nie może odnaleźć określonej ścieżki., which in English means The system cannot find the given path.

ArekPiekarz avatar Feb 21 '19 18:02 ArekPiekarz