Skip to content

Instantly share code, notes, and snippets.

@malkia
Created July 31, 2025 02:07
Show Gist options
  • Save malkia/43d47284a470d891a616e038d9f0841d to your computer and use it in GitHub Desktop.
Save malkia/43d47284a470d891a616e038d9f0841d to your computer and use it in GitHub Desktop.
Building opentelemetry for only otlp-http protocol (no grpc)
So you've cloned open-telemetry/opentelemetry-cpp, made sure submodules are all good (git clone --recurse ...0, etc.
```
C:\p\opentelemetry-cpp> mkdir B
C:\p\opentelemetry-cpp> cd B
C:\p\opentelemetry-cpp\B> cmake-gui ..
```
Do the default selection like VS2022, native, x64
Enable "grouped" / "advanced"
You should see these groups:
```
Ungrouped Entries
BENCHMARK
BUILD
CMAKE
...
OPENTELEMETRY
OTELCPP
WITH
gtest
```
`WITH` is important, I won't put the defaults here,
- but select ABI 2, instead of 1,
- make sure API only is not selected - we want the whole thing
- disable benchmark, etw
- leave examples, examples_http and func_test
- enable otlp_http
- Set WITH_STL=2017
`OTELCPP` - Enable versioned libs
Let's build opentelemetry-c++ as dll using vcpkg!
Q:\w\vcpkg>vcpkg install opentelemetry-cpp[otlp-http]
Computing installation plan...
The following packages will be built and installed:
* abseil:[email protected]#2
* curl[core,non-http,schannel,ssl,sspi]:[email protected]
* nlohmann-json:[email protected]
opentelemetry-cpp[core,otlp-http]:[email protected]
* protobuf:[email protected]#1
* utf8-range:[email protected]
* vcpkg-cmake:x64-windows@2024-04-23
* vcpkg-cmake-config:x64-windows@2024-05-23
* zlib:[email protected]
```
Directory of Q:\w\vcpkg\installed\x64-windows\bin
07/30/2025 06:04 PM 1,939,456 abseil_dll.dll
07/30/2025 06:04 PM 13,455,360 abseil_dll.pdb
07/30/2025 06:05 PM 634,368 libcurl.dll
07/30/2025 06:05 PM 4,730,880 libcurl.pdb
07/30/2025 06:07 PM 14,440,960 libprotobuf.dll
07/30/2025 06:07 PM 86,519,808 libprotobuf.pdb
07/30/2025 06:07 PM 1,531,392 libprotobuf-lite.dll
07/30/2025 06:07 PM 11,300,864 libprotobuf-lite.pdb
07/30/2025 06:07 PM 10,901,504 libprotoc.dll
07/30/2025 06:07 PM 74,362,880 libprotoc.pdb
07/15/2025 11:21 PM 10,622 wcurl
07/30/2025 06:04 PM 659,456 zlib.pdb
07/30/2025 06:04 PM 90,112 zlib1.dll
```
some other .dlls - but sadly no opentelemetry.dll :(
Oh wait, it actually build some mix of static .lib (and import?) files
```
Directory of Q:\w\vcpkg\installed\x64-windows\lib
07/30/2025 06:09 PM <DIR> .
07/30/2025 06:05 PM <DIR> ..
07/30/2025 06:04 PM 5,726,232 abseil_dll.lib
07/30/2025 06:04 PM 155,616 absl_decode_rust_punycode.lib
07/30/2025 06:04 PM 198,938 absl_demangle_rust.lib
07/30/2025 06:04 PM 157,862 absl_flags_commandlineflag.lib
07/30/2025 06:04 PM 10,752 absl_flags_commandlineflag_internal.lib
07/30/2025 06:04 PM 752,338 absl_flags_config.lib
07/30/2025 06:04 PM 941,598 absl_flags_internal.lib
07/30/2025 06:04 PM 1,280,788 absl_flags_marshalling.lib
07/30/2025 06:04 PM 2,660,636 absl_flags_parse.lib
07/30/2025 06:04 PM 184,064 absl_flags_private_handle_accessor.lib
07/30/2025 06:04 PM 412,426 absl_flags_program_name.lib
07/30/2025 06:04 PM 2,333,086 absl_flags_reflection.lib
07/30/2025 06:04 PM 372,044 absl_flags_usage.lib
07/30/2025 06:04 PM 2,461,438 absl_flags_usage_internal.lib
07/30/2025 06:04 PM 681,674 absl_log_flags.lib
07/30/2025 06:04 PM 624,406 absl_log_internal_structured_proto.lib
07/30/2025 06:04 PM 26,412 absl_poison.lib
07/30/2025 06:04 PM 8,588 absl_tracing_internal.lib
07/30/2025 06:04 PM 7,876 absl_utf8_for_code_point.lib
07/30/2025 06:05 PM 21,338 libcurl.lib
07/30/2025 06:07 PM 5,318,604 libprotobuf-lite.lib
07/30/2025 06:07 PM 60,622,572 libprotobuf.lib
07/30/2025 06:07 PM 37,746,900 libprotoc.lib
07/30/2025 06:08 PM 4,261,510 opentelemetry_common.lib
07/30/2025 06:09 PM 9,075,914 opentelemetry_exporter_in_memory.lib
07/30/2025 06:09 PM 10,560,662 opentelemetry_exporter_in_memory_metric.lib
07/30/2025 06:09 PM 5,265,744 opentelemetry_exporter_ostream_logs.lib
07/30/2025 06:09 PM 8,699,962 opentelemetry_exporter_ostream_metrics.lib
07/30/2025 06:09 PM 11,514,056 opentelemetry_exporter_ostream_span.lib
07/30/2025 06:09 PM 5,475,060 opentelemetry_exporter_otlp_http.lib
07/30/2025 06:09 PM 7,632,914 opentelemetry_exporter_otlp_http_client.lib
07/30/2025 06:09 PM 4,738,758 opentelemetry_exporter_otlp_http_log.lib
07/30/2025 06:09 PM 5,558,734 opentelemetry_exporter_otlp_http_metric.lib
07/30/2025 06:09 PM 10,360,988 opentelemetry_http_client_curl.lib
07/30/2025 06:09 PM 46,717,020 opentelemetry_logs.lib
07/30/2025 06:09 PM 148,392,916 opentelemetry_metrics.lib
07/30/2025 06:09 PM 22,414,468 opentelemetry_otlp_recordable.lib
07/30/2025 06:08 PM 16,872,082 opentelemetry_proto.lib
07/30/2025 06:08 PM 11,885,612 opentelemetry_resources.lib
07/30/2025 06:08 PM 45,996,944 opentelemetry_trace.lib
07/30/2025 06:09 PM 10,102 opentelemetry_version.lib
07/30/2025 06:09 PM <DIR> pkgconfig
07/30/2025 06:05 PM 13,452 utf8_range.lib
07/30/2025 06:05 PM 157,276 utf8_validity.lib
07/30/2025 06:04 PM 16,746 zlib.lib
```
so WTF?
Let's go fully static then, and see - because why bother if it's not full .dll
```
a whopping 2.6GB and no grpc
Q:\w\vcpkg\installed\x64-windows-static-md
debug 1406 M
include 12 M
lib 1239 M
share 506039
tools 4496 K
```
So with "vcpkg" doing supposedly "dll" does not make a real .dll - but mix of some deps as .dll, some static,
but actual library also static... Well if that's the case you better go fully static lib.
Now calling CMake directly on opentelemetry-cpp (instead of vcpkg), should give you better outcome (when comes to .dll)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment