Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 502456 - www-client/chromium fails to build with clang
Summary: www-client/chromium fails to build with clang
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Chromium Project
URL:
Whiteboard: ht-wanted
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-26 00:57 UTC by account-removed
Modified: 2019-11-09 08:26 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description account-removed 2014-02-26 00:57:43 UTC
Chromium can be built using clang, but it requires more setting up than a simple export of CC and CXX (see https://code.google.com/p/chromium/wiki/Clang ).

I suggest to add an llvm (since it's used in a similar way in mesa) (alternatively, use add the clang flag? ) USE flag to chromium to allow those who wish to compile it using it.

I tested  to make sure that chromium fails to compile (build log included). The error that fails the build is that the copying parameter of type WebCore::MediaQueryEvaluator invokes a deleted constructor.

My emerge --info is here: https://gist.github.com/9221238

To build chromium with clang I use the basic environment file (flaggie chromium +clang), in which I export CC=clang and CXX=clang++
Comment 2 account-removed 2014-03-01 18:51:35 UTC
What we could possibly do is add a new category (ala PYTHON_TARGETS PYTHON_SINGLE_TARGET).
Something along the lines of:
COMPILERS="gcc clang" (defined in profile per-system, so gentoo/alt will be happy too)
then
TARGET_COMPILER="clang" (has to be exactly one of COMPILERS)

then whatever fails with compiler X you can simply override it to target_compiler_gcc use flag, for example.
Comment 3 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2014-03-01 18:55:04 UTC
With chromium-33.0.1750.117 I'm getting a different error (34 is the same as 35):

../../third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp:1212:50: error: copying parameter of type 'WebCore::MediaQueryEvaluator' invokes deleted constructor
    ruleSet->addRulesFromSheet(styleSheet.get(), MediaQueryEvaluator("screen"));
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/WebKit/Source/core/css/MediaQueryEvaluator.h:55:26: note: function has been explicitly marked deleted here
    WTF_MAKE_NONCOPYABLE(MediaQueryEvaluator); WTF_MAKE_FAST_ALLOCATED;
                         ^
../../third_party/WebKit/Source/wtf/Noncopyable.h:29:13: note: expanded from macro 'WTF_MAKE_NONCOPYABLE'
            ClassName(const ClassName&) = delete; \
            ^
150 warnings and 1 error generated.

And again, IMHO the code should just compile with no explicit setting like "compile for gcc" or "compile for clang" or "override the compiler to be gcc even though the user asked for clang". We're going to address the compile issue and respect the user's choice.
Comment 4 Mike Gilbert gentoo-dev 2014-03-01 19:01:04 UTC
Making this work automatically in the upstream build system is certainly a good goal.

However, until that happens, it makes sense deal with it in the ebuild rather than ignoring the problem until the ideal solution is committed upstream.

I'm not saying that you should spend much time on it, but if a user submits a reasonable patch I don't think we should reject it on the basis that it isn't automagic enough.
Comment 5 account-removed 2014-03-01 19:19:41 UTC
Any way I can help the development upstream? I'd be actually interested. (btw I'm currently moving most of my system over to clang as said in Description, and I have a semi-automated system to do so now, I'll submit it later)
Comment 6 Cănărău Constantin 2014-03-02 09:29:32 UTC
To be able to compile chromium with llvm it would be great for my poor AMD E-350:

 * www-client/chromium

     Sat Mar  1 16:56:33 2014 >>> www-client/chromium-34.0.1847.14
       merge time: 6 hours, 2 minutes and 16 seconds.


Firefox, Thunderbird and Libreoffice compile times were reduced with ~33% when I switched to clang. 
I do not like binary versions, either google chrome, despite that installing them would be less time consumming. 

I'll try to compile ebuild chromium phase and export vars to be able to use llvm. I'll report back.
Comment 7 Cănărău Constantin 2014-03-02 10:51:26 UTC
Exporting GYP_DEFINES=clang=1 during phases it's not enought. Silly assumption :)
Comment 8 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2014-03-03 04:49:56 UTC
(In reply to Mike Gilbert from comment #4)
> Making this work automatically in the upstream build system is certainly a
> good goal.
> 
> However, until that happens, it makes sense deal with it in the ebuild
> rather than ignoring the problem until the ideal solution is committed
> upstream.
> 
> I'm not saying that you should spend much time on it, but if a user submits
> a reasonable patch I don't think we should reject it on the basis that it
> isn't automagic enough.

Agreed. Feel free to apply such a patch, I can also do that when someone posts it.
Comment 11 Cănărău Constantin 2015-02-25 21:52:40 UTC
I can confirm that it works, also.
Thank you!
Comment 12 Joe Kappus 2015-02-27 00:13:17 UTC
Also confirming, was getting a fail on 41, but 42+ seems ok for building with clang!
Comment 13 Paweł Hajdan, Jr. (RETIRED) gentoo-dev 2015-04-22 01:27:03 UTC
42 is now stable, closing.
Comment 14 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-11-09 08:25:10 UTC
[Redacting #1 to remove PII]

(In reply to Paweł Hajdan, Jr. (RETIRED) from comment #1)
> (In reply to [redacted] from comment #0)
> > I tested  to make sure that chromium fails to compile (build log included).
> > The error that fails the build is that the copying parameter of type
> > WebCore::MediaQueryEvaluator invokes a deleted constructor.
> 
> I don't see any build log attached (you may need to xz-compress it to fit
> within the attachment limit).
> 
> Here's what I get with chromium-35.0.1862.2 and clang-3.4-r100:
> 
> ../../net/disk_cache/v3/entry_impl_v3.cc:1394:61: error: cannot pass object
> of non-POD type 'disk_cache::Addr' through variadic function; call will
> abort at runtime [-Wnon-pod-varargs]
>   Trace("%s 0x%p 0x%x", msg, reinterpret_cast<void*>(this), address_);
>                                                             ^
> 68 warnings and 1 error generated.
> 
> Note that I'd like to avoid having explicit USE flags for building with
> clang, see e.g. bug #422829 .
Comment 15 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-11-09 08:26:32 UTC
[Redacting two more]

(In reply to Paweł Hajdan, Jr. (RETIRED) from comment #9)
>   19 Feb 2015; Pawel Hajdan jr
>   chromium-42.0.2305.3.ebuild:
>   Fix build with clang, bug #502456 by [redacted]
> 
> Example usage: CC=clang CXX=clang++ BUILD_CC=clang BUILD_CXX=clang++ emerge
> -1av chromium
> 
> I plan to keep the bug open until the fix gets to stable.
> 
> Please test and confirm whether it works for you.

(In reply to Petr Vaněk from comment #10)
> (In reply to Paweł Hajdan, Jr. from comment #9)
> >   19 Feb 2015; Pawel Hajdan jr
> >   chromium-42.0.2305.3.ebuild:
> >   Fix build with clang, bug #502456 by [redacted]
> > 
> > Example usage: CC=clang CXX=clang++ BUILD_CC=clang BUILD_CXX=clang++ emerge
> > -1av chromium
> > 
> > I plan to keep the bug open until the fix gets to stable.
> > 
> > Please test and confirm whether it works for you.
> 
> It works for me.