我正在尝试编译Cygwin的最新推动,并且我收到了大量的警告:
...failed gcc.compile.c++ bin.v2/libs/python/build/gcc-4.9.2/release/link-static/threading-multi/object_protocol.o...
gcc.compile.c++ bin.v2/libs/python/build/gcc-4.9.2/release/link-static/threading-multi/object_operators.o
In file included from ./boost/python/detail/prefix.hpp:13:0,
from ./boost/python/object_operators.hpp:8,
from libs\python\src\object_operators.cpp:6:
./boost/python/detail/wrap_python.hpp:88:0: warning: "SIZEOF_LONG" redefined
# define SIZEOF_LONG 4
^
In file included from ./boost/python/detail/wrap_python.hpp:50:0,
from ./boost/python/detail/prefix.hpp:13,
from ./boost/python/object_operators.hpp:8,
from libs\python\src\object_operators.cpp:6:
/usr/include/python2.7/pyconfig.h:1013:0: note: this is the location of the previous definition
#define SIZEOF_LONG 8
我在64位系统上。 pyconfig.h是正确的,一个long的大小应该是8. wrap中的wrap_python.hpp有错误。
我查看了wrap_python.hpp,发现了这个:
//
// Some things we need in order to get Python.h to work with compilers other
// than MSVC on Win32
//
#if defined(_WIN32) || defined(__CYGWIN__)
# if defined(__GNUC__) && defined(__CYGWIN__)
# define SIZEOF_LONG 4
...然后导致此错误:
In file included from /usr/include/python2.7/Python.h:58:0,
from ./boost/python/detail/wrap_python.hpp:142,
from ./boost/python/detail/prefix.hpp:13,
from ./boost/python/converter/registrations.hpp:8,
from libs\python\src\object\function_doc_signature.cpp:9:
/usr/include/python2.7/pyport.h:886:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
^
如何制作64位的所有内容?
答案 0 :(得分:0)
要正确编译,您需要做的就是更改
#if defined(_WIN32) || defined(__CYGWIN__)
# if defined(__GNUC__) && defined(__CYGWIN__)
# define SIZEOF_LONG 4
到
#if defined(_WIN32) || defined(__CYGWIN__)
# if defined(__GNUC__) && defined(__CYGWIN__)
# define SIZEOF_LONG 8
/boost/python/detail/wrap_python.hpp 文件中的。 在Cygwin-64下用GCC-4.9.3测试。 另见here。 也许你找到了自己的解决方案,但我希望这个答案可以帮助别人。