-
Notifications
You must be signed in to change notification settings - Fork 552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sccache fails compiling ObjC code with a .cpp extension and -xobjective-c++ #163
Comments
hum, you should use the flag that was passed for the preprocessor, but the compilation will need a mapped value for the preprocessed output. |
Well if there's already an I guess your point is that we ought to be replacing |
except for all the warnings that adds. |
See #117 (comment) |
Out of curiosity, are there any workarounds for this bug while a proper fix is developed? |
The work-around I'm aware of is to use |
Cool, thanks @rillian. For the folks who don't want to look up the dev-platform thread, this appears to be what you want to drop in your mozconfig for now:
Assuming sccache is on your PATH. |
@glandium are you actively working on this? If not I'll take it. |
I am |
First and foremost, to generically convey the type of compilation, we normalize the file extension, and will use that information to feed the right -x argument to the preprocessor and compiler. When the compiler command sccache is invoked with already contains a -x argument, we set the normalized file extension accordingly, such that it matches what the caller wants, rather than what the source file extension says. On the preprocessor end, we then always pass one of `-x c`, `-x c++`, `-x objective-c` or `-x objective-c++` according to the normalized file extension. On the compiler end, we always pass one of `-x cpp-output`, `-x c++-cpp-output`, `-x objective-c-cpp-output` or `-x objective-c++-cpp-output` accordingly. Note that we used to pass `-x objc-cpp-output` to gcc, but that's a deprecated form that it now warns about. The new form has been available since at least gcc 4.3, so is fine to use. And because a same source compiled as C or C++ will yield different object code, include the normalized extension when computing the hashed value. Fixes mozilla#163.
First and foremost, to generically convey the type of compilation, we normalize the file extension, and will use that information to feed the right -x argument to the preprocessor and compiler. When the compiler command sccache is invoked with already contains a -x argument, we set the normalized file extension accordingly, such that it matches what the caller wants, rather than what the source file extension says. On the preprocessor end, we then always pass one of `-x c`, `-x c++`, `-x objective-c` or `-x objective-c++` according to the normalized file extension. On the compiler end, we always pass one of `-x cpp-output`, `-x c++-cpp-output`, `-x objective-c-cpp-output` or `-x objective-c++-cpp-output` accordingly. Note that we used to pass `-x objc-cpp-output` to gcc, but that's a deprecated form that it now warns about. The new form has been available since at least gcc 4.3, so is fine to use. And because a same source compiled as C or C++ will yield different object code, include the normalized extension when computing the hashed value. Fixes mozilla#163.
First and foremost, to generically convey the type of compilation, we normalize the file extension, and will use that information to feed the right -x argument to the preprocessor and compiler. When the compiler command sccache is invoked with already contains a -x argument, we set the normalized file extension accordingly, such that it matches what the caller wants, rather than what the source file extension says. On the preprocessor end, we then always pass one of `-x c`, `-x c++`, `-x objective-c` or `-x objective-c++` according to the normalized file extension. On the compiler end, we always pass one of `-x cpp-output`, `-x c++-cpp-output`, `-x objective-c-cpp-output` or `-x objective-c++-cpp-output` accordingly. Note that we used to pass `-x objc-cpp-output` to gcc, but that's a deprecated form that it now warns about. The new form has been available since at least gcc 4.3, so is fine to use. And because a same source compiled as C or C++ will yield different object code, include the normalized extension when computing the hashed value. Fixes mozilla#163.
Reported on IRC, sccache is failing to build Firefox on Mac currently with some errors in OpenVR code. The OpenVR code is in .cpp files, but includes OS X system headers that use ObjC. The moz.build file passes
-xobjective-c++
inCXXFLAGS
, but sccache always passes-xwhatever
based on the file extension:sccache/src/compiler/gcc.rs
Line 311 in 6267caf
We should fix this so that if there's already an
-xwhatever
on the commandline we don't add another one.The text was updated successfully, but these errors were encountered: