Closed
Bug 1032528
Opened 11 years ago
Closed 11 years ago
With clang-cl, the linker major version does not match the compiler suite version
Categories
(Firefox Build System :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla33
People
(Reporter: away, Assigned: ehsan.akhgari)
References
Details
Attachments
(1 file)
|
1.28 KB,
patch
|
glandium
:
review+
away
:
feedback+
|
Details | Diff | Splinter Review |
I started with |cmake -G "Visual Studio 12" ..\llvm|. I confirmed that LLVM.sln is "Format Version 12.00". Then I built that with VC12 (VS2013). But it looks like my clang-cl still thinks that it's version 11. When configure sees it mixed with the VC12 linker, it complains:
0:14.54 configure: error: The linker major version, 12.00.30501.0, does not match the compiler suite version, 11.
Comment 1•11 years ago
|
||
Clang is defaults to identifing as VC11. You can change that with -fmsc-version=vc12, but I have not tested this, so there may be other problems.
0:14.35 error(clang): invalid value 'vc12' in '-fmsc-version=vc12'
The help says:
-fmsc-version=<value> Microsoft compiler version number to report in _MSC_VER (0 = don't define it (default))
The _MSC_VER for VC12 is 1800 so I tried that instead. Still the same error as comment 0. (Though is that even the right thing to do? Do we want _MSC_VER at all in these builds?)
| Assignee | ||
Comment 3•11 years ago
|
||
(In reply to David Major [:dmajor] from comment #2)
> 0:14.35 error(clang): invalid value 'vc12' in '-fmsc-version=vc12'
>
> The help says:
> -fmsc-version=<value> Microsoft compiler version number to report in
> _MSC_VER (0 = don't define it (default))
>
> The _MSC_VER for VC12 is 1800 so I tried that instead. Still the same error
> as comment 0.
Hmm, try adding -fmsc-version=1800 to CFLAGS and CXXFLAGS exports in your mozconfig?
> (Though is that even the right thing to do? Do we want
> _MSC_VER at all in these builds?)
Yes, we do! clang-cl tries to be a drop-in replacement for cl.exe.
| Assignee | ||
Updated•11 years ago
|
Component: General → Build Config
Flags: needinfo?(dmajor)
> Hmm, try adding -fmsc-version=1800 to CFLAGS and CXXFLAGS exports in your
> mozconfig?
Er, that's what I tried in comment 2, unless I'm misunderstanding your request.
Flags: needinfo?(dmajor)
| Assignee | ||
Comment 5•11 years ago
|
||
(In reply to David Major [:dmajor] from comment #4)
> > Hmm, try adding -fmsc-version=1800 to CFLAGS and CXXFLAGS exports in your
> > mozconfig?
>
> Er, that's what I tried in comment 2, unless I'm misunderstanding your
> request.
Weird... What do you get if you run these commands?
echo _MSC_VER test.c
clang-cl -E -fmsc-version=1800 test.c
I get 1800, but I suspect you will see 1700?
Do you know which LLVM commit your clang-cl has been built from?
| Assignee | ||
Updated•11 years ago
|
Flags: needinfo?(dmajor)
| Assignee | ||
Comment 6•11 years ago
|
||
Also, can you please paste your mozconfig here again? I can't find the link you gave me the other day...
> I get 1800, but I suspect you will see 1700?
$ clang-cl -E -fmsc-version=1800 test.c
#line 1 "test.c"
#line 1 "<built-in>"
#line 1 "<built-in>"
#line 151 "<built-in>"
#line 1 "<command line>"
#line 1 "<built-in>"
#line 1 "test.c"
1800
> Do you know which LLVM commit your clang-cl has been built from?
I don't have the exact commit. It was tip from roughly June 26.
> Also, can you please paste your mozconfig here again?
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objclang
export CC=clang-cl
export CXX=clang-cl
export CFLAGS="-fallback -fmsc-version=1800"
export CXXFLAGS="-fallback -fmsc-version=1800"
export MOZ_CFLAGS_NSS="-fallback -fmsc-version=1800"
export MOZILLA_OFFICIAL=1
ac_add_options --enable-crashreporter
ac_add_options --enable-release
Flags: needinfo?(dmajor)
I got it working if I change CC/CXX to:
export CC="clang-cl -fmsc-version=1800"
export CXX="clang-cl -fmsc-version=1800"
(Or at least it gets past that part of configure.)
I think it's because of: http://dxr.mozilla.org/mozilla-central/source/build/autoconf/toolchain.m4#29
| Assignee | ||
Comment 9•11 years ago
|
||
(In reply to David Major [:dmajor] from comment #8)
> I got it working if I change CC/CXX to:
>
> export CC="clang-cl -fmsc-version=1800"
> export CXX="clang-cl -fmsc-version=1800"
>
> (Or at least it gets past that part of configure.)
Wow!!
> I think it's because of:
> http://dxr.mozilla.org/mozilla-central/source/build/autoconf/toolchain.m4#29
Oh yes, you're absolutely right! I wrote that code. :(
Assignee: nobody → ehsan
| Assignee | ||
Comment 10•11 years ago
|
||
This for example allows us to use -fmsc-version in CFLAGS/CXXFLAGS
with clang-cl.
| Assignee | ||
Comment 11•11 years ago
|
||
Comment on attachment 8450746 [details] [diff] [review]
Use CFLAGS when determining the compiler version in case it can be affected by what is there; r=glandium
David, do you mind testing this please?
Attachment #8450746 -
Flags: review?(mh+mozilla)
Attachment #8450746 -
Flags: feedback?(dmajor)
| Reporter | ||
Comment 12•11 years ago
|
||
Comment on attachment 8450746 [details] [diff] [review]
Use CFLAGS when determining the compiler version in case it can be affected by what is there; r=glandium
Review of attachment 8450746 [details] [diff] [review]:
-----------------------------------------------------------------
s/CXXFLAGC/CXXFLAGS/
With that change, and my mozconfig reverted to comment 7, it works.
Attachment #8450746 -
Flags: feedback?(dmajor) → feedback+
Comment 13•11 years ago
|
||
Comment on attachment 8450746 [details] [diff] [review]
Use CFLAGS when determining the compiler version in case it can be affected by what is there; r=glandium
Review of attachment 8450746 [details] [diff] [review]:
-----------------------------------------------------------------
::: build/autoconf/toolchain.m4
@@ +30,3 @@
> EOF
> read dummy cxxcompiler CXX_VERSION <<EOF
> +$($CXX -E $CXXFLAGC conftest.c 2>/dev/null | grep COMPILER)
CXXFLAGS
Attachment #8450746 -
Flags: review?(mh+mozilla) → review+
| Assignee | ||
Comment 14•11 years ago
|
||
| Assignee | ||
Comment 15•11 years ago
|
||
| Assignee | ||
Comment 16•11 years ago
|
||
Ah, of course we want CPPFLAGS too.
https://hg.mozilla.org/integration/mozilla-inbound/rev/d6ae573ff152
Comment 17•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
Updated•8 years ago
|
Product: Core → Firefox Build System
You need to log in
before you can comment on or make changes to this bug.
Description
•