Skip to content
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

Windows build error [OTEL v1.14.0] #2538

Closed
orion160 opened this issue Feb 17, 2024 · 1 comment
Closed

Windows build error [OTEL v1.14.0] #2538

orion160 opened this issue Feb 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@orion160
Copy link
Contributor

orion160 commented Feb 17, 2024

MSVC version 19.39.33519
VS 17.9.0

windows version:

Edition Windows 11 Pro
Version 23H2
Installed on ‎2/‎5/‎2024
OS build 22631.3155
Experience Windows Feature Experience Pack 1000.22684.1000.0

Build instructions:

Manually build googletest and google-benchmark with versions specified in third_party_release

cmake -S . -B ./out/build/googletest -G Ninja \
-D CMAKE_C_COMPILER=cl -D CMAKE_CXX_COMPILER=cl \
-D CMAKE_INSTALL_PREFIX=C:\Sdks\googletest\googletest_1.13.0 \
-D CMAKE_BUILD_TYPE=Release

cmake -S . -B ./out/build/google-benchmark -G Ninja \
-D CMAKE_C_COMPILER=cl -D CMAKE_CXX_COMPILER=cl \
-D CMAKE_INSTALL_PREFIX=C:\Sdks\google-benchmark\google-benchmark_v1.7.1 \
-D CMAKE_BUILD_TYPE=Release -D GOOGLETEST_PATH=C:/Dev/googletest

Build opentelemetry:

cmake -S . -B ./out/build/opentelemetry-cpp -G Ninja \
-D CMAKE_C_COMPILER=cl -D CMAKE_CXX_COMPILER=cl \
-D CMAKE_INSTALL_PREFIX=C:\Sdks\opentelemetry-cpp\opentelemetry-cpp_v1.14.0 \
-D CMAKE_BUILD_TYPE=Release -D GTest_ROOT=C:/Sdks/googletest/googletest_1.13.0 \
-D benchmark_ROOT=C:/Sdks/google-benchmark/google-benchmark_v1.7.1

It gives a link error
log.txt

@orion160 orion160 added the bug Something isn't working label Feb 17, 2024
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Feb 17, 2024
@orion160
Copy link
Contributor Author

orion160 commented Feb 17, 2024

By default GoogleTest links with the standard C library statically...
Use: gtest_force_shared_crt

Updated configure steps:

cmake -S . -B ./out/build/abseil-cpp_20220623.1 -G Ninja -D CMAKE_C_COMPILER=cl -D CMAKE_CXX_COMPILER=cl -D CMAKE_BUILD_TYPE=Release -D CMAKE_PREFIX_PATH=C:/Sdks/googletest/googletest_1.13.0 -D CMAKE_INSTALL_PREFIX=C:/Sdks/abseil/abseil-cpp_20220623.1 -D ABSL_ENABLE_INSTALL=ON -D ABSL_BUILD_TESTING=ON -D ABSL_USE_EXTERNAL_GOOGLETEST=ON -D ABSL_FIND_GOOGLETEST=ON -D ABSL_PROPAGATE_CXX_STD=ON

cmake -S . -B ./out/build/googletest -G Ninja -D CMAKE_C_COMPILER=cl -D CMAKE_CXX_COMPILER=cl -D CMAKE_INSTALL_PREFIX=C:\Sdks\googletest\googletest_1.13.0 -D CMAKE_BUILD_TYPE=Release -D gtest_force_shared_crt=ON

cmake -S . -B ./out/build/google-benchmark -G Ninja -D CMAKE_C_COMPILER=cl -D CMAKE_CXX_COMPILER=cl -D CMAKE_INSTALL_PREFIX=C:\Sdks\google-benchmark\google-benchmark_v1.7.1 -D CMAKE_BUILD_TYPE=Release -D GTest_ROOT=C:/Sdks/googletest/googletest_1.13.0 -D BENCHMARK_USE_BUNDLED_GTEST=OFF

cmake -S . -B ./out/build/opentelemetry-cpp -G Ninja -D CMAKE_C_COMPILER=cl -D CMAKE_CXX_COMPILER=cl -D CMAKE_INSTALL_PREFIX=C:\Sdks\opentelemetry-cpp\opentelemetry-cpp_v1.14.0 -D CMAKE_BUILD_TYPE=Release -D GTest_ROOT=C:/Sdks/googletest/googletest_1.13.0 -D benchmark_ROOT=C:/Sdks/google-benchmark/google-benchmark_v1.7.1 -D WITH_ETW=OFF -D WITH_ABSEIL=ON -D absl_ROOT=C:/Sdks/abseil/abseil-cpp_20220623.1

NOTE:
WITH_ABSEIL will require that consumers of opentelemetry depend on it

if(WITH_ABSEIL)
  target_compile_definitions(opentelemetry_api INTERFACE HAVE_ABSEIL)
  target_link_libraries(
    opentelemetry_api INTERFACE absl::bad_variant_access absl::any absl::base
                                absl::bits absl::city)
  list(APPEND TARGET_DEPS "absl_bad_variant_access" "absl_any absl_base"
       "absl_bits" "absl_city")
endif()

@orion160 orion160 changed the title Windows build error [OTEL v1.14.0 Windows build error [OTEL v1.14.0] Feb 18, 2024
@marcalff marcalff removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants