FS#47113 - [cmake] "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set" when using -flto

Attached to Project: Arch Linux
Opened by Earnestly (Earnest) - Wednesday, 18 November 2015, 17:14 GMT
Last edited by Felix Yan (felixonmars) - Friday, 20 November 2015, 09:44 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Felix Yan (felixonmars)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Since upgrading to cmake 3.4.0-1 every single cmake project I package returns this error message:

-- The C compiler identification is GNU 5.2.0
CMake Error at /usr/share/cmake-3.4/Modules/Compiler/GNU-C.cmake:28 (message):
CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for GNU (/usr/bin/cc)
version 5.2.0
Call Stack (most recent call first):
/usr/share/cmake-3.4/Modules/CMakeCInformation.cmake:33 (include)
CMakeLists.txt:2 (PROJECT)


-- Configuring incomplete, errors occurred!

This appears to be a recent change and I've not been successful in trying to diagnose the issue myself.

I believe this commit introduced it: https://cmake.org/pipermail/cmake-commits/2015-September/024954.html
A (potentially related) regression was discussed here: https://cmake.org/pipermail/cmake-developers/2015-September/026496.html
This task depends upon

Closed by  Felix Yan (felixonmars)
Friday, 20 November 2015, 09:44 GMT
Reason for closing:  Fixed
Additional comments about closing:  3.4.0-2
Comment by Doug Newgard (Scimmia) - Thursday, 19 November 2015, 03:55 GMT
I just built qgis without a problem. Got a specific example?
Comment by Earnestly (Earnest) - Thursday, 19 November 2015, 04:02 GMT
Every cmake project from antimicro, to wlc, to orbment, to include-what-you-use and more (everything default). It's strange because others can build them (PKGBUILDs) but I get this error.

I'll have to try and investigate, perhaps asking #cmake on freenode as well. I don't know cmake to understand this and was hoping the maintainer would know where to look.
Comment by Doug Newgard (Scimmia) - Thursday, 19 November 2015, 04:10 GMT
Does it work correctly for you in a clean chroot?

I tested with antimicro, is $srcdir/antimicro-2.20.2/build/CMakeFiles/CMakeOutput.log being saved? It could give you more info.
Comment by Alexandre Bique (babali) - Thursday, 19 November 2015, 16:54 GMT
I got the issue also, happened when I did:

# CLANG
ln -s /bin/ld.gold bin/ld
ln -s /bin/clang bin/cc
ln -s /bin/clang++ bin/c++
ln -s /bin/llvm-ar bin/ar
ln -s /bin/llvm-nm bin/nm
ln -s /bin/true bin/ranlib


(Setting a bin directory for LTO).
Comment by Alexandre Bique (babali) - Thursday, 19 November 2015, 16:55 GMT
But that bug is not low priority to me, rather normal or high.
Comment by Arthur Zamarin (arthurzam) - Thursday, 19 November 2015, 17:16 GMT
I got this error also.
For now, my temporary fix is to add those arguments to every cmake call
-DCMAKE_C_STANDARD_COMPUTED_DEFAULT=GNU -DCMAKE_CXX_STANDARD_COMPUTED_DEFAULT=GNU

My system is x86_64, latest updated Arch.
Comment by Earnestly (Earnest) - Thursday, 19 November 2015, 18:11 GMT
@Scimmia
The output, even the cache output, is unfortunately completely useless.

The output ends almost exactly as the output posted, the only possible notable thing about this is that cmake (as usual) detects /usr/bin/cc, which is (as usual) a symlink to gcc (and making this a hardlink doesn't help, in case there was some symlink issues).

However, for the sake of it, here is the cmake output file from my wlc PKGBUILD: https://ptpb.pw/hViv

Edit: I have found the cause. It was actually having -flto in the CFLAGS. See http://public.kitware.com/pipermail/cmake-developers/2015-November/026993.html

The link above also contains a patch https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=716a09b9 which is apparently going to be included in 3.4.1's release.
Comment by Alexandre Bique (babali) - Thursday, 19 November 2015, 18:14 GMT
Thank you Arthur for the work around!
Comment by Felix Yan (felixonmars) - Friday, 20 November 2015, 06:05 GMT
Please let me know if the patched package works:

http://pkgbuild.com/~fyan/staging/cmake-3.4.0-2-x86_64.pkg.tar.xz
Comment by Earnestly (Earnest) - Friday, 20 November 2015, 09:07 GMT
felixonmars:
It works for all my cmake based packages

Loading...