QFS是一个开源分布式文件系统 基于Google File System的实现KFS
文档中写明支持Cygwin 所以打算在cygwin下使用
由于之前在公司机器上编译成功(cygwin32) 想当然认为64位下也没什么问题
于是按照正确顺序:安装cygwin 64位, JDK,
修改~/.bashrc 添加
export JAVA_HOME=/cygdrive/d/app/JDK
export JAVA_AWT_LIBRARY=/cygdrive/d/app/JDK/jawt.lib
export JAVA_JVM_LIBRARY=/cygdrive/d/app/JDK/jvm.lib
不加这些也行,但是就不能支持java了
修改默认的CMakeLists.txt :
IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_package(Boost COMPONENTS regex system REQUIRED)
ELSE (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
find_package(Boost COMPONENTS regex system REQUIRED) #这一行添加system,默认的配置文件有误,将不会正确链接libboost_system-mt.dll.a
ENDIF (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
进入qfs目录
cmake .
一切正常
make... 就出状况啦
[ 18%] Building CXX object src/cc/meta/CMakeFiles/kfsMeta.dir/MetaRequest.o
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/../../../../x86_64-pc-cygwin/bin/as: CMakeFiles/kfsMeta.dir/MetaRequest.o: too many sections (33439)
/tmp/ccAOJfOA.s: Assembler messages:
/tmp/ccAOJfOA.s: Fatal error: can't write CMakeFiles/kfsMeta.dir/MetaRequest.o: ▒ļ▒▒▒▒▒
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/../../../../x86_64-pc-cygwin/bin/as: CMakeFiles/kfsMeta.dir/MetaRequest.o: too many sections (33439)
/tmp/ccAOJfOA.s: Fatal error: can't close CMakeFiles/kfsMeta.dir/MetaRequest.o: ▒ļ▒▒▒▒▒
src/cc/meta/CMakeFiles/kfsMeta.dir/build.make:310: recipe for target 'src/cc/meta/CMakeFiles/kfsMeta.dir/MetaRequest.o' failed
make[2]: *** [src/cc/meta/CMakeFiles/kfsMeta.dir/MetaRequest.o] Error 1
CMakeFiles/Makefile2:250: recipe for target 'src/cc/meta/CMakeFiles/kfsMeta.dir/all' failed
make[1]: *** [src/cc/meta/CMakeFiles/kfsMeta.dir/all] Error 2
Makefile:126: recipe for target 'all' failed
make: *** [all] Error 2
网上一查"too many sections" 结果令人绝望:
http://stackoverflow.com/questions/16596876/object-file-has-too-many-sections
The error "%B: too many sections (%d)"
comes from the function coff_compute_section_file_positions()
located in bfd/coffcode.h
. It's produced when the output.obj
file (in COFF format) contains more than 32766 sections. There is no way to avoid this error, at least not if you want to use Windows' PE/COFF object format; COFF files use onlytwo bytes for "NumberOfSections" in the file header.
It's not clear to me why as
(the GNU assembler) caps the number of sections at 32768-minus-2, instead of 65536-minus-1 (section 0 is reserved); but either way, that might not be enough if you're making heavy use of templatesand your compiler implements templates via COMDAT sections.
As you've already noticed, passing /bigobj
to Microsoft's compiler causes it to output a munged COFF format with up to 231 sections, which "should be enough for anybody." However, the munged format is formally undocumented, and I don't see any informal documentation (blog posts or what-have-you) on the subject, so until someone with a copy of MSVC can write up a specification for/bigobj
, it doesn't stand much chance of getting into the GNU tools.
IMHO, if you're trying to make a Windows build, you should just bite the bullet and use MSVC. Nobody besides Microsoft is particularly motivated to waste time wrestling with the PE/COFF format.
暂时这个问题就没法解决了 最终换回了cygwin 32位版本 顺利编译