Skip to content

OTLP example fails to build with error "undefined reference to `grpc::Status::OK' " #1998

@VivekSubr

Description

@VivekSubr

Describe your environment
WSL ubuntu jammy

Steps to reproduce
Install grpc as per doc: https://grpc.io/docs/languages/cpp/quickstart/
Build opentelemetry,

cmake .. -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_STANDARD=17 -DBUILD_SHARED_LIBS=ON -DWITH_ABSEIL=OFF -DWITH_OTLP=ON -DBUILD_TESTING=OFF
cmake --build . --target all

What is the expected behavior?
Build should go through

What is the actual behavior?
Got error,

[ 79%] Linking CXX executable example_otlp_grpc
cd /home/vivek/Client-Server/module/opentelemetry-cpp/build/examples/otlp && /usr/bin/cmake -E cmake_link_script CMakeFiles/example_otlp_grpc.dir/link.txt --verbose=1
/usr/bin/c++ -rdynamic CMakeFiles/example_otlp_grpc.dir/grpc_main.cc.o -o example_otlp_grpc  -Wl,-rpath,/home/vivek/Client-Server/module/opentelemetry-cpp/build/examples/common/foo_library:/home/vivek/Client-Server/module/opentelemetry-cpp/build/exporters/otlp:/home/vivek/Client-Server/module/opentelemetry-cpp/build/sdk/src/trace:/home/vivek/Client-Server/module/opentelemetry-cpp/build/sdk/src/resource:/home/vivek/Client-Server/module/opentelemetry-cpp/build/sdk/src/metrics:/home/vivek/Client-Server/module/opentelemetry-cpp/build/sdk/src/common ../common/foo_library/libcommon_foo_library.so ../../exporters/otlp/libopentelemetry_exporter_otlp_grpc.so ../../exporters/otlp/libopentelemetry_otlp_recordable.so ../../sdk/src/trace/libopentelemetry_trace.so ../../sdk/src/resource/libopentelemetry_resources.so ../../sdk/src/metrics/libopentelemetry_metrics.so ../../sdk/src/common/libopentelemetry_common.so ../../exporters/otlp/libopentelemetry_exporter_otlp_grpc_client.so ../../libopentelemetry_proto.a /usr/lib/x86_64-linux-gnu/libprotobuf.a
/usr/bin/ld: ../../exporters/otlp/libopentelemetry_exporter_otlp_grpc.so: undefined reference to `grpc::Status::OK'
collect2: error: ld returned 1 exit status

Additional context
grpc installation looks fine,

vivek@LAPTOP-7E1991MU:/usr/lib$ ls | grep "grpc"
libgrpc++.a
libgrpc++_alts.a
libgrpc++_error_details.a
libgrpc++_reflection.a
libgrpc++_unsecure.a
libgrpc.a
libgrpc_authorization_provider.a
libgrpc_plugin_support.a
libgrpc_unsecure.a
libgrpcpp_channelz.a

I did the exact steps provided by grpc project, but looks like this build can't link to libgrpc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions