Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.Python Compile Error(s) (GCC via MinGW-w64)
From: Christopher Schmidt (mr.chr.schmidt_at_[hidden])
Date: 2010-12-28 23:15:44


Joshua Boyce schrieb:
> Hey all. I'm working on a project which currently only compiles under
> MSVC. I wish to port it to compile under GCC via MinGW-w64 also, however
> I've hit a brick-wall with a slew of compile errors I'm getting when
> using Boost.Python in my project. I'm not quite sure who's "fault" this
> problem is... Mine? Boost? GCC? libstdc++? MinGW-w64? Something else?
>
> I'm using TDM-GCC 4.5.1.
> http://tdm-gcc.tdragon.net/
>
> Anyway, here is an example build output:
> http://raptorfactor.privatepaste.com/54e19acdc1
>
> Ignore the errors in the 'MMHelper' project to do with exception
> routines, they are something else that I already know the cause and
> solution for. The problem I'm referring to is this one:
>
> gcc.compile.c++
> Scripting\bin\gcc-mingw-4.5.1\debug\address-model-32\link-static\MemSandbox\Main.o
> In file included from
> c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/include/c++/cmath:629:0,
> from
> c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/include/c++/random:38,
> from
> c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/include/c++/bits/stl_algo.h:66,
> from
> c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/include/c++/algorithm:63,
> from
> E:\Code\Boost/boost/function/detail/prologue.hpp:13,
> from
> E:\Code\Boost/boost/function/function_template.hpp:13,
> from
> E:\Code\Boost/boost/function/detail/maybe_include.hpp:13,
> from E:\Code\Boost/boost/function/function0.hpp:11,
> from E:\Code\Boost/boost/python/errors.hpp:13,
> from E:\Code\Boost/boost/python/handle.hpp:11,
> from E:\Code\Boost/boost/python/args_fwd.hpp:10,
> from E:\Code\Boost/boost/python/args.hpp:10,
> from E:\Code\Boost/boost/python.hpp:11,
> from Scripting\MemSandbox\Main.cpp:38:
> c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.5.1/include/c++/tr1_impl/cmath:203:11:
> error: '::hypot' has not been declared
>
> "g++" -ftemplate-depth-128 -O0 -fno-inline -w -g -m32
> -std=c++0x -DBOOST_FILESYSTEM_VERSION=3 -DBOOST_PYTHON_STATIC_LIB
> -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_USE_LIB=1
> -DDATE_TIME_INLINE -DUNICODE -D_UNICODE -Dnullptr=NULL
> -I"C:\Python27\Include" -I"E:\Code\Boost" -I"Common"
> -I"Dependencies" -I"Dependencies\BeaEngine" -I"Memory" -c -o
> "Scripting\bin\gcc-mingw-4.5.1\debug\address-model-32\link-static\MemSandbox\Main.o"
> "Scripting\MemSandbox\Main.cpp"
>
> ...failed gcc.compile.c++
> Scripting\bin\gcc-mingw-4.5.1\debug\address-model-32\link-static\MemSandbox\Main.o...
>
> I'm at a loss as to how to fix this. I'm suspecting it's a MinGW
> problem, but I'm unable to find anybody else who has had or is having
> the same problem...
>
[snip]
>
> If anyone could shed some light as to what's going wrong here and how I
> might fix it I'd really appreciate it. Thanks in advance.

It's Python. Out-of-the-box Python 2.7 pyconfig.h on Windows defines
hypot as _hypot which subsequently cripples the declaration of hypot in
<math.h> and ultimately breaks the using declaration in <cmath> .

A simple fix is to include <cmath> before including <boost/python.hpp> .
Other than that, you may try configuring python yourself via autoreconf.

BTW. nice project. Keep up the good work!

-Christopher


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net