dd-opentracing-cpp icon indicating copy to clipboard operation
dd-opentracing-cpp copied to clipboard

dd-opentracing-cpp Win x64 - fatal error C1083: Cannot open include file: 'curl/curl.h': No such file or directory

Open buzz3791 opened this issue 2 years ago • 2 comments

When building dd-opentracing-cpp on Windows x64 Visual Studio C++ 2022 using the instructions at [1] I'm encountering the following error: C:\Users\first.last\dd-opentracing-cpp\src\agent_writer.h(4,10): fatal error C1083: Cannot open include file: 'curl/curl.h': No such file or directory [C:\Users\first.last\dd-opentracing-cpp\.build\dd_opentracing.vcxproj]

I installed vcpkg, cmake, and ran all previous build steps successfully including cmake -DCMAKE_TOOLCHAIN_FILE=%HOMEPATH%\vcpkg\scripts\buildsystems\vcpkg.cmake ..

But the following command is failing: cmake --build . -- -p:Configuration=RelWithDebInfo when trying to find third party include header files. Build output:

C:\Users\first.last\dd-opentracing-cpp\.build>cmake --build . -- -p:Configuration=RelWithDebInfo
MSBuild version 17.4.0+18d5aef85 for .NET Framework
1>Checking Build System
Building Custom Rule C:/Users/first.last/dd-opentracing-cpp/CMakeLists.txt
agent_writer.cpp
C:\Users\first.last\dd-opentracing-cpp\src\agent_writer.h(4,10): fatal error C1083: Cannot open include file: 'curl/curl.h': No such file or directory [C:\Users\first.last\dd-opentracing-cpp\.build\dd_opentracing.vcxproj]
bool.cpp
dynamic_load.cpp
C:\Users\first.last\dd-opentracing-cpp\include\datadog/opentracing.h(19,10): fatal error C1083: Cannot open include file: 'opentracing/tracer.h': No such file or directory [C:\Users\first.last\dd-opentracing-cpp\.build\dd_opentracing.vcxproj]
encoder.cpp
C:\Users\first.last\dd-opentracing-cpp\include\datadog/opentracing.h(19,10): fatal error C1083: Cannot open include file: 'opentracing/tracer.h': No such file or directory [C:\Users\first.last\dd-opentracing-cpp\.build\dd_opentracing.vcxproj]
glob.cpp
C:\Users\first.last\dd-opentracing-cpp\src\glob.h(15,10): fatal error C1083: Cannot open include file: 'opentracing/string_view.h': No such file or directory [C:\Users\first.last\dd-opentracing-cpp\.build\dd_opentracing.vcxproj]
limiter.cpp
--snip---

1 - https://github.com/DataDog/dd-opentracing-cpp#datadog-opentracing-c-client

buzz3791 avatar Jul 17 '23 13:07 buzz3791

I worked around the issue:

PS C:\Users\first.last\dd-opentracing-cpp> git diff .\CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc121ca..30964b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,9 +36,12 @@ set(CMAKE_LIBRARY_PATH deps/lib)
# Dependencies
find_path(OPENTRACING_INCLUDE_DIR NAMES opentracing/tracer.h)
+include_directories(${OPENTRACING_INCLUDE_DIR})
find_library(OPENTRACING_LIB opentracing)
find_library(MSGPACK_LIB msgpack)
-find_package(CURL)
+find_path(CURL_INCLUDE_DIR curl/curl.h)
+include_directories(${CURL_INCLUDE_DIR})
+find_package(CURL CONFIG REQUIRED)
find_package(Threads REQUIRED)
# Code Sanitizers
PS C:\Users\first.last\dd-opentracing-cpp>

buzz3791 avatar Jul 17 '23 13:07 buzz3791

Thanks for leaving this detailed bug report together with its solution, @buzz3791. You also did the same in https://github.com/DataDog/dd-opentracing-cpp/issues/266.

Windows builds are the least frequently tested part of this project. My teammate and I do not have ready access to Windows workstations, and our CI pipeline does not build or test on Windows. You've done us a favor by reporting and working around these build issues on Windows.

When we revisit Windows support (which it appears, from your investigations, we should soon), we'll integrate your changes or something like them. For now, I'm glad you found workarounds.

dgoffredo avatar Jul 17 '23 19:07 dgoffredo