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

Hints for how cmake chooses which version of LLVM to link with irony-server #590

Open
sten0 opened this issue May 7, 2024 · 6 comments
Open

Comments

@sten0
Copy link
Contributor

sten0 commented May 7, 2024

Hi @Sarcasm,

I've made progress with enabling "triggers" which will allow the Debian package to reconfigure itself as system LLVM versions are installed, upgraded, uninstalled, etc. This means that Debian (and its derivatives) users will be able to once again rely on the system-managed copy of irony-mode, so they won't have to worry about maintaining a user-specific copy. Eventually the hope is that some advanced CI on more rare architectures can be deployed to check the status of multiple LLVM versions.

I confess to some burnout on this project, hence the slow progress (ie: rubber duck a problem -> needs research -> go researching -> get tired or run out of time -> months go by). Right now, this is the problem I see:

  1. Install LLVM/Clang 18, -dev packages, etc, and build irony-server
    |
    |--> irony-server links with libLLVM-18.so.1
  2. Leave LLVM/Clang 18 alone, and additionally install LLVM/Clang 17, -dev packages, etc, and build irony-server
    |
    |--> irony-server links with libLLVM-17.so.1 !
  3. Leave LLVM/Clay 18 and 17 alone, and additionally install LLVM/Clang 16, -dev packages, etc, and build irony-server
    |
    |--> irony-server links with libLLVM-16.so.1 !

I wasn't able to identify an obvious cause, and at this point it's better to be humble and publicly ask for a hint then to let this slide for another few months/years.

Does this look like something on the irony-mode side to you (perhaps something in CMakelists.txt?), or in the Debian side of things?

@Sarcasm
Copy link
Owner

Sarcasm commented May 7, 2024

irony-mode calls:

find_package(Clang)

If you print the path of this Clang that is found, what do you get?
Are you sure the dev packages do not override the Clang-config.cmake?

If you can patch irony-server, i would try to add this line below the find_package:

 find_package(Clang)
+
+message(STATUS "Clang_FOUND=${Clang_FOUND} Clang_DIR=${Clang_DIR}")

And see what irony-mode CMake generation step prints.

What is the output of this:

clang -print-resource-dir

It looks like irony-server links to the libclang found in the standard search paths.
What do you get if you type this?

ldd /usr/lib/libclang.so*

@sten0
Copy link
Contributor Author

sten0 commented May 7, 2024 via email

@sten0
Copy link
Contributor Author

sten0 commented May 7, 2024 via email

@Sarcasm
Copy link
Owner

Sarcasm commented May 7, 2024

Nice find, I guess you can specify this on the command line?

cmake -DCMAKE_FIND_PACKAGE_SORT_ORDER NATURAL -DCMAKE_FIND_PACKAGE_SORT_DIRECTION=DEC

@sten0
Copy link
Contributor Author

sten0 commented May 13, 2024 via email

@Sarcasm
Copy link
Owner

Sarcasm commented May 13, 2024

I'm not super confident adding it to irony-mode CMakeLists.txt just now.
It would no longer possible to override it for user and I'm not sure why CMake upstream doesn't do it.

Since it can be set externally, that's the approach I would recommand for now.
I'm open to reconsider in the future.

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

2 participants