It would be nice to be able to provide a custom script that would help users to find missing libraries. A possible scenario could be:
% clang /tmp/a.c -fuse-ld=lld -loauth -Wl,--error-handling-script=/tmp/addLibrary.py
unable to find library -loauth
looking for relevant packages to provides that library
- liboauth-0.9.7-4.el7.i686
- liboauth-devel-0.9.7-4.el7.i686
- liboauth-0.9.7-4.el7.x86_64
- liboauth-devel-0.9.7-4.el7.x86_64
- pix-1.6.1-3.el7.x86_64
Where addLibrary would be called with the missing library name as first argument (in that case addLibrary.py oauth)
Sounds like this should be "missing-library" here? After all, that's what the situation is.
I also think we should still print the original error message. There are a few reasons for this:
Also, also, maybe we should consider an additional overlaod to the error function, which takes the ID string. The error function would then be responsible for handling the error by calling the script. This will prevent this same code being needed for other usages in the future - a future caller would simply need to call error("the normal error message", "some ID", {"arg1", "arg2"}) (or something to that effect), and the ID would be automatically be passed back to the script.