I’m experiencing the issue with clang from Manjaro’s repository. When clang is used from “/bin/clang” (“/bin” is a symlink to “/usr/bin”) entire project is recompiling every time. Example commands:
I noticed the problem since QtCreator 15.0.0 update, where it auto-detects clang kit from “/bin” path instead “/usr/bin” (it was “/usr/bin” in previous QtCreator versions).
Manjaro has both: “/usr/bin” and “/bin” in mentioned order in “PATH” which adds a symlink which can make duplicates when finding software. Also clang makes mistakes when it’s used from “/bin” symlink and causes recompilation of entire project on every build.
Steps to reproduce (as of 14-Dec-2024):
download and launch “manjaro-xfce-24.2.0-241209-linux612.iso”
If a single program is incorrectly dependent on a certain path, this is bad. However, this is by no means a reason to adjust the path of any distribution (especially since 99% of users do not use this program).
If it is not changed in the corresponding program (which would be logical), the user is left with only workarounds.
a) remove /bin from the path
b) arrange /bin in the path after /usr/bin
c) temporarily adjust the path when calling clang
In this respect, you have already found the right (& easy) solution to your problem
P.S.:
I think that this is not a problem with clang itself, but with the build scripts used. Because the build script decides which file should be recompiled (not the compiler)
There are also things like “ccache” that are intended to prevent the multiple build of an (unchanged) file.
this is by no means a reason to adjust the path of any distribution
OK!
remove /bin from the path
How to do it correctly for Manjaro? I can’t find it it any config file. The only way I found is to put “unset PATH” at the begin of “/etc/profile” file, but it looks like a workaround to me.
I think that this is not a problem with clang itself, but with the build scripts used. Because the build script decides which file should be recompiled (not the compiler)
That’s the problem I don’t know where to report the “real” bug. Looks like it works with correctly with GCC, but not with Clang (tried Clang+CMake+Make, Clang+CMake+Ninja, Clang+Meson+Ninja - all have the same issue).
There are also things like “ccache” that are intended to prevent the multiple build of an (unchanged) file.
Yes, but in this case it’s like a workaround (+ ccache never works to me with PCH enabled).
cat .zshrc |grep -E '\$PATH'
# If you come from bash you might have to change your $PATH.
export PATH=/usr/local/bin:$PATH
export PATH=$PATH:~/toolchains/gcc_4.8.4.201701_gnurx-elf/bin/
The first line inserts something to the start, the second does it to the end.
Now I noticed the problem comes from lightdm. When I use SDDM to launch Xfce4, there is no “/bin” in PATH Where lightdm is adding the “/bin” to the PATH?
there can be only one version of any software in /usr/bin - as /bin just links to that and is not a separate PATH but the same
Don’t understand either, that’s why created this thread Looks like clang (or build scripts when using clang) has a problem with this…
In Xfce4, /bin is explicitly in the $PATH
In Plasma it is not.
These are two separate Virtual Machines - one Xfce4, one KDE Plasma.
The Xfce4 one has been used and modified the most - the Plasma is pretty much pristine.
They where not installed at the same time - the Plasma is much more recent, the Xfce4 is the oldest.
I don’t think it has got anything to do with the display manager used (lightdm vs. sddm)
Finally found where the “/bin” is located. Lightdm has hardcoded “/bin” PATH here. I removed it, recompiled package, and the “/bin” is gone from my PATH…
I marked this answer as the solution to your question because it is by far the best answer you can get. LinkToAnswer
If you disagree with my choice, feel free to mark any other answer as the solution to your question, or remove the solution: You are in control! (If you disagree, just send me a private message explaining why I shouldn’t have done that, or a if you agree)
P.S. In the future, please don’t forget to come back to your thread after solving your problem and mark the answer that helped you the most as the solution:
Then the next person who has exactly the same problem as you can benefit from your contribution. Also, your thread will then be shown as “solved”.
I was looking for the PATH for a longer while in all possible scripts (/etc and $HOME) - I didn’t find anything which adds the “/bin” for bash shell.
But finally found it in lightdm code here. When I remove it from there - “/bin” is gone from PATH in Xfce4.
Removing “/bin” helps QtCreator to automatically (without manual modification of kits) find tools properly (on my PC). Now need to report issue somewhere to fix it for all users - clang or lightdm or both or maybe build systems…
P.S. In the future, please don’t forget to come back to your thread after solving your problem and mark the answer that helped you the most as the solution: