Skip to content
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

Prioritise unwind_INCLUDE_DIRS path #12017

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

masaori335
Copy link
Contributor

Problem

traffic_crashlog uses nongnu libunwind and including libunwind.h and libunwind-ptrace.h header. OTOH, LLVM has its own libunwind.h. Sometime, CMake pickup LLVM's libunwind.h and making error like below.

In file included from /workspace/src/traffic_crashlog/backtrace.cc:39:
/usr/include/libunwind-ptrace.h:57:8: error: unknown type name 'unw_accessors_t'; did you mean 'unw_cursor_t'?
extern unw_accessors_t _UPT_accessors;
       ^
/opt/llvm/include/libunwind.h:78:29: note: 'unw_cursor_t' declared here
typedef struct unw_cursor_t unw_cursor_t;
                            ^

Approach

Force CMake to set ${unwind_INCLUDE_DIRS} first and pickup nongnu libunwind's libunwind.h header.

@masaori335 masaori335 self-assigned this Feb 6, 2025
@masaori335 masaori335 modified the milestones: 10.0.0, 10.1.0 Feb 6, 2025
@@ -20,6 +20,7 @@ add_executable(traffic_crashlog procinfo.cc backtrace.cc traffic_crashlog.cc)
target_link_libraries(traffic_crashlog PRIVATE ts::inkevent ts::records ts::tscore ts::tsutil)

if(TS_USE_REMOTE_UNWINDING)
target_include_directories(traffic_crashlog BEFORE PRIVATE ${unwind_INCLUDE_DIRS})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works if libunwind.h is in specific path like /opt/libunwind/include/libunwind.h. However, if it's in default search path like /usr/include/libunwind.h, this doesn't work. Does anybody know better way?

@masaori335 masaori335 merged commit def0880 into apache:master Feb 12, 2025
15 checks passed
@cmcfarlen cmcfarlen modified the milestones: 10.1.0, 10.0.4 Feb 19, 2025
@cmcfarlen
Copy link
Contributor

Cherry-picked to 10.0.x

cmcfarlen pushed a commit that referenced this pull request Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Picked-10.0.4
Development

Successfully merging this pull request may close these issues.

None yet

3 participants