Last Comment Bug 574346 - (clang) [meta] Support building with Clang
(clang)
: [meta] Support building with Clang
Status: RESOLVED FIXED
: meta
Product: Core
Classification: Components
Component: Build Config (show other bugs)
: unspecified
: All All
: -- normal with 4 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 854936 576355 579686 583283 583460 583485 600900 600901 601360 601974 622138 622142 622144 623116 623117 623119 623121 623122 623123 623126 623127 623129 623132 623303 624180 627979 627981 628371 628378 629815 629839 629884 630012 630649 631809 631928 632188 634745 634763 635790 638149 639204 647580 648871 648872 648873 664252 666135 671711 672501 674564 674806 686462 692782 693323 695243 707648 717713 719575 727081 727145 727220 727221 727226 727233 727595 729425 731316 731503 733721 734490 737909 740943 744543 754988 758153 764166 765381 773768 774015 774017 774018 774019 774020 774021 774022 774023 774024 774025 774028 774029 774030 774031 774033 774037 774038 774039 774040 774041 774077 774120 774671 774796 776077 776079 776085 778997 779333 784776 787730 884022 1167846
Blocks: winclang 629459
  Show dependency treegraph
 
Reported: 2010-06-24 06:53 PDT by Nomis101
Modified: 2015-05-23 03:15 PDT (History)
26 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Nomis101 2010-06-24 06:53:41 PDT
Apple is moving from GCC to LLVM/Clang. Therefore gcc-4.0 doesn't exist anymore in Xcode 4 and gcc-4.2 isn't actively maintained anymore ("...because we're just not fixing bugs in GCC anymore.", WWDC 2010 Session Video, Session 312, 6:22 min). So it is necessary to be able to build Mozilla applications with LLVM/Clang. 

To build with Clang you need Xcode 4, because only Xcode 4 includes clang++ (for Xcode 4 OS X 10.6.3 or higher is required). You also can get Clang from http://clang.llvm.org/get_started.html. Apple says building with Clang is faster, it gives a performance win, it has great user features and better error messages. Clang had successfully built the Boost library, and had passed almost all tests: http://blog.llvm.org/2010/05/clang-builds-boost.html

For more informations I recommend the WWDC 2010 Session Videos about LLVM:
http://developer.apple.com/videos/wwdc/2010/ (in the section "Developer Tools").

Note that LLVM-GCC is different to Clang:
GCC-4.2 -> Parser (GCC) / Code Generator (GCC)
LLVM-GCC -> Parser (GCC) / Code Generator (LLVM)
Clang -> Parser (Clang-LLVM) / Code Generator (LLVM)

Note to the C++ language feature:
"Clang strives to strictly conform to the C++ standard. That means it will reject invalid C++ code that another compiler may accept. If Clang reports errors in your code, please check the C++ Compatibility page to see whether they are C++-conformance bugs and how you can fix them."
http://clang.llvm.org/docs/UsersManual.html#cxx

Error messages from Clang are different from gcc error messages.
Comment 1 Nomis101 2010-06-24 06:53:53 PDT
Because Xcode 4 isn't officially released yet, I've only tested to build with
clang version 2.0 (trunk 106670)
And I found two issues. As soon as Xcode 4 is available I will test it with Xcode 4 clang version to see if it gives me the same issues.
Comment 2 Eli Friedman 2010-07-01 13:21:24 PDT
See http://llvm.org/bugs/show_bug.cgi?id=5511 ; I'm working on submitting the necessary patches.
Comment 3 Nomis101 2011-03-09 13:46:05 PST
(In reply to comment #1)
> Because Xcode 4 isn't officially released yet

Now it is, Apple has today releases Xcode 4 with clang++
http://developer.apple.com/xcode/
Comment 4 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-05-06 14:41:37 PDT
On OS X it is possible to build firefox with clang 2.9 and on Linux with 3.0. I am closing this bug. Bug 647580 tracks building with xcode 4.
Comment 5 Octoploid 2011-06-14 11:49:32 PDT
Unfortunately the Linux build with 3.0 fails:

...
var/tmp/mozilla-central/js/src/jsinterp.cpp:3467:5: error: indirect goto might cross protected scopes
    RELATIONAL_OP(<=);
    ^
/var/tmp/mozilla-central/js/src/jsinterp.cpp:3457:9: note: instantiated from:
        TRY_BRANCH_AFTER_COND(cond, 2);                                       \
        ^
/var/tmp/mozilla-central/js/src/jsinterp.cpp:3005:17: note: instantiated from:
                BRANCH(len);                                                  \
                ^
/var/tmp/mozilla-central/js/src/jsinterp.cpp:2422:9: note: instantiated from:
        DO_OP();                                                              \
        ^
/var/tmp/mozilla-central/js/src/jsinterp.cpp:2193:33: note: instantiated from:
                                JS_EXTENSION_(goto *jumpTable[op]);           \
                                ^
/var/tmp/mozilla-central/js/src/jsinterp.cpp:3467:5: note: instantiated from:
    RELATIONAL_OP(<=);
    ^
/var/tmp/mozilla-central/js/src/jsinterp.cpp:3457:9: note: instantiated from:
        TRY_BRANCH_AFTER_COND(cond, 2);                                       \
        ^
/var/tmp/mozilla-central/js/src/jsinterp.cpp:3005:17: note: instantiated from:
                BRANCH(len);                                                  \
                ^
/var/tmp/mozilla-central/js/src/jsinterp.cpp:2422:9: note: instantiated from:
        DO_OP();                                                              \
        ^
...
Comment 6 :Ehsan Akhgari 2011-06-14 14:32:43 PDT
(In reply to comment #5)
> Unfortunately the Linux build with 3.0 fails:

See bug 664252.
Comment 7 Gregory Szorc [:gps] 2012-02-16 10:46:43 PST
Spurred by the multiple (I think it was 3) breakages of Clang/m-c in the past week or so, I set up a personal Jenkins builder to continuously build m-c using Clang. You can find the build information at http://jenkins.gregoryszorc.com:9000/

There are 4 build configurations. Each is running on Ubuntu 11.10 x64. I have debug and release builds going for each of LLVM 3.0 and LLVM built from the LLVM Subversion repository.

Currently, Jenkins will alert #pymake on build failures. If you want additional notifications (I can configure it to send email, etc), drop me a line on IRC and I'll hook you up.

Also, I make no guarantees for the availability of the service.
Comment 8 Yun Guo 2012-11-27 03:09:20 PST
Does Firefox3.6.10 supported for building with Clang? We have build errors when building firefox3.6.10 with Clang on Mac OS X Lion.
Comment 9 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2012-11-27 05:48:00 PST
(In reply to Yun Guo from comment #8)
> Does Firefox3.6.10 supported for building with Clang? We have build errors
> when building firefox3.6.10 with Clang on Mac OS X Lion.

I never tried (joined mozilla during the firefox4 days), but would be surprised if 3.6.10 would build with clang.
Comment 10 Kyle Huey [:khuey] (Exited; not receiving bugmail, email if necessary) 2012-11-27 09:25:51 PST
Building 3.6.10 with anything is not supported anymore, and has not been for months or years.

Note You need to log in before you can comment on or make changes to this bug.