Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I fixed a bug in a compiling script so that using Mold for faster development corresponds to official documentation.
This bug show itself if the user's computer has an old version of GCC installed. As you can see in the commentary inside code, it affects systems with GCC version < 12.1. Especially old systems of Ubuntu, where user just can't install newer version of GCC. In this case script starts to search for specific mold link inside "/usr/libexec/mold", "/usr/local/libexec/mold", "/usr/lib/mold" and "/usr/local/lib/mold" instead of place, where user installed mold binaries manually (the way as it said in documentation), and prints an error.
I didn't change the existing code, but just added a search for Mold link inside user's PATH variable (where Mold should be as mentioned in documentation). So the old looking-for-mold-in-specific-folders will still work, despite the fact that this point is missed in the documentation.
Here is a screeshot of terminal before and after fix.
How this bug occures (my hypothesis):
cmake install
installs Mold right into one of the folders, mentioned in the script. User don't even need to add it into PATH. And this even more possible becouse for 32-bit Linux Mold is not provided in compiled form. In any case, this shortcoming went unnoticed.It should be fixed in some way, otherwise, users risk encountering a problem and having troubles with finding ways to solve it.
UPD: I checked mold-1.1 and mold-2.35.1 files as the first mold version wich have compiled binaries and the last mold release respectively. Both have the same file structure, and I don't think any other version between should be checked. The added code will find Mold link in any of those.