[cfe-dev] building LLVM/Clang on Windows 7 x64 using MinGW/MSYS

Dennis Cote DennisC at harding.ca
Fri Oct 18 13:53:18 PDT 2013


Replying to myself.

 

It seems like this is a hard limit when using gcc and windows. Quoting
from
http://stackoverflow.com/questions/16596876/object-file-has-too-many-sec
tions

 

The error "%B: too many sections (%d)" comes from the
functioncoff_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 only
two bytesfor "NumberOfSections" in the file header.

 

So it seems to me that others should be hitting this limit as well. I
would assume the number 39110 is the number of sections in
Registry.cpp.obj.  

 

I'm not sure how to proceed from here. I don't know enough about the
Clang internals to try to break Registry.cpp into smaller object files,
or even if that is possible. Perhaps I just need to give up on
windows...

 

Dennis Cote

 

From: Dennis Cote 
Sent: October 18, 2013 2:29 PM
To: 'G M'; cfe-dev
Subject: RE: [cfe-dev] building LLVM/Clang on Windows 7 x64 using
MinGW/MSYS

 

Hi,

 

Thanks for the patch. It fixed the link error on lli.exe using the 64
bit tools. The build proceeded to the 82% mark and then failed with a
couple of new errors from the assembler.

 

c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w6
4-mingw32/bin/as.exe:
CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.obj: too many
sections (39110)

C:\Users\DennisC\AppData\Local\Temp\cc811i4n.s: Assembler messages:

C:\Users\DennisC\AppData\Local\Temp\cc811i4n.s: Fatal error: can't write
CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.obj: File too big

c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w6
4-mingw32/bin/as.exe:
CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.obj: too many
sections (39110)

C:\Users\DennisC\AppData\Local\Temp\cc811i4n.s: Fatal error: can't close
CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.obj: File too big

tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.d
ir/build.make:130: recipe for target
`tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.
dir/Registry.cpp.obj' failed

make[2]: ***
[tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.
dir/Registry.cpp.obj] Error 1

CMakeFiles/Makefile2:10926: recipe for target
`tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.
dir/all' failed

make[1]: ***
[tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.
dir/all] Error 2

