1

I was compiling Clang 15.0 for my cygwin x86_64. I have done compiling of LLVM and solve same errors on clang compilation starting. I really understand php, not C, but assembler it to hard for me to understand what it wont from me))) what magick thin i must to do for it?

[ 36%] Creating a CXX lib/AST/CMakeFiles/obj.clangAST.dir/ParentMapContext.cpp.o
/usr/lib/gcc/x86_64-pc-cygwin object/11/../../../../ x86_64-pc-cygwin/bin/as: CMakeFiles/obj.clangAST.dir/ParentMapContext.cpp.o: too many partitions (38098)
/tmp/ccinbYJw.s: Assembler messages:
/tmp/ccinbYJw.s: Critical error: 61 bytes could not be written to the partition .text from CMakeFiles/obj.clangAST.dir/ParentMapContext.cpp.o: "the file is too big"
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../ x86_64-pc-cygwin/bin/as: CMakeFiles/obj.clangAST.dir/ParentMapContext.cpp.o: too many partitions (38098)
/tmp/ccinbYJw.s: Critical error: CMakeFiles/obj.clangAST.dir/ParentMapContext.cpp.o: the file is too large
make[2]: *** [lib/AST/CMakeFiles/obj.clangAST.dir/build.make:524: lib/AST/CMakeFiles/obj.clangAST.dir/ParentMapContext.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:7874: lib/AST/CMakeFiles/obj.clangAST.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Here is cpp file which we a going to speack https://www.dropbox.com/s/d7j22shmc6ig394/ParentMapContext.cpp?dl=0

Ryufuz
  • 11
  • 3
  • If it's not a bug in GCC or GAS, it could be a problem in clang 15 that leads to a huge object file, apparently bigger than whatever limit GAS or the object-file format imposes. Can you narrow this down to a [mcve] of `ParentMapContext.cpp` and some cygwin GCC version/options? – Peter Cordes Jun 11 '22 at 22:30
  • I can to download it to my dropbox https://www.dropbox.com/s/d7j22shmc6ig394/ParentMapContext.cpp?dl=0 for inspecting (sorry for bad English but i try to write carefully))) – Ryufuz Jun 11 '22 at 22:44
  • That's not complete on its own; it has some `#include`s of internal clang headers. If I just wanted to grab files out of a recent clang/LLVM, I'd look at their github repo, https://github.com/llvm/llvm-project/blob/323c67278987538bf53eec281fe767504450ca33/clang/lib/AST/ParentMapContext.cpp. It's also a whole file with a bunch of stuff in it; removing things to narrow down which are "innocent" or not is the point of a MCVE. (Although if it's really a case of everything together adding up to too much space, that's less meaningful. But if it's one bad template expansion or something...) – Peter Cordes Jun 11 '22 at 22:51
  • `gcc -E` can be useful for this, to preprocess the source and make one flat file that should compile on its own. – Peter Cordes Jun 11 '22 at 22:54
  • So i need to combine all includes in one file, am i understand it right? – Ryufuz Jun 11 '22 at 22:58
  • If you're going to report a GCC bug about source that it fails to compile, yeah, that's the normal approach, reduce everything down to 1 flat file. And simplify the file as much as possible while still reproducing the error. i.e. remove everything you can without removing the part that stops it from compiling. Same for making a [mcve] for your Stack Overflow question. (Finding something suspicious in the `.s` asm output would also be interesting, like some hugely repeating set of lines; IDK. But probably the assembler is correct to reject whatever it's rejecting.) – Peter Cordes Jun 11 '22 at 23:04
  • Hm..... some thing wrong. in my AST folder there are no any one of this files #include "clang/AST/ParentMapContext.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/Decl.h" #include "clang/AST/Expr.h" #include "clang/AST/TemplateBase.h" – Ryufuz Jun 11 '22 at 23:07
  • The build very likely uses `-I` or `-i` to set include paths, so those don't have to be relative to the directory where ParentMapContext.cpp is located. Probably just use `gcc -E` instead of `-c` but otherwise the same command line cmake was using. Or add `-save-temps` to the cmakefile. – Peter Cordes Jun 11 '22 at 23:09
  • oh i try to add -save-temps to cmake file and it start from tje begining..... it would take some time) – Ryufuz Jun 11 '22 at 23:20
  • you could probably just have deleted this one `.o`, or not even that since if the assembler deleted it after running into errors. Unless cmake treats all files as having a dependency on changes to the makefile. – Peter Cordes Jun 11 '22 at 23:22
  • oh i find it in cmake file? i dont pay attention on this but now i find it: # FIXME: the entry points to the interpreter should be moved out of clangAST # into the parser or Sema in order to allow the interpreter to be moved to # another library which depends on clangAST. – Ryufuz Jun 11 '22 at 23:34
  • i have translate it and understend next " the entry points to the interpreter should be moved out of clangAST # into the parser or Sema " is what i need to do? where can i find a good instraction how to do this. i not sure i will do it correctly – Ryufuz Jun 11 '22 at 23:39
  • so i have move the folder Interp from AST folder to Semafolder, is it what i need? – Ryufuz Jun 11 '22 at 23:45
  • yahoooo! i got 37% of compilation))))) – Ryufuz Jun 11 '22 at 23:54
  • You're looking for a file you can compile with `g++ -O2 -c foo.cpp` which reproduces this error message, like that you could include in your SO question so people can try it on their own systems. Probably it will be called `ParentMapContext.ii`, since `.ii` is the normal extension GCC picks for pre-processed C++. – Peter Cordes Jun 11 '22 at 23:54
  • NOPE ITS COME AGAIN=( – Ryufuz Jun 12 '22 at 00:01
  • ok i wil try to do my best with this probleb? all of you give me good answers its time for good trenslation and thinking..... Thx! – Ryufuz Jun 12 '22 at 00:08
  • Nothing I was suggesting is going to make it actually compile, just identify which part cygwin GCC is having a problem with so you can report a GCC bug with a reproducible test-case. – Peter Cordes Jun 12 '22 at 00:45
  • export CMAKE_CXX_FLAGS_RELEASE="-DNRELEASE -fto -O2" Make some deal i have reach 53% after error come again thats my sreenshot of progress https://www.dropbox.com/s/e1r22qfs6dgdq7e/Screen_shot.png?dl=0 – Ryufuz Jun 12 '22 at 03:54
  • https://www.dropbox.com/s/jnkb03lh07aw3sh/Screen_shot2.png?dl=0 – Ryufuz Jun 12 '22 at 04:08
  • Now you're getting a slightly different "the file is too big" error on all your files, now 'file too big'? And "too many sections" instead of "too many partitions". I had been assuming there was something in this file specifically that was a problem since you only posted an error message about one .cpp file in this question, but it sounds like these build options are a problem in general for cygwin gcc. Perhaps `-flto` is making it use lots of sections to keep the GIMPLE bytecode? Building without `-flto` would be worse for performance, but might work. – Peter Cordes Jun 12 '22 at 04:14
  • So how can i make bugreport for this error? i have never do it later... – Ryufuz Jun 12 '22 at 04:17
  • https://gcc.gnu.org/bugs/ explains what GCC wants in a bug report. As far as a test-case, it's very similar to SO's [mcve] guidelines. Like I said multiple times, you're going to want a single `.ii` file that causes this error when you try to compile it with some GCC command line. The shorter the better, so keep removing functions and declarations until the error goes away, then undo the last removal. (Or perhaps start by removing nearly everything, to see if it still happens with a trivial file.) – Peter Cordes Jun 12 '22 at 04:26
  • This may actually be a known bug/limitation: [mingw "too many sections" bug while compiling huge header file in Qt](https://stackoverflow.com/q/31890021) was the first thing that came up when googling for the actual English error message from your screenshot (`cygwin gcc "-flto" "too many sections"`). Was "too many partitions" auto-translated from something else, or does some other version of GCC actually say that? – Peter Cordes Jun 12 '22 at 04:53

0 Answers0