[英]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.