Skip to content
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

Compiler Version Mismatch Due to Incorrect Path in CMake on Ubuntu 22 #8

Open
ridwanultanvir opened this issue Mar 17, 2024 · 0 comments

Comments

@ridwanultanvir
Copy link

Environment

  • OS: Ubuntu 22
  • Issue: The specified compiler version in environment variables and CMake commands does not reflect correctly due to a path specification issue.

Description

I am attempting to specify clang-14 and clang++-14 as my project's C and C++ compilers on Ubuntu 22. However, due to a mistake in the path specification, the expected compiler version is not being used.

Steps to Reproduce

  1. Initially set the environment variables to specify clang-14 and clang++14 (incorrect path) as the compilers:
    export CC=/usr/bin/clang-14
    export CXX=/usr/bin/clang++14
  2. Configure the project with CMake, using the same paths for the compilers:
    cmake -DCMAKE_C_COMPILER=/usr/bin/clang-14 -DCMAKE_CXX_COMPILER=/usr/bin/clang++14 ..
  3. Realize the mistake in the path for clang++-14 (it was mistakenly specified as clang++14), which might lead to an incorrect compiler version being used or a failure in locating the compiler.

Correct Steps (for clarity)

To rectify this, the correct steps should be:

export CC=/usr/bin/clang-14
export CXX=/usr/bin/clang++-14  # Corrected path

And then run CMake as:

cmake -DCMAKE_C_COMPILER=/usr/bin/clang-14 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-14 ..

Expected Behavior

After correcting the path, the project should compile using clang-14 and clang++-14 as expected.

Additional Information

This issue is specifically noted on Ubuntu 22.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant