Giter Club home page Giter Club logo

Comments (8)

ddalcino avatar ddalcino commented on August 20, 2024

Can you build the project from the command line? That would be an easy way to rule out clion as the culprit.

from gui_starter_template.

kees-jan avatar kees-jan commented on August 20, 2024

I'm surprised to say that yes, I can. Running the command-line quoted above succeeds without problems.

So now I'm speculating that CLion somehow messes up the environment and in that way triggers the failure? Odd...

from gui_starter_template.

kees-jan avatar kees-jan commented on August 20, 2024

I'm surprised to say that yes, I can. Running the command-line quoted above succeeds without problems.

So now I'm speculating that CLion somehow messes up the environment and in that way triggers the failure? Odd...

And indeed, to trigger the failure I'm observing from the commandline, I have to execute

CC=cc CXX=c++ /home/kees-jan/opt/clion-2019.3.5/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/bin/clang-10 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 -G "CodeBlocks - Unix Makefiles" /home/kees-jan/src/cpp_starter_project

I.e. set CXX and CMAKE_CXX_COMPILER to conflicting values

from gui_starter_template.

ddalcino avatar ddalcino commented on August 20, 2024

Ok, then we know for certain that CLion is the problem, and not this project or conan.

You will need to set up a new toolchain and a new cmake profile. To do that, you go to:
'File > Settings > Build, Execution, Deployment > Toolchains'
'File > Settings > Build, Execution, Deployment > CMake'

The documentation you want should be here: https://www.jetbrains.com/help/clion/how-to-switch-compilers-in-clion.html. This page should be able to help you a lot better than I can.

from gui_starter_template.

kees-jan avatar kees-jan commented on August 20, 2024

I have now been able to reproduce the problem from the commandline

Preparation:

cd cpp_starter_project
mkdir build
cd build/
cmake -DCMAKE_C_COMPILER=/usr/bin/clang-10 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 ..

Trigger the problem:

conan remove -f '*'
cmake -DCMAKE_C_COMPILER=/usr/bin/clang-10 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 ..

The final cmake invocation fails with nonzero exit status, because conan detects GCC instead of clang.

Instead of that final cmake invocation, you might also call make. That too makes conan attempt to build its packages, and fails with the same error.

from gui_starter_template.

ddalcino avatar ddalcino commented on August 20, 2024

According to conan-io/conan#1211, conan runs the compiler specified by the CC and CXX environment variables, not the cmake variables CMAKE_C_COMPILER and CMAKE_CXX_COMPILER. That thread suggests using conan profiles to set these variables, but that requires some modifications to cmake/Conan.cmake (see #32 if you want to do this).

I think it's easier to just set CC and CXX via command line. Try this:

rm -rf build/
mkdir build && cd build
CC=clang CXX=clang++ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ..
cmake --build .          # Conan targets were already built using clang
conan remove -f '*'
cmake --build .          # Builds conan targets using system default --> failure
CC=clang CXX=clang++ cmake --build .   # Builds conan targets using clang --> success

If this works, you will need to convince CLion to inject those environment variables into the build command. The documentation linked in my last post explains how to do that.

from gui_starter_template.

LtdSauce avatar LtdSauce commented on August 20, 2024

I got it to work applying the fix from #122 to the conan_cmake_install-call:

diff --git a/cmake/Conan.cmake b/cmake/Conan.cmake
index b57566f..44d1968 100644
--- a/cmake/Conan.cmake
+++ b/cmake/Conan.cmake
@@ -54,7 +54,10 @@ macro(run_conan)
       cpp_starter_use_imgui=${CPP_STARTER_USE_IMGUI}
       cpp_starter_use_sdl=${CPP_STARTER_USE_SDL}
       SETTINGS
-      ${settings})
+      ${settings}
+      ENV
+      CC=${CMAKE_C_COMPILER}
+      CXX=${CMAKE_CXX_COMPILER})
   endforeach()
 
 endmacro()

But i am not convenient enough about this to say that it is good and the right way to do it.

from gui_starter_template.

aminya avatar aminya commented on August 20, 2024

This is fixed in ProjectOptions v0.11.2
https://github.com/aminya/ProjectOptions

from gui_starter_template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.