quotient-im / Quaternion

A Qt-based IM client for Matrix
https://matrix.org/ecosystem/clients/quaternion/
GNU General Public License v3.0
642 stars 107 forks source link

target_compile_features no known features for CXX compiler #833

Closed ballsystemlord closed 1 year ago

ballsystemlord commented 2 years ago

Description

Quaternion doesn't detect my compiler. gcc is installed. build-essential is installed. All dependencies in the Buliding.md file are installed.

Quaternion/build % cmake -DPREFIX=/usr/local ..
-- 
-- =============================================================================
--                      Quaternion 0.0.95.1 Build Information
-- =============================================================================
-- Build type: Debug
-- Quaternion install prefix: /usr/local
-- Git SHA1: dcbfdae98ee45861aae954c92ba49d948b0728a1
-- Using compiler:  
-- Using Qt 5.15.2 at /usr
-- Using libQuotient 0.6.6 at /usr/lib/x86_64-linux-gnu/cmake/Quotient
-- Using QQuickWidget to render QML
-- =============================================================================
-- 
CMake Error at CMakeLists.txt:233 (target_compile_features):
  target_compile_features no known features for CXX compiler

  ""

  version .

-- Configuring incomplete, errors occurred!
See also "Quaternion/build/CMakeFiles/CMakeOutput.log".
See also "Quaternion/build/CMakeFiles/CMakeError.log".
% g++ --version
g++ (Debian 10.2.1-6) 10.2.1 20210110
# Snip copyright.

PS: If it helps, I have built C++ SW here before. Namely, Qulculate and it's library.

Steps to reproduce

Checkout version 0.0.95.1. Build normally. CXXFLAGS="-pipe -O2 -march=native -mtune=native" I did try deleting my build dir and starting from scratch without success. In fact, I even tried deleting the whole Quaternion directory.

I expect Quaternion to build normally.

Version information

KitsuneRal commented 2 years ago

This is rather weird - G++ 10 is certainly new enough to build Quaternion 0.0.95(.x). As CMake suggests, what do Quaternion/build/CMakeFiles/CMakeOutput.log and Quaternion/build/CMakeFiles/CMakeError.log say?

ballsystemlord commented 2 years ago

CMakeError.log CMakeOutput.log

It looks like Quaternion is trying to override my LDFLAGS variable and then fails because I know better than it what (additional), flags to pass. It's also failing a bit before that... I'm not sure what's going on there. I'm not a C++ programmer.

ballsystemlord commented 2 years ago

Here's my LDFLAGS: -Wl,-O1,--enable-new-dtags,--as-needed,-z,combreloc,--sort-common,--hash-style=both,-z,now

ballsystemlord commented 2 years ago
% cmake --version
cmake version 3.18.4

I forgot to give you this.

KitsuneRal commented 1 year ago

What makes you think it's about LDFLAGS? Quaternion does pass a few more things to the linker (because it has to) but is not supposed to override LDFLAGS.

So far I'm not really sure what's at fault but it seems something is quite wrong with your (CMake) environment. The errors log shows that the generated test .cpp files are messed up: you can't have /usr/local in that place. /usr/local is the install prefix, these .cpp files are generated by CMake - this leads me to think that some piece of your environment or command line confused CMake so much that it dumped the install prefix in an inappropriate place. That's all I can tell so far. Once I'm back at the computer, I'll check what the same file looks like when it's all fine.

ballsystemlord commented 1 year ago

I am of the understanding that PREFIX is set to your desired install location. So, I set -DPREFIX=/usr/local . It's not even documented in the man page of cmake. I dislike that about cmake. I'm always guessing what stuff does.

As it turns out, that's the problem. Now it builds fine.

KitsuneRal commented 1 year ago

That shouldn't be necessary though. To specify an install prefix, CMAKE_INSTALL_PREFIX exists (and it is documented). Besides, /usr/local is the default install prefix (for better or worse), you shouldn't need to specify it. But it's nice that you managed to find a workaround, even if not the root cause.