OTLP | Compile OTLP lib #1763
Replies: 3 comments 19 replies
-
vcpkg port for opentelemetry-cpp is not officially maintained/delivered through this repo (as mentioned here - https://github.com/open-telemetry/opentelemetry-cpp/blob/main/INSTALL.md#using-package-managers) , moving this to discussions. |
Beta Was this translation helpful? Give feedback.
-
Looking into the compile flags in make file, you seems to be linking with |
Beta Was this translation helpful? Give feedback.
-
can be closed, succeussed |
Beta Was this translation helpful? Give feedback.
-
Hi, i installed otlp through vcpkg on linux server and used this command to install otlp
./vcpkg install opentelemetry -cpp[otlp,core, Prometheus].
And I tried to work and compile one of the examples on the otlp lib, that located under examples/otlp/grpc_metrics_main
And I got an undefined reference- i don't what I have done wrong.
This my makefile I used.
`CC = g++
TARGET = main
CXXFILES = main.cpp
CXXFLAGS = -O3 -o $(TARGET) -D_GNU_SOURCE -L./ -L./metrics_foo_library -I./ -I./opentelemetry -I./metrics_foo_library
LIBS = -lopentelemetry_common -lopentelemetry_exporter_in_memory -lopentelemetry_exporter_ostream_logs -lopentelemetry_exporter_ostream_span -lopentelemetry_otlp_recordable -lopentelemetry_exporter_ostream_metrics_deprecated -lopentelemetry_http_client_curl -lopentelemetry_exporter_otlp_grpc -lopentelemetry_exporter_otlp_grpc_client -lopentelemetry_exporter_otlp_grpc_log -lopentelemetry_exporter_otlp_http_client -lopentelemetry_exporter_otlp_http -lopentelemetry_exporter_otlp_http_log -lopentelemetry_logs -lopentelemetry_metrics_deprecated -lopentelemetry_proto -lopentelemetry_resources -lopentelemetry_trace -lopentelemetry_version -lprometheus_exporter_deprecated -lpthread -lfoo_library -ldl
all:
$(CC) $ (CXXFILES) $(LIBS) $ (CXXFLAGS)
clean:
$(RM) $ (TARGET)
`
/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /tmp/cc5cO804.o: in function
main':main.cpp:(.text.startup+0x96): undefined reference to
opentelemetry::v1::exporter::otlp::OtlpGrpcMetricExporterFactory::Create(opentelemetry::v1::exporter::otlp::OtlpGrpcMetricExporterOptions const&)' /opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: main.cpp:(.text.startup+0x109): undefined reference to
opentelemetry::v1::sdk::metrics::PeriodicExportingMetricReader::PeriodicExportingMetricReader(std::unique_ptr<opentelemetry::v1::sdk::metrics::PushMetricExporter, std::default_deleteopentelemetry::v1::sdk::metrics::PushMetricExporter >, opentelemetry::v1::sdk::metrics::PeriodicExportingMetricReaderOptions const&)'/opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: main.cpp:(.text.startup+0x1c6): undefined reference to
opentelemetry::v1::sdk::metrics::MeterProvider::MeterProvider(std::unique_ptr<opentelemetry::v1::sdk::metrics::ViewRegistry, std::default_delete<opentelemetry::v1::sdk::metrics::ViewRegistry> >, opentelemetry::v1::sdk::resource::Resource)' /opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: main.cpp:(.text.startup+0x2ff): undefined reference to
opentelemetry::v1::sdk::metrics::MeterProvider::AddMetricReader(std::shared_ptropentelemetry::v1::sdk::metrics::MetricReader)'collect2: error: ld returned 1 exit status
make: *** [makefile:9: all] Error 1
`
Beta Was this translation helpful? Give feedback.
All reactions