-
Notifications
You must be signed in to change notification settings - Fork 385
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
[analyzer] Include arch subdirectories in LD_LIBRARY_PATH for logging #4394
[analyzer] Include arch subdirectories in LD_LIBRARY_PATH for logging #4394
Conversation
5330c8f
to
50e5258
Compare
sounds good. did you test this on older distros? (ubuntu 20, 22,rhel8,rhel9) |
You may want to try out this implmentation on the following test test.c:
builder.c:
both compile_commands.json should be valid. The architecture (32 or 64 bits) of the caller of the gcc what matters. |
Hi, I have tested with the suggested method, and both logs have the correct content.
Then, build this to
Then, the contents of BOTH
All in all, I see this is the expected behaviour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the proposed solution and I tested and it works on ubuntu 22 too
I think we can remove the i486, i586, i686 subdirs of ld_logger/lib
and just keep i386 dir.
Also could you please add the testcase which I proposed in my comment as functional test?
6d0cdd6
to
7620288
Compare
Fix and improve test case
fix directory paths
7620288
to
4817933
Compare
@dkrupp Thanks for the suggestions. I implemented and verified all of them on Ubuntu24 and this Ubuntu20 test environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The issue with logging (see #4360 for details) came up on my Ubuntu24 machine, where only specifying the <data_files>/ldlogger/lib in the LD_LIBRARY_PATH was not enough for the dynamic loader to load the ldlogger.so inside <data_files>/ldlogger/lib/x86_64, so I observed there is no implicit architecture resolution in the logic of the loader. There were other tests on other distributions where this implicit architecture resolution seems to exist (rhel7, rhel8, ubuntu22, among others).
The solution implemented by this patch is adding all <data_files>/ldlogger/lib/* folders in addition to the current <data_files>/ldlogger/lib folder to the LD_LIBRARY_PATH.
I have tested it on Ubuntu24, and the multiple .so files that are possibly reachable due to all of them being added are not an issue. The logger works as expected, and if I remove only the relevant ldlogger.so (x86_64 for my machine) but keep the others, the CodeChecker log command correctly detects that I meet neither the ld-logger nor the intercept-build requirement.