Boost logo

Boost :

Subject: Re: [boost] Fwd: Boost.Python build error in 1.58 RC1, 2 and 3 (OK in Beta 1)
From: Stefan Seefeld (stefan_at_[hidden])
Date: 2015-04-08 17:23:41


On 08/04/15 10:35 AM, Marshall Clow wrote:
> ---------- Forwarded message ----------
> From: <mark.incley_at_[hidden]>
> Date: Wed, Apr 8, 2015 at 1:29 AM
> Subject: Boost.Python build error in 1.58 RC1, 2 and 3 (OK in Beta 1)
> To: mclow.lists_at_[hidden]
>
>
> Hi Marshall,
>
> Please excuse the direct mail, but my mailing list posting wasn't picked up
> on by anyone. I believe I've found a problem in Boost.Python that causes
> build errors if the user has Python 3.0 or later on their system. This
> change appears to have been introduced after 1.58 Beta 1.
>
> Using:
>
> bjam address-model=32 runtime-link=shared toolset=msvc-12.0
> --stagedir=./stage/x86
>
> C:\Program Files (x86)\Microsoft Visual Studio
> 12.0\VC\INCLUDE\xtgmath.h(206) : warning C4273: 'round' : inconsistent dll
> linkage
> C:\Program Files (x86)\Microsoft Visual Studio
> 12.0\VC\INCLUDE\math.h(516) : see previous definition of 'round'
> libs\python\src\exec.cpp(91) : error C2664: 'FILE *_Py_fopen(PyObject
> *,const char *)' : cannot convert argument 1 from 'char *' to 'PyObject *'
> Types pointed to are unrelated; conversion requires
> reinterpret_cast, C-style cast or function-style cast
>
> call
> "C:\Users\MARK~1.INC\AppData\Local\Temp\b2_msvc_12.0_vcvarsall_x86.cmd" >nul
> cl /Zm800 -nologo
> @"bin.v2\libs\python\build\msvc-12.0\debug\link-static\threading-multi\exec.obj.rsp"
>
> ...failed compile-c-c++
> bin.v2\libs\python\build\msvc-12.0\debug\link-static\threading-multi\exec.obj…
>
> The problem appears to be this Boost.Python code that was changed some time
> after 1.58 Beta 1 and appears in 1.58 RC1 within
> boost\libs\python\src\exec.cpp at around line 91:
>
> 1.58 beta 1: FILE *fs = fopen(f, "r");
> 1.58 RCs: FILE *fs = _Py_fopen(f, "r"); ← f is a char *, hence the error
> shown above. It expects a PyObject * as the first parameter.

I'm confused. The Python C API provides a "_Py_fopen(const char *, const
char *)" function (matching the above call), as well as a
"_Py_fopen_obj(PyObject *, const char *)" function.
Unfortunately I don't have Windows and thus can't attempt to reproduce
the problem. (See
https://hg.python.org/cpython/file/0ca028765488/Python/fileutils.c#l1035)

What is the exact version of Python you are using ?

> This code occurs within a test for #if PY_VERSION_HEX >= 0x03000000 which
> may explain why no-one else has reported it – I have Python 3.3.0 on my HDD.

I can't reproduce the error on Linux, FWIW,

        Stefan

-- 
      ...ich hab' noch einen Koffer in Berlin...

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk