Dav*_* L. 10 c++ boost mingw-w64
在发布模式下链接我的项目时,我收到以下警告:
myProject-libs/release/libboost_regex-mt-s-1.50.0.a(cpp_regex_traits.o): duplicate section `.data$_ZZN5boost16cpp_regex_traitsIcE21get_catalog_name_instEvE6s_name[boost::cpp_regex_traits<char>::get_catalog_name_inst()::s_name]' has different size
我怀疑原因可能是boost库的编译方式与我用于项目的选项不同,但我不知道如何找到差异(boost在构建过程中没有输出这些选项).
为了在Ubuntu 12.04上编译win32的boost,我使用了这个过程:
tar jxf boost_1_50_0.tar.bz2
cd boost_1_50_0
./bootstrap.sh
echo "using gcc : 4.6 : i686-w64-mingw32-g++ : <rc>i686-w64-mingw32-windres <archiver>i686-w64-mingw32-ar ;" > user-config.jam
./bjam toolset=gcc target-os=windows --address-model=32 variant=release threading=multi threadapi=win32 link=static runtime-link=static --prefix=/opt/boost_1_50_0-release-static-windows-32 --user-config=user-config.jam -j 10 --without-mpi --without-python -sNO_BZIP2=1 -sNO_ZLIB=1 --layout=tagged install
为了在我的项目中编译文件,我使用类似的东西
i686-w64-mingw32-g++ -march=corei7 -mfpmath=sse -m32 -Wall -fmessage-length=0 -I"/opt/boost_1_50_0-release-static-windows-32/include" -std=c++0x -O3 -g0 -DNDEBUG -I"myProject/src/cpp" -c -o myProject/build/release/src/cpp/myproject.o myproject/src/cpp/myproject.cpp
我的测试表明正则表达式运行良好,但我仍然想解决警告.
编辑
我发现可以使用bjam的cxxflags =参数添加boost编译器的其他选项.
示例:bjam cxxflags =' - fPIC'....
也许确保将与我所做的相同参数传递给项目可以解决问题(特别是与链接问题中建议的优化相关的参数).
您的编译器是使用不同的选项进行编译的:) 在 Linux 上编译库和在 Windows 上编译程序会导致出现名称相同的 .data 段,但它们大小不同的情况。从理论上讲,这可能很有趣,因为数据段是可写的,但实际上,这并不重要。除非有证据表明这会导致我不知道的问题,否则您可以安全地抑制该警告;但我不知道你如何让它消失。
| 归档时间: | 
 | 
| 查看次数: | 4252 次 | 
| 最近记录: |