bneradt commented on code in PR #13936:
URL: https://github.com/apache/trafficserver/pull/13936#discussion_r4415867236


##########
cmake/Findunwind.cmake:
##########
@@ -28,10 +28,21 @@
 #     unwind::unwind
 #
 
-find_library(unwind_LIBRARY NAMES unwind)
 find_library(unwind_ptrace_LIBRARY NAMES unwind-ptrace)
 find_library(unwind_generic_LIBRARY NAMES unwind-generic)
-find_path(unwind_INCLUDE_DIR NAMES libunwind.h libunwind/libunwind.h)
+# LLVM's unwinder also installs a libunwind.so and libunwind.h, which may be
+# earlier in the search path but lack the remote unwinding API. Take the ones
+# installed alongside libunwind-ptrace.
+if(unwind_ptrace_LIBRARY)
+  get_filename_component(_unwind_library_dir "${unwind_ptrace_LIBRARY}" 
DIRECTORY)
+  find_library(
+    unwind_LIBRARY
+    NAMES unwind
+    PATHS "${_unwind_library_dir}"
+    NO_DEFAULT_PATH
+  )
+endif()
+find_path(unwind_INCLUDE_DIR NAMES libunwind-ptrace.h 
libunwind/libunwind-ptrace.h)

Review Comment:
   [P2] Refresh incompatible cached unwind paths
   
   For an existing build configured with the LLVM prefix first, the old finder 
has already cached `unwind_LIBRARY` and `unwind_INCLUDE_DIR` as the LLVM paths. 
Both `find_library` and `find_path` reuse those successful cache entries 
without searching, so neither the new `NO_DEFAULT_PATH` restriction nor the 
change to `libunwind-ptrace.h` takes effect, and `traffic_crashlog` still uses 
the incompatible library/header after updating and reconfiguring. I reproduced 
this by configuring a minimal project with the old finder, replacing it with 
this version, and configuring again: both LLVM paths remained; a fresh build 
directory selected the intended installation. Could the finder invalidate 
cached selections that do not satisfy the remote-unwinding requirements before 
these searches, or explicitly document that this fix requires clearing both 
cache entries?



-- 
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]

Reply via email to