Makefile:136: recipe for target `all' failed

make: *** [all] Error 2

 

Does anyone have any ideas about what might be causing the
Registry.cpp.obj file to have too many sections?

 

There were several warnings and notes generated when compiling
Registry.cpp. The full output from the build step are copied below.

 

[ 82%] Building CXX object
tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.d
ir/Registry.cpp.obj

In file included from
C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
.h:50:0,

                 from
C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/Dynamic/Var
iantValue.h:22,

                 from
C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/Dynamic/Dia
gnostics.h:21,

                 from
C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/Dynamic/Reg
istry.h:20,

                 from
c:/cmd_line_tools/llvm/tools/clang/lib/ASTMatchers/Dynamic/Registry.cpp:
15:

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h: In member function 'bool clang::ast_matchers::in

ternal::ASTMatchFinder::matchesChildOf(const T&, const
clang::ast_matchers::internal::DynTypedMatcher&,
clang::ast_matchers::interna

l::BoundNodesTreeBuilder*,
clang::ast_matchers::internal::ASTMatchFinder::TraversalKind,
clang::ast_matchers::internal::ASTMatchFind

er::BindKind)':

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:688:9: warning: typedef 'unsupported_type_for_rec

ursive_matching' locally defined but not used [-Wunused-local-typedefs]

         unsupported_type_for_recursive_matching);

         ^

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:57:39: note: in definition of macro 'TOOLING_COMP

ILE_ASSERT'

   typedef CompileAssert<(bool(Expr))> Msg[bool(Expr) ? 1 : -1]

                                       ^

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h: In member function 'bool clang::ast_matchers::in

ternal::ASTMatchFinder::matchesDescendantOf(const T&, const
clang::ast_matchers::internal::DynTypedMatcher&, clang::ast_matchers::in

ternal::BoundNodesTreeBuilder*,
clang::ast_matchers::internal::ASTMatchFinder::BindKind)':

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:705:9: warning: typedef 'unsupported_type_for_rec

ursive_matching' locally defined but not used [-Wunused-local-typedefs]

         unsupported_type_for_recursive_matching);

         ^

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:57:39: note: in definition of macro 'TOOLING_COMP

ILE_ASSERT'

   typedef CompileAssert<(bool(Expr))> Msg[bool(Expr) ? 1 : -1]

                                       ^

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h: In member function 'bool clang::ast_matchers::in

ternal::ASTMatchFinder::matchesAncestorOf(const T&, const
clang::ast_matchers::internal::DynTypedMatcher&,
clang::ast_matchers::inte

rnal::BoundNodesTreeBuilder*,
clang::ast_matchers::internal::ASTMatchFinder::AncestorMatchMode)':

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:718:28: warning: typedef 'only_Decl_or_Stmt_allow

ed_for_recursive_matching' locally defined but not used
[-Wunused-local-typedefs]

 
only_Decl_or_Stmt_allowed_for_recursive_matching);

                            ^

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:57:39: note: in definition of macro 'TOOLING_COMP

ILE_ASSERT'

   typedef CompileAssert<(bool(Expr))> Msg[bool(Expr) ? 1 : -1]

                                       ^

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h: In member function 'clang::ast_matchers::interna

l::PolymorphicMatcherWithParam0<MatcherT, ReturnTypesF>::operator
clang::ast_matchers::internal::Matcher<From>() const':

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:863:28: warning: typedef 'right_polymorphic_conve

rsion' locally defined but not used [-Wunused-local-typedefs]

                            right_polymorphic_conversion);

                            ^

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:57:39: note: in definition of macro 'TOOLING_COMP

ILE_ASSERT'

   typedef CompileAssert<(bool(Expr))> Msg[bool(Expr) ? 1 : -1]

                                       ^

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h: In member function 'clang::ast_matchers::interna

l::PolymorphicMatcherWithParam1<MatcherT, P1, ReturnTypesF>::operator
clang::ast_matchers::internal::Matcher<From>() const':

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:881:28: warning: typedef 'right_polymorphic_conve

rsion' locally defined but not used [-Wunused-local-typedefs]

                            right_polymorphic_conversion);

                            ^

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:57:39: note: in definition of macro 'TOOLING_COMP

ILE_ASSERT'

   typedef CompileAssert<(bool(Expr))> Msg[bool(Expr) ? 1 : -1]

                                       ^

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h: In member function 'clang::ast_matchers::interna

l::PolymorphicMatcherWithParam2<MatcherT, P1, P2,
ReturnTypesF>::operator clang::ast_matchers::internal::Matcher<From>()
const':

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:902:28: warning: typedef 'right_polymorphic_conve

rsion' locally defined but not used [-Wunused-local-typedefs]

                            right_polymorphic_conversion);

                            ^

C:/cmd_line_tools/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchers
Internal.h:57:39: note: in definition of macro 'TOOLING_COMP

ILE_ASSERT'

   typedef CompileAssert<(bool(Expr))> Msg[bool(Expr) ? 1 : -1]

                                       ^

c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w6
4-mingw32/bin/as.exe: CMakeFiles/clangDynamicASTMatchers.dir

/Registry.cpp.obj: too many sections (39110)

C:\Users\DennisC\AppData\Local\Temp\cc811i4n.s: Assembler messages:

C:\Users\DennisC\AppData\Local\Temp\cc811i4n.s: Fatal error: can't write
CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.obj: Fi

le too big

c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w6
4-mingw32/bin/as.exe: CMakeFiles/clangDynamicASTMatchers.dir

/Registry.cpp.obj: too many sections (39110)

C:\Users\DennisC\AppData\Local\Temp\cc811i4n.s: Fatal error: can't close
CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.obj: Fi

le too big

tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.d
ir/build.make:130: recipe for target `tools/clang/lib/ASTMat

chers/Dynamic/CMakeFiles/clangDynamicASTMatchers.dir/Registry.cpp.obj'
failed

make[2]: ***
[tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.
dir/Registry.cpp.obj] Error 1

CMakeFiles/Makefile2:10926: recipe for target
`tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.
dir/all' faile

d

make[1]: ***
[tools/clang/lib/ASTMatchers/Dynamic/CMakeFiles/clangDynamicASTMatchers.
dir/all] Error 2

Makefile:136: recipe for target `all' failed

make: *** [all] Error 2

 

Thanks for any help you can offer.

 

Dennis Cote

 

From: G M [mailto:gmisocpp at gmail.com] 
Sent: October 10, 2013 8:26 PM
To: cfe-dev; Dennis Cote
Subject: [cfe-dev] building LLVM/Clang on Windows 7 x64 using MinGW/MSYS

 

Does this patch fix the problem for you?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131018/ba042343/attachment.html>


More information about the cfe-dev mailing list