heguanhui opened a new issue, #64170:
URL: https://github.com/apache/doris/issues/64170

   ### Version
   
   trunk
   
   ### What's Wrong?
   
   On aarch64, building Doris BE with LSAN, ASAN_UT, or ASAN sanitizer modes 
fails during CMake configuration phase. The OpenBLAS getarch build-time tool 
inherits sanitizer flags from the parent CMake context, which causes 
LeakSanitizer to detect memory leaks in OpenBLAS's `detect()` function (strdup 
without free on aarch64). This causes getarch to exit with non-zero code, and 
CMake configuration fails.
   
   The same root cause affects all three modes:
   1. **LSAN**: `-fsanitize=leak` enables LeakSanitizer, getarch leaks memory → 
CMake fails
   2. **ASAN_UT**: `-fsanitize=address` includes LeakSanitizer, same leak 
detected → CMake fails  
   3. **ASAN**: `-fsanitize=address` includes LeakSanitizer, same leak detected 
→ CMake fails
   
   Additionally, on aarch64 with UBSAN mode, `-mcmodel=medium` (x86_64-specific 
flag) leaks into OpenBLAS/FAISS build context causing compilation failures.
   
   Error example (LSAN):
   ```
   ==641==ERROR: LeakSanitizer: detected memory leaks
   
   Direct leak of 480 byte(s) in 96 object(s) allocated from:
       #0 malloc
       #1 strdup
       #2 detect (getarch)
       #3 get_corename (getarch)
       #4 main (getarch)
   
   SUMMARY: LeakSanitizer: 972 byte(s) leaked in 194 allocation(s).
   ```
   
   ### What You Expected?
   
   BE should build successfully with LSAN/ASAN/ASAN_UT sanitizer modes on 
aarch64, and BE UT should run normally.
   
   ### How to Reproduce?
   
   On an aarch64 machine:
   1. Build Doris BE with LSAN mode: `BUILD_TYPE=LSAN bash build.sh --be`
   2. Or with ASAN_UT mode: `BUILD_TYPE=ASAN_UT bash build.sh --be`
   3. Or with ASAN mode: `BUILD_TYPE=ASAN bash build.sh --be`
   4. CMake configuration fails at OpenBLAS getarch step
   
   ### Are you willing to submit PR?
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to