[英]Compiling Boost on Cygwin, headers disagree on 32/64 bit
我正在尝试编译有关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。boost中的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位?
要正确编译,您要做的就是更改
#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下测试。 另请参阅此处 。 也许您已经找到了自己的解决方案,但是我希望这个答案可以对其他人有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.