[SERVER-65110] Should also set LLVM_SYMBOLIZER in mongodtoolchain gcc vars files Created: 31/Mar/22 Updated: 20/Oct/22 Resolved: 06/Oct/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Mathias Stearn | Assignee: | Trevor Guidry |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
We set the symbolizer in the clang vars files but not in gcc. That means that if you use --sanitize=address with toolchain gcc you get an error asking you to manually pass LLVM_SYMBOLIZER=path to scons. But if you are using the toolchain compiler, we should assume you want to use the toolchain llvm-symbolizer as well and just do that busy work for you. Since gcc -print-prog-name=llvm-symbolizer just prints llvm-symbolizer at you without path-qualifiying it, we can't use the same solution. But for the toolchain, we know that it is in the same bin/ dir as the compiler, so we can either set it relative to the path of the vars file, or just set it based on toolchain_bindir. Alternatively, since we inject the toolchain into the PATH, maybe an unqualified llvm-symbolizer command is fine, and the error we give if LLVM_SYMBOLIZER isn't configured is overly-agressive? |
| Comments |
| Comment by Alex Neben [ 06/Oct/22 ] |
|
This is only for running sanitizers with gcc which is currently something SDP does not want to support. If you feel this should be supported please reach out to me on slack and we can discuss there. Also if this benefits you in some other way other than gcc sanitizer please feel free to reopen and explain it to me. |
| Comment by Andrew Morrow (Inactive) [ 31/Mar/22 ] |
|
Setting LLVM_SYMBOLIZER is required so that you can get working +foo_test results under the sanitizer. I agree we should make it work. |
| Comment by Ryan Egesdahl (Inactive) [ 31/Mar/22 ] |
|
Usually, you need the symbolizing when actually running the built object, so you should only need to set the environment variable when running the tests. Setting LLVM_SYMBOLIZER as a SCons build variable would only be needed just to make the build happen - it would not even be used. Note, we currently don’t support GCC sanitizers, which is why you’re not succeeding here - I’m suggesting this workaround so we can see if it’s something we could potentially add if this works for you. |
| Comment by Mathias Stearn [ 31/Mar/22 ] |
|
I was just going off of the error I got when passing --sanitize=address to scons. It prevents even trying to build without setting LLVM_SYMBOLIZER. I could also try bypassing that logic and manually puting -fsanitize=address in my CCFLAGS and LINKFLAGS. Is that what you are suggesting? |
| Comment by Ryan Egesdahl (Inactive) [ 31/Mar/22 ] |
|
GCC versions above 4.9 should have libbacktrace compiled in and should not need an external symbolizer. Could you try setting ASAN_OPTIONS=symbolize=1 and see if that does the trick? If not, we should really be looking into why GCC isn’t doing its own symbolizing. |