-
Notifications
You must be signed in to change notification settings - Fork 417
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
Linker error when building otlp_grpc_exporter_test #1940
Comments
@svrnm could you please try if the link error can be fixed by adding |
|
Ignore my last comment, it was stupid;-) So, I tried adding grpcpp via the include but still got the error, but the following worked:
I can raise a PR to get this fixed, just wanted to check first if this is the right approach? |
The title says |
fixed
So the fix I applied for the package eventually is using |
@owent do you think the below dependence on grpc++ can be marked as public? Which may fix the issue as well? opentelemetry-cpp/exporters/otlp/CMakeLists.txt Lines 38 to 39 in 2544803
|
No, in my understanding, grpc++ can not be marked as public, the reason of #1603 is linking grpc into more than one dynamic libraries and executable. |
This issue was marked as stale due to lack of activity. |
@owent - I think the problem here is that the libgrpc++is not statically linked with opentelemetry_exporter_otlp_grpc_client as alpine repository only brings the shared library for gRPC: # ldd libopentelemetry_exporter_otlp_grpc_client.so | grep ++
libgrpc++.so.1.42 => /lib/libgrpc++.so.1.42 (0x00007fef8e811000)
libstdc++.so.6 => /lib/libstdc++.so.6 (0x00007fef8dce3000)
# objdump -t libopentelemetry_exporter_otlp_grpc_client.so|grep OK
# This makes gRPC the indirect dependency for libraries/executables linking with |
I'm not sure if the problem of #1063 still exists in the latest gRPC(it changes a lot since then), but the problem is gRPC use static global variables in some codes, which will be construct and destruct multiple times when the codes are linked into more than one module on the platforms with ELF ABI. If the gRPC is built as dynamic libraries, it's will be always safe to make the dependency public, but it's unsafe when gRPC is built as static library. Do you think we can make the dependency public only if we link the dynamic gRPC? It may solve the problem in this issue but may confuse users about how to link dependencies manually. |
Describe your environment
Steps to reproduce
What is the expected behavior?
No error
What is the actual behavior?
Linker error:
Additional context
I can work around this issue by setting
export LDFLAGS="$LDFLAGS -Wl,--copy-dt-needed-entries"
but I don't think that's a permanent solutionThe text was updated successfully, but these errors were encountered: