cmake_template icon indicating copy to clipboard operation
cmake_template copied to clipboard

Verify CLion experience (Linux)

Open lefticus opened this issue 1 year ago • 4 comments

This is the "out of the box" experience.

When you open this project in Clion does it Just Work?

related #17

lefticus avatar Apr 19 '23 23:04 lefticus

Test this Project in CLion (2023.1.3) on my Arch Linux.

Seems like I can't build intro without errors :(

Testing

Configure

  1. "Projects" -> "Get from VCS"
  2. git clone this repo: https://github.com/cpp-best-practices/cmake_template.git
  3. Open this Project, "Open Project Wizard": Add "Debug" and "Release" (use default settings)
  4. After CMake is done Loading:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=JetBrains/Toolbox/apps/CLion/ch-0/231.9011.31/bin/ninja/linux/x64/ninja -G Ninja -S CLionProjects/cmake_template -B CLionProjects/cmake_template/cmake-build-debug
-- The CXX compiler identification is GNU 13.1.1
-- The C compiler identification is GNU 13.1.1
...
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
CMake Warning (dev) at CMakeLists.txt:72 (message):
  Building Tests.  Be sure to check out test/constexpr_tests.cpp for
  constexpr testing
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done

Building

  1. Select "Debug", tests Configure, and "Build tests" Build fails with:
[109/110] Building CXX object test/CMakeFiles/tests.dir/tests.cpp.o
FAILED: test/CMakeFiles/tests.dir/tests.cpp.o 
.local/share/JetBrains/Toolbox/apps/CLion/ch-0/231.9011.31/bin/cmake/linux/x64/bin/cmake -E __run_co_compile --launcher=/usr/bin/ccache --tidy="/usr/bin/clang-tidy;-extra-arg=-Wno-unknown-warning-option;-extra-arg=-Wno-ignored-optimization-argument;-extra-arg=-Wno-unused-command-line-argument;-p;-extra-arg=-std=c++20;-warnings-as-errors=*;--extra-arg-before=--driver-mode=g++" --cppcheck="/usr/bin/cppcheck;--template=gcc;--enable=style,performance,warning,portability;--inline-suppr;--suppress=cppcheckError;--suppress=internalAstError;--suppress=unmatchedSuppression;--suppress=passedByValue;--suppress=syntaxError;--suppress=preprocessorErrorDirective;--inconclusive;--std=c++20;--error-exitcode=2" ... -- /usr/bin/c++ -DSAMPLE_LIBRARY_STATIC_DEFINE -
... CLionProjects/cmake_template/test/tests.cpp
Checking CLionProjects/cmake_template/test/tests.cpp ...
Checking CLionProjects/cmake_template/test/tests.cpp: SAMPLE_LIBRARY_STATIC_DEFINE=1;_FORTIFY_SOURCE=3;_GLIBCXX_ASSERTIONS=1...
In Datei, eingebunden von /usr/include/c++/13.1.1/x86_64-pc-linux-gnu/bits/os_defines.h:39,
                 von /usr/include/c++/13.1.1/x86_64-pc-linux-gnu/bits/c++config.h:679,
                 von /usr/include/c++/13.1.1/cstddef:49,
                 von CLionProjects/cmake_template/cmake-build-debug/_deps/catch2-src/src/catch2/internal/catch_source_line_info.hpp:11,
                 von CLionProjects/cmake_template/cmake-build-debug/_deps/catch2-src/src/catch2/catch_assertion_info.hpp:12,
                 von CLionProjects/cmake_template/cmake-build-debug/_deps/catch2-src/src/catch2/internal/catch_assertion_handler.hpp:11,
                 von CLionProjects/cmake_template/cmake-build-debug/_deps/catch2-src/src/catch2/internal/catch_test_macro_impl.hpp:12,
                 von CLionProjects/cmake_template/cmake-build-debug/_deps/catch2-src/src/catch2/catch_test_macros.hpp:11,
                 von CLionProjects/cmake_template/test/tests.cpp:1:
/usr/include/features.h:413:4: Fehler: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
  413 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
      |    ^~~~~~~
ninja: build stopped: subcommand failed.
  1. Try out "Release", tests Configure, and "Build tests" -> "Build finished"

  2. Build "All CTest" (basically build all), Build Failed:

[6/86] Building CXX object _deps/ftxui-build/CMakeFiles/screen.dir/src/ftxui/screen/string.cpp.o
FAILED: _deps/ftxui-build/CMakeFiles/screen.dir/src/ftxui/screen/string.cpp.o 
/usr/bin/c++  ... -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection -fstack-clash-protection  -D_GLIBCXX_ASSERTIONS -O3 -DNDEBUG -flto=auto -fno-fat-lto-objects -fdiagnostics-color=always -Wall -Werror -Wextra -Wcast-align -Wdeprecated -Wmissing-declarations -Wnon-virtual-dtor -Wnull-dereference -Woverloaded-virtual -Wpedantic -Wshadow -Wunused -std=c++20 -MD -MT _deps/ftxui-build/CMakeFiles/screen.dir/src/ftxui/screen/string.cpp.o -MF _deps/ftxui-build/CMakeFiles/screen.dir/src/ftxui/screen/string.cpp.o.d -o _deps/ftxui-build/CMakeFiles/screen.dir/src/ftxui/screen/string.cpp.o -c CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp
In Datei, eingebunden von CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp:8:
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/include/ftxui/screen/string.hpp:51:48: Fehler: »uint32_t« wurde in diesem Gültigkeitsbereich nicht definiert
   51 | WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint);
      |                                                ^~~~~~~~
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/include/ftxui/screen/string.hpp:7:1: Anmerkung: »uint32_t« ist im Header »<cstdint>« definiert; haben Sie vergessen, »#include <cstdint>« zu schreiben?
    6 | #include <vector>    // for vector
  +++ |+#include <cstdint>
    7 | 
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp: In Funktion »bool {anonymous}::IsCombining(uint32_t)«:
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp:1415:45: Fehler: »ftxui::CodepointToWordBreakProperty« kann nicht als Funktion verwendet werden
 1415 |   return ftxui::CodepointToWordBreakProperty(ucs) == WBP::Extend;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp: Im globalen Gültigkeitsbereich:
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp:1570:66: Fehler: »ftxui::WordBreakProperty ftxui::CodepointToWordBreakProperty(uint32_t)« als andere Symbolart redeklariert
 1570 | WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint) {
      |                                                                  ^
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/include/ftxui/screen/string.hpp:51:19: Anmerkung: vorherige Deklaration von »ftxui::WordBreakProperty ftxui::CodepointToWordBreakProperty«
   51 | WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[15/86] Building CXX object _deps/spdlog-build/CMakeFiles/spdlog.dir/src/spdlog.cpp.o
ninja: build stopped: subcommand failed.

  1. Try to build other targets like constexpr_tests and relaxed_constexpr_tests -> "Build finished"
  2. Try to build sample_library -> "ninja: no work to do. Build finished"
  3. Try to build intro, failed with the same error:
[1/46] Building CXX object _deps/ftxui-build/CMakeFiles/screen.dir/src/ftxui/screen/string.cpp.o
FAILED: _deps/ftxui-build/CMakeFiles/screen.dir/src/ftxui/screen/string.cpp.o ... -Wall -Werror -Wextra -Wcast-align -Wdeprecated -Wmissing-declarations -Wnon-virtual-dtor -Wnull-dereference -Woverloaded-virtual -Wpedantic -Wshadow -Wunused -std=c++20 -MD -MT _deps/ftxui-build/CMakeFiles/screen.dir/src/ftxui/screen/string.cpp.o -MF _deps/ftxui-build/CMakeFiles/screen.dir/src/ftxui/screen/string.cpp.o.d -o _deps/ftxui-build/CMakeFiles/screen.dir/src/ftxui/screen/string.cpp.o -c CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp
In Datei, eingebunden von CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp:8:
/home/abeimler/CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/include/ftxui/screen/string.hpp:51:48: Fehler: »uint32_t« wurde in diesem Gültigkeitsbereich nicht definiert
   51 | WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint);
      |                                                ^~~~~~~~
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/include/ftxui/screen/string.hpp:7:1: Anmerkung: »uint32_t« ist im Header »<cstdint>« definiert; haben Sie vergessen, »#include <cstdint>« zu schreiben?
    6 | #include <vector>    // for vector
  +++ |+#include <cstdint>
    7 | 
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp: In Funktion »bool {anonymous}::IsCombining(uint32_t)«:
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp:1415:45: Fehler: »ftxui::CodepointToWordBreakProperty« kann nicht als Funktion verwendet werden
 1415 |   return ftxui::CodepointToWordBreakProperty(ucs) == WBP::Extend;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp: Im globalen Gültigkeitsbereich:
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/src/ftxui/screen/string.cpp:1570:66: Fehler: »ftxui::WordBreakProperty ftxui::CodepointToWordBreakProperty(uint32_t)« als andere Symbolart redeklariert
 1570 | WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint) {
      |                                                                  ^
CLionProjects/cmake_template/cmake-build-release/_deps/ftxui-src/include/ftxui/screen/string.hpp:51:19: Anmerkung: vorherige Deklaration von »ftxui::WordBreakProperty ftxui::CodepointToWordBreakProperty«
   51 | WordBreakProperty CodepointToWordBreakProperty(uint32_t codepoint);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[10/46] Building CXX object _deps/ftxui-build/CMakeFiles/dom.dir/src/ftxui/dom/linear_gradient.cpp.o
ninja: build stopped: subcommand failed.

Run

  1. Run tests (Release) -> CLionProjects/cmake_template/cmake-build-release/test/tests -r xml -d yes --order lex -> "Process finished with exit code 0"
  2. Run relaxed_constexpr_tests (Release) -> "Process finished with exit code 0"

Screenshots

image

Environment:

OS: Garuda Arch Linux (64-Bit) (Linux 6.3.1) Compiler: g++ (13.1.1) IDE: CLion 2023.1.3

abeimler avatar May 17 '23 17:05 abeimler

For me it worked perfectly first time: Ubuntu 20.04, clion 2023.1.4.

EmmanuelMess avatar Jul 08 '23 22:07 EmmanuelMess

@lefticus Works in CLion 2024.1 EAP (Nova) - Ubuntu 23.10 - Clang-17/++/Tidy/Format

fwiw : Similar to the poster above there were some compilation warnings coming from ftxui's sources. It's a bit of an exotic dependency to pull in as a hello world IMO it adds too much noise, it pollutes the clion run menu with a gazillion irrelevant targets for all their examples (see screenshot a couple posts above). It took me a good second to realize I needed to look for the "intro" target. It would be nice if that was called out in the readme or if the target would reflect the name of the project.

jayv avatar Feb 11 '24 06:02 jayv

Environment: CLion 2024.1.4 dev container integration on OpenSuse TumbleWeed 202408

The container works in the default configuration, using a non root user inside the container requires modifying the Dockerfile to add the user (just like for VsCode, follow its documentation here).

dariusarnold avatar Aug 22 '24 18:08 dariusarnold