As noted in the https://bugs.gentoo.org/668370, chromium 70+ has troubles building with GCC, therefore current ebuilds enforce clang. I have managed to work through all errors and collect patches to build Chromium end-to-end with GCC and would like to integrate that into current ebuilds.
Created attachment 552824 [details, diff] Patch to fix invalid type aliasing Fixing: error: changes meaning of 'SnapContainerData' from 'using SnapContainerData = class cc::SnapContainerData' [-fpermissive] using SnapContainerData = cc::SnapContainerData;
Created attachment 552826 [details, diff] Patch to fix Blink building issues Fixes constexpr function call to non-constexpr function.
Created attachment 552828 [details, diff] Patch to fix omnibox build Fixes: error: no match for 'operator=' (operand types are '{anonymous}::ApplyTextStyleForType(SuggestionAnswer::TextStyle, OmniboxResultView*, gfx::RenderText*, const gfx::Range&)::TextStyleNewAnswers' and '<brace-enclosed initializer list>') style = {part_color, .weight = gfx::Font::Weight::BOLD}; ^ ../../chrome/browser/ui/views/omnibox/omnibox_text_view.cc:148:10: note:
Patches attached are enough to build chromium 70.0.3538.67 with GCC. Thanks to Mike Gilbert for introducing CHROMIUM_FORCE_CLANG and making it easy to switch between compilers, although it doesn't work for me through command-line. Patches were sourced from the following locations and verified to be reasonable: 1. https://chromium.googlesource.com/chromium/src/+/e98f8ef8b2f236ecbb01df8c39e6ee1c8fbe8d7d 2. https://chromium.googlesource.com/chromium/src/+/87902b3202f81d689dd314c17006ffc907fe12a1 3. https://crrev.com/c/1213181 For now I have just tested all this with 70 version and just one single combination of flags. I plan to build 71 and test different flag combinations as well.
While working on fixing issues with chromium 71 I stumbled upon a very helpful page that tracks issues with building chromium using GCC and relevant patches: https://bugs.chromium.org/p/chromium/issues/detail?id=819294 hope that will be helpful. Now, I have managed to successfully build Chromium 71 with GCC. It is important to note that following unstable dependencies are required in order to successfully build it: >=dev-libs/atk-2.26 >=app-accessibility/at-spi2-atk-2.26 >=dev-libs/re2-0.2016.11.01-r1 (unless patch to replace LazyRE2 with RE2 is applied)
Created attachment 552850 [details, diff] Chromium 71: Fix call to non-constexpr function in BasicStringPiece This fixes the GCC build, which was failing with errors such as ../../content/browser/appcache/appcache_manifest_parser.cc: In function ‘constexpr base::StringPiece content::{anonymous}::TrimToFirstNewLine(base::StringPiece)’: ../../content/browser/appcache/appcache_manifest_parser.cc:78:26: error: call to non-constexpr function ‘base::BasicStringPiece<STRING_TYPE> base::BasicStringPiece<STRING_TYPE>::substr(base::BasicStringPiece<STRING_TYPE>::size_type, base::BasicStringPiece<STRING_TYPE>::size_type) const [with STRING_TYPE = std::__cxx11::basic_string<char>; base::BasicStringPiece<STRING_TYPE>::size_type = long unsigned int]’ return data.substr(skip); ^
Created attachment 552852 [details, diff] Chromium 71: Fix incomplete type for MaterialDesignController ../../base/scoped_observer.h: In instantiation of ‘void ScopedObserver<Source, Observer>::RemoveAll() [with Source = ui::MaterialDesignController; Observer = ui::MaterialDesignControllerObserver]’: ../../base/scoped_observer.h:26:14: required from ‘ScopedObserver<Source, Observer>::~ScopedObserver() [with Source = ui::MaterialDesignController; Observer = ui::MaterialDesignControllerObserver]’ ../../chrome/browser/ui/views/frame/browser_frame.h:156:24: required from here ../../base/scoped_observer.h:45:20: error: invalid use of incomplete type ‘class ui::MaterialDesignController’ sources_[i]->RemoveObserver(observer_); ~~~~~~~~~~~~~^~~~~~~~~~~~~~
Created attachment 552854 [details, diff] Chromium 71: Fix overloaded call in VideoFrameLayout ../../media/base/video_frame.cc: In static member function ‘static scoped_refptr<media::VideoFrame> media::VideoFrame::WrapExternalStorage(media::VideoPixelFormat, media::VideoFrame::StorageType, const gfx::Size&, const gfx::Rect&, const gfx::Size&, uint8_t*, size_t, base::TimeDelta, base::ReadOnlySharedMemoryRegion*, base::UnsafeSharedMemoryRegion*, base::SharedMemoryHandle, size_t)’: ../../media/base/video_frame.cc:963:75: error: call of overloaded ‘VideoFrameLayout(media::VideoPixelFormat&, const gfx::Size&, <brace-enclosed initializer list>)’ is ambiguous {RowBytes(kYPlane, format, coded_size.width())}),
Created attachment 552856 [details, diff] Chromium 71: Remove LazyRE2 that isn't available in stable re2 package (optional) This is an optional patch that makes >=dev-libs/re2-0.2016.11.01-r1 dependency unnecessary and thus being able to build Chromium 71 with stable re2 version.
Thanks a lot for doing the research on this! I will try to review this by the weekend.
Regarding the patches for chromium 71: were these taken from the upstream source repo? If so, please provide commit ids.
I guess it's these commits: 9b3719707b8c4c46a74be5951c4ad6cce22217fc 7f14947018f6928fc71f3c6ff2af87bace04e91c 7c9af6c257d681159b8764c8d3d7b70f1d2f7d3a
It looks like those commits may already be included in 71.0.3578.20. Testing now.
Oh, sorry, my bad, forgot to mention URLs for 71. You have identified them correctly though. RE2 patch is of my own, but it is not required if you bump RE2 version to support LazyRE2. Thanks for looking into this!
Hmm, so I'm getting weird link failures for chromium 70 and 71 with gcc-8.2.0 and binutils-2.31.1. FAILED: chrome python "../../build/toolchain/gcc_link_wrapper.py" --output="./chrome" -- x86_64-pc-linux-gnu-g++ -pie -Wl,--version-script=../../build/linux/chrome.map -fPIC -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--as-needed -rdynamic -Wl,-rpath-link=. -Wl,--disable-new-dtags -Wl,-O1 -Wl,--as-needed -o "./chrome" -Wl,--start-group @"./chrome.rsp" -Wl,--end-group -latomic -ldl -lpthread -lrt -lX11 -lX11-xcb -lxcb -lXcomposite -lXcursor -lXdamage -lXext -lXfixes -lXi -lXrender -lXtst -lgmodule-2.0 -lglib-2.0 -lgobject-2.0 -lgthread-2.0 -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4 -lcups -lz -lm -lcrypt -lxml2 -lexpat -lfontconfig -ldbus-1 -lXss -lpng16 -lwebpdemux -lwebpmux -lwebp -lfreetype -ljpeg -lharfbuzz -ldrm -lXrandr -lresolv -lgio-2.0 -lopenh264 -lre2 -lasound -lsnappy -lpangocairo-1.0 -lpango-1.0 -lcairo -lpci -latk-1.0 -latk-bridge-2.0 -lminizip -latspi -lFLAC -lgtk-3 -lgdk-3 -lcairo-gobject -lgdk_pixbuf-2.0 -lxslt /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: obj/pdf/libpdf.a: error adding symbols: malformed archive collect2: error: ld returned 1 exit status
That is weird. What flags did you use to build? I'm mainly concerned about the `component-build` flag as my suspicion is that single binary linking hitting ar limits, but would like to play around and try to reproduce and see if I can isolate a root cause.
* USE: abi_x86_64 amd64 cups custom-cflags elibc_glibc hangouts kernel_linux pic proprietary-codecs pulseaudio suid tcmalloc userland_GNU widevine * FEATURES: ccache network-sandbox preserve-libs sandbox userpriv
Thanks for providing your flags and toolchain versions. I'm still trying to reproduce, messed up my chroot in process, but just fixed it and currently building.
So, I have not had issue you described with www-client/chromium-70.0.3538.67 and successfully built it. I had reach open file limit at some point and had to increase it to get past through: /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot open linker script file /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../lib64/libpthread.so: Too many open files collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
Trying to build www-client/chromium-71.0.3578.10 I also had to apply https://chromium.googlesource.com/chromium/src.git/+/65be571f6ac2f7942b4df9e50b24da517f829eec to get through
So, after setting ulimit -n to 4096 and applying the patch I mentioned above to www-client/chromium-71.0.3578.10, I was able to successfully build it with: - gcc (Gentoo 8.2.0-r4 p1.5) 8.2.0 - GNU ld (Gentoo 2.31.1 p2) 2.31.1 www-client/chromium-71.0.3578.10::gentoo was built with the following: USE="cups custom-cflags hangouts (pic) proprietary-codecs pulseaudio suid widevine -component-build -gnome-keyring -jumbo-build -kerberos (-neon) (-selinux) (-system-ffmpeg) (-system-icu) (-system-libvpx) (-tcmalloc)" L10N="am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu he hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr sv sw ta te th tr uk vi zh-CN zh-TW" One particular thing I'm curious about is "custom-cflags". Do you have any unusual options in your CFLAGS/LDFLAGS by any chance?..
When I disable ccache, I get the error about too many open files. I wonder if ccache somehow masks that error. Testing with ulimit -n 2048 today.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d430acd6636f85536169d842ebe991d2bb7825c3 commit d430acd6636f85536169d842ebe991d2bb7825c3 Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2018-11-05 00:19:33 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2018-11-05 00:20:21 +0000 www-client/chromium: beta channel bump (71.0.3578.30) Closes: https://bugs.gentoo.org/669542 Package-Manager: Portage-2.3.51_p2, Repoman-2.3.11_p27 Signed-off-by: Mike Gilbert <floppym@gentoo.org> www-client/chromium/Manifest | 2 +- ....3573.0.ebuild => chromium-71.0.3578.30.ebuild} | 17 ++++--- www-client/chromium/files/chromium-71-gcc-0.patch | 57 ++++++++++++++++++++++ 3 files changed, 69 insertions(+), 7 deletions(-) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8cee29e8bfb76d27b97f5059fe51f70aefc6c85 commit a8cee29e8bfb76d27b97f5059fe51f70aefc6c85 Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2018-10-29 02:20:33 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2018-11-05 00:20:19 +0000 www-client/chromium: allow gcc for M70 Thanks to Garry Filakhtov. Bug: https://bugs.gentoo.org/669542 Package-Manager: Portage-2.3.51_p2, Repoman-2.3.11_p27 Signed-off-by: Mike Gilbert <floppym@gentoo.org> .../chromium/chromium-70.0.3538.67-r1.ebuild | 8 +- www-client/chromium/files/chromium-70-gcc-0.patch | 70 ++++++++++++++++ www-client/chromium/files/chromium-70-gcc-1.patch | 98 ++++++++++++++++++++++ www-client/chromium/files/chromium-70-gcc-2.patch | 37 ++++++++ 4 files changed, 212 insertions(+), 1 deletion(-)
Bravo! Thanks a lot Mike!