Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

''::hypot' has not been declared' and 'undefined reference to `__imp_Py_InitModule4'' errors for mingw-w64 builds on Windows #140

Copy link
Copy link
Closed
@sav-ix

Description

@sav-ix
Issue body actions

Hello everyone,

For Boost.Python builds using mingw-w64 on Windows got error:

.\b2 --build-type=complete --with-python toolset=gcc-6.3.0 variant=release link=shared threading=multi runtime-link=shared address-model=64 -j1 -d2 -q

<snip>

gcc.compile.c++ bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\numeric.o

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -mthreads -m64  -DBOOST_ALL_NO_LIB=1 -DBOOST_PYTHON_SOURCE -DNDEBUG  -I"." -I"C:\ProgramData\Python64\Include" -c -o "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\numeric.o" "libs\python\src\numeric.cpp"

In file included from C:/ProgramData/Mingw64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/math.h:36:0,
                 from C:\ProgramData\Python64\Include/pyport.h:325,
                 from C:\ProgramData\Python64\Include/Python.h:58,
                 from ./boost/python/detail/wrap_python.hpp:151,
                 from ./boost/python/detail/prefix.hpp:13,
                 from ./boost/python/numeric.hpp:8,
                 from libs\python\src\numeric.cpp:6:
C:/ProgramData/Mingw64/lib/gcc/x86_64-w64-mingw32/6.3.0/include/c++/cmath:1157:11: error: '::hypot' has not been declared
   using ::hypot;
           ^~~~~

<snip>

...failed gcc.compile.c++ bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\numeric.o...
...failed updating 1 target...
...updated 8 targets...

Reproduced for builds using mingw-w64 with <Debug|Release> <Shared|Static> configurations. Not reproduced for builds using ICC or MSVC.

Could be fixed by adding cxxflags="-D_hypot=hypot" key to Boost build commands (see appropriate topic).

If blocker above is fixed, next error appear:

.\b2 cxxflags="-D_hypot=hypot" --build-type=complete --with-python toolset=gcc-6.3.0 variant=release link=shared threading=multi runtime-link=shared address-model=64 -j1 -d2 -q

<snip>

gcc.link.dll bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\libboost_python-mgw63-mt-1_64.dll.a

    "g++" -L"C:\ProgramData\Python64\libs" -Wl,-R -Wl,"C:\ProgramData\Python64" -Wl,-R -Wl,"C:\ProgramData\Python64\libs" "-Wl,--out-implib,bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\libboost_python-mgw63-mt-1_64.dll.a" -o "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\libboost_python-mgw63-mt-1_64.dll"  -shared -Wl,--start-group "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\numeric.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\list.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\long.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\dict.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\tuple.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\str.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\slice.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\converter\from_python.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\converter\registry.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\converter\type_id.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\object\enum.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\object\class.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\object\function.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\object\inheritance.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\object\life_support.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\object\pickle_support.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\errors.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\module.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\converter\builtin_converters.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\converter\arg_to_python_base.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\object\iterator.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\object\stl_iterator.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\object_protocol.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\object_operators.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\wrapper.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\import.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\exec.o" "bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\object\function_doc_signature.o"  -Wl,-Bstatic  -Wl,-Bdynamic -lpython27 -Wl,--end-group -mthreads -m64 

bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\module.o:module.cpp:(.text+0xf1): undefined reference to `__imp_Py_InitModule4'
collect2.exe: error: ld returned 1 exit status
...failed gcc.link.dll bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\libboost_python-mgw63-mt-1_64.dll.a bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\libboost_python-mgw63-mt-1_64.dll...
...removing bin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi\libboost_python-mgw63-mt-1_64.dll.a
...skipped <pstage\lib>libboost_python-mgw63-mt-1_64.dll.a for lack of <pbin.v2\libs\python\build\gcc-mingw-6.3.0\release\threading-multi>libboost_python-mgw63-mt-1_64.dll.a...
...failed updating 1 target...
...skipped 1 target...
...updated 30 targets...

Reproduced for builds using mingw-w64 with <Debug|Release> Shared configurations. Not reproduced for builds using ICC or MSVC.

Could be fixed by adding cxxflags="-DMS_WIN64" key to Boost build commands (see appropriate topic).

Both errors above relate to the Python implementation because of definitions:

#define hypot _hypot

and

#if defined(MS_WIN64) ... #endif

in file <Python dir>/include/pyconfig.h

Is it possible to fix this issue? E.g. add mentioned preprocessor definitions to Boost.Python build system as a separate rule for mingw-w64 builds on Windows, or something.

Environment:

  • Windows 10 x64,
  • mingw-w64 6.3.0 x86_64,
  • Python 2.7.13,
  • Boost-1.64.0.

Alexander

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.