-
Notifications
You must be signed in to change notification settings - Fork 483
[BUILD] Propagate INTERFACE_COMPILE_DEFINITIONS from API through common_foo_library #3440
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
Conversation
✅ Deploy Preview for opentelemetry-cpp-api-docs canceled.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3440 +/- ##
=======================================
Coverage 89.88% 89.88%
=======================================
Files 212 212
Lines 6941 6941
=======================================
Hits 6238 6238
Misses 703 703 🚀 New features to boost your workflow:
|
@@ -12,4 +12,4 @@ endif() | |||
|
|||
target_include_directories(common_foo_library | |||
PUBLIC "$<BUILD_INTERFACE:${EXAMPLES_COMMON_DIR}>") | |||
target_link_libraries(common_foo_library PRIVATE opentelemetry-cpp::api) |
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.
The example common foo library headers don't expose otel-cpp headers and that seems to be an important aspect of the example (user instrumentation of a library shouldn't leak otel-cpp if it doesn't need to).
If the executable linking to the dll target opentelemetry-cpp::opentelemetry_cpp
isn't getting the definitions it needs from the api target, then it points to a missing link by the dll target.
Can you try adding target_link_libraries(opentelemetry_cpp INTERFACE opentelemetry_api)
to the dll's cmake file?
add_library(opentelemetry_cpp SHARED dllmain.cc ${OPENTELEMETRY_EXPORT_DEF}) |
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.
No strong opinion whether the original fix from @ThomsonTan or the suggestion from @dbarker is the best solution.
Please resolve the code review, so a fix we all agree with can go in the repo.
This is blocking for the next release 1.21.0, as we want to make sure that examples work properly with a consistent build, it affects people trying / evaluating opentelemetry-cpp.
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.
@marcalff Okay to merge now to fix the new examples build and unblock the release.
Users who link to the dll target in their projects will need to explicitly link the API target to get its declarations until we add the API link to the dll target. This can be done in the next release since the issue is not new
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 think the suggestion from @dbarker with target_link_libraries(opentelemetry_cpp INTERFACE opentelemetry_api)
could fix the issue, but I suspect the same issue could happen to non-DLL case, probably somehow there is some fallback for the linking in the same executable.
I also suggest we merge the current PR and tune the fix later (after the release), because the current PR restores the previous behavior.
File a new issue to track the follow-up #3447.
Can you add a test in ci to cover the error you're seeing? |
I am running a repro for the issue in below draft, and post it back once it is ready. |
And the unresolved symbol issue for linking does repro in the CI build. I'll clean PR #3441 to make it ready for review, but I think it doesn't block the coming release. https://github.com/open-telemetry/opentelemetry-cpp/actions/runs/15309964132/job/43072033016?pr=3441
|
@ThomsonTan @dbarker So, for clarity: ok to merge this PR, 3440, as is then ? |
Yes, it is good to merge the current PR on my side and include it in the pending release. Will see if there is any further feedback from @dbarker. |
Fixes #3439
Changes
Please provide a brief description of the changes here.
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes