[MacPorts] #50100: clang-3.8 fails to support Boost.Python

MacPorts noreply at macports.org
Mon Dec 21 05:45:19 PST 2015


#50100: clang-3.8 fails to support Boost.Python
-----------------------------+--------------------------------------
 Reporter:  akim.demaille@…  |      Owner:  macports-tickets@…
     Type:  defect           |     Status:  new
 Priority:  Normal           |  Milestone:
Component:  ports            |    Version:  2.3.4
 Keywords:  C++              |       Port:  clang-3.8 boost python34
-----------------------------+--------------------------------------
 Hi,

 I'm unsure where I should report this bug: it happens with Boost.Python
 (1.59) and Clang 3.8.  It does not happen with Clang 3.7 and previous, so
 that's why I send it here.

 The following program fails to compile:

 {{{
 $ cat foo.cc
 #include <boost/python.hpp>

 int main() {}
 $ clang++-mp-3.8 -I /opt/local/include/
 -I/opt/local/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m
 foo.cc |& head -50
 In file included from foo.cc:1:
 In file included from /opt/local/include/boost/python.hpp:11:
 In file included from /opt/local/include/boost/python/args.hpp:25:
 In file included from /opt/local/include/boost/python/object_core.hpp:14:
 In file included from /opt/local/include/boost/python/call.hpp:15:
 In file included from
 /opt/local/include/boost/python/converter/arg_to_python.hpp:10:
 In file included from
 /opt/local/include/boost/python/to_python_indirect.hpp:10:
 In file included from
 /opt/local/include/boost/python/object/pointer_holder.hpp:14:
 In file included from
 /opt/local/include/boost/python/instance_holder.hpp:11:
 In file included from /opt/local/include/boost/python/type_id.hpp:14:
 In file included from
 /opt/local/libexec/llvm-3.8/bin/../include/c++/v1/ostream:138:
 In file included from
 /opt/local/libexec/llvm-3.8/bin/../include/c++/v1/ios:216:
 /opt/local/libexec/llvm-3.8/bin/../include/c++/v1/__locale:468:15: error:
 C++ requires a type specifier for all declarations
     char_type toupper(char_type __c) const
               ^
 /opt/local/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m/pyport.h:709:29:
 note: expanded from macro 'toupper'
 #define toupper(c) towupper(btowc(c))
                             ^
 In file included from foo.cc:1:
 In file included from /opt/local/include/boost/python.hpp:11:
 In file included from /opt/local/include/boost/python/args.hpp:25:
 In file included from /opt/local/include/boost/python/object_core.hpp:14:
 In file included from /opt/local/include/boost/python/call.hpp:15:
 In file included from
 /opt/local/include/boost/python/converter/arg_to_python.hpp:10:
 In file included from
 /opt/local/include/boost/python/to_python_indirect.hpp:10:
 In file included from
 /opt/local/include/boost/python/object/pointer_holder.hpp:14:
 In file included from
 /opt/local/include/boost/python/instance_holder.hpp:11:
 In file included from /opt/local/include/boost/python/type_id.hpp:14:
 In file included from
 /opt/local/libexec/llvm-3.8/bin/../include/c++/v1/ostream:138:
 In file included from
 /opt/local/libexec/llvm-3.8/bin/../include/c++/v1/ios:216:
 /opt/local/libexec/llvm-3.8/bin/../include/c++/v1/__locale:474:48: error:
 too many arguments provided to function-like macro invocation
     const char_type* toupper(char_type* __low, const char_type* __high)
 const
                                                ^
 /opt/local/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m/pyport.h:709:9:
 note: macro 'toupper' defined here
 #define toupper(c) towupper(btowc(c))
         ^
 In file included from foo.cc:1:
 In file included from /opt/local/include/boost/python.hpp:11:
 In file included from /opt/local/include/boost/python/args.hpp:25:
 In file included from /opt/local/include/boost/python/object_core.hpp:14:
 In file included from /opt/local/include/boost/python/call.hpp:15:
 In file included from
 /opt/local/include/boost/python/converter/arg_to_python.hpp:10:
 In file included from
 /opt/local/include/boost/python/to_python_indirect.hpp:10:
 In file included from
 /opt/local/include/boost/python/object/pointer_holder.hpp:14:
 In file included from
 /opt/local/include/boost/python/instance_holder.hpp:11:
 In file included from /opt/local/include/boost/python/type_id.hpp:14:
 In file included from
 /opt/local/libexec/llvm-3.8/bin/../include/c++/v1/ostream:138:
 In file included from
 /opt/local/libexec/llvm-3.8/bin/../include/c++/v1/ios:216:
 /opt/local/libexec/llvm-3.8/bin/../include/c++/v1/__locale:474:29: error:
 expected ';' at end of declaration list
     const char_type* toupper(char_type* __low, const char_type* __high)
 const
 $
 }}}

 It is related to these bits in
 {{{/opt/local/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m/pyport.h}}}:

 {{{
 #if defined(__APPLE__)
 # define _PY_PORT_CTYPE_UTF8_ISSUE
 #endif

 #ifdef _PY_PORT_CTYPE_UTF8_ISSUE
 #include <ctype.h>
 #include <wctype.h>
 #undef isalnum
 #define isalnum(c) iswalnum(btowc(c))
 #undef isalpha
 #define isalpha(c) iswalpha(btowc(c))
 #undef islower
 #define islower(c) iswlower(btowc(c))
 #undef isspace
 #define isspace(c) iswspace(btowc(c))
 #undef isupper
 #define isupper(c) iswupper(btowc(c))
 #undef tolower
 #define tolower(c) towlower(btowc(c))
 #undef toupper
 #define toupper(c) towupper(btowc(c))
 #endif
 }}}

 My guess is that Python was ready to see these functions being defined
 _before_ pyport.h being included, but not after, as is now the case.  And
 indeed, if I include {{{<locale>}}} before Boost.Python, it works.  So it
 might be Boost.Python that might need a fix.

-- 
Ticket URL: <https://trac.macports.org/ticket/50100>
MacPorts <https://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list