-
Notifications
You must be signed in to change notification settings - Fork 18
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
find_clang.cr finds different versions of clang & llvm-config #39
Comments
Interesting, gonna look into this. The llvm binary is detected by first looking into the paths discovered from examining clang, so I assumed it would always pick the right one. Will check. |
Maybe some check needed that clang version matches llvm version. |
Yes, the finder supports this, so unless a more direct approach is found, restricting the matches to the same version would sure work. |
@ZaWertun try now please. The clang-discovered paths were added to the beginning of the search list as expected, but I missed to replace "lib|include" in them with "bin". The last commit adds this back. |
There is not much change:
But replacing default |
Hm let's also add the version check then. Will have it in a couple minutes. |
It's better to check both |
Actually it's strange that |
In find_clang's
From this we'd have all the info needed to determine why it is/isn't matching. |
Paths: ["/lib/gcc/x86_64-redhat-linux/10",
"/lib64",
"/usr/lib64",
"/lib64",
"/usr/lib64",
"/bin",
"/usr/bin",
"/bin",
"/usr/bin"] All llvm-config executables & links are living in the $ ls -la /usr/bin/llvm-config*
lrwxrwxrwx 1 root root 29 апр 6 22:10 /usr/bin/llvm-config -> /etc/alternatives/llvm-config*
lrwxrwxrwx 1 root root 34 янв 29 16:18 /usr/bin/llvm-config-6.0-64 -> /usr/lib64/llvm6.0/bin/llvm-config*
-rwxr-xr-x 1 root root 129072 апр 2 11:15 /usr/bin/llvm-config-64* |
Looks like all links to the binary files was skipped somehow. |
Nah, maybe just $ sudo find / -xdev -name 'llvm-config*' -executable
/etc/alternatives/llvm-config
/usr/lib64/llvm6.0/bin/llvm-config
/usr/bin/llvm-config-6.0-64
/usr/bin/llvm-config-64
/usr/bin/llvm-config |
Eh yes, right, so it didn't find any llvm binaries in the specific directories, and then when it got to the global/common ones like /usr/bin where it picked the first one >= 6.0.0. Yes, in this case we'll need to add a version check. For now it will look for the exact version as clang reports. Will have it in a couple minutes. (Will also re-check what the old version of the code was doing.) But I am unsure if this is the right thing to do in general. If someone knows why the version could be different, please chip in. Thanks. |
Looking at the old code, it didn't have this case handled either. It incidentally worked because it was only looking for Will try to implement the min version check. If that fails will resort to just checking for |
On OSX we are able to have multiple llvm installs as well using brew:
This is why i am more in favor of strictly using what ever is passed in as
Which gives us |
Hm @kalinon indeed, ok, that brings us closer to that idea of forcing the good value in path, and figuring out everything from there. Will implement, thanks. |
@ZaWertun Hey please try now. The updated |
Still |
And cmake finds correct versions:
|
Oh man... def sorted_candidates : Array({String, String})
list = @candidates.sort_by!(&.first)
if @config.prefer.lowest?
res = list
else
res = list.reverse
end
pp res
res
end
It just takes lowest version. Why???? I think it will be better to iterate versions from lower to highest and check corresponding |
Yes, but this is a great test while you have the old llvm. Can you run this in the usual way via When called through make, make will supply to |
a |
Works fine after cleaning all things up and running |
Closing as it seems resolved. Please reopen if anything remains. |
There maybe several clang & llvm versions installed on user computer.
For example I have both llvm/clang 6 and 10.
After running
find_clang.cr
I've got this variables (fromMakefile.variables
):Clang 10 is linked against llvm-10 so I get strange errors when running
crystal spec
.Also
/bin/llvm-config
points to the version 10 but it's not selected.The text was updated successfully, but these errors were encountered: