Repository navigation
Closed
Description
Describe the enhancement requested
I've been wanting to add opentelemetry support in conda-forge for a long time, but given the amount of mutation that happens in packaging there, I wasn't comfortable in doing that before landing conda-forge/arrow-cpp-feedstock#1058.
Now that this is in, I've rebased the PR, but am running into problems pretty quickly. For one, arrow hardcodes
arrow/cpp/cmake_modules/ThirdpartyToolchain.cmake
Line 4974 in 8428c47
| set(opentelemetry-cpp_SOURCE "AUTO") |
even if the config explicitly asks for
-Dopentelemetry-cpp_SOURCE="SYSTEM". With the following patch
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 0b215b5b2..b9cc05953 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -4977,7 +4977,6 @@ if(ARROW_WITH_OPENTELEMETRY)
# cURL is required whether we build from source or use an existing installation
# (OTel's cmake files do not call find_curl for you)
find_curl()
- set(opentelemetry-cpp_SOURCE "AUTO")
resolve_dependency(opentelemetry-cpp)
set(ARROW_OPENTELEMETRY_LIBS
opentelemetry-cpp::traceI then run into further problems in ThirdpartyToolchain.cmake
CMake Error at cmake_modules/ThirdpartyToolchain.cmake:313 (find_package):
By not providing "Findopentelemetry-cpp.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"opentelemetry-cpp", but CMake did not find one.
Could not find a package configuration file provided by "opentelemetry-cpp"
with any of the following names:
opentelemetry-cppConfig.cmake
opentelemetry-cpp-config.cmake
Add the installation prefix of "opentelemetry-cpp" to CMAKE_PREFIX_PATH or
set "opentelemetry-cpp_DIR" to a directory containing one of the above
files. If "opentelemetry-cpp" provides a separate development package or
SDK, be sure it has been installed.
Call Stack (most recent call first):
cmake_modules/ThirdpartyToolchain.cmake:4980 (resolve_dependency)
CMakeLists.txt:546 (include)
despite the fact that our otel packages clearly contain the CMake metadata.
Component(s)
C++, Packaging
Activity
[-]ENH: Allow building against system opentelemetry[/-][+][C Allow building against system opentelemetry[/+][-][C Allow building against system opentelemetry[/-][+][C++] Allow building against system opentelemetry[/+]assignUser commentedon Dec 9, 2024
Hm you explicitly set
SYSTEMvsCONDA. Can you try setting addingexport CMAKE_PREFIX_PATH="$CONDA_PREFIX"in build.sh?assignUser commentedon Dec 9, 2024
Looking at the code that area of the cmake could probably be substantially improved when we move to newer cmake as discussed in #44950
apacheGH-44982: [C++] Add support for building system OpenTelemetry
kou commentedon Dec 9, 2024
It seems that we can remove the
set(opentelemetry-cpp_SOURCE "AUTO").Could you share full error log URL?
h-vetinari commentedon Dec 9, 2024
I restarted a new build, here are the logs
Done, logs here (no change)
assignUser commentedon Dec 10, 2024
I don't think we modify the cmake prefix path in anyway that should prevent otel from being found. I can confirm that a normal
find_package(opentelemetry-cpp)does indeed find it within a conda env without any special additions.Could you run a build with:
h-vetinari commentedon Dec 10, 2024
@assignUser, here are the logs for your suggestion, lightly cleaned up by resubstituting common variables.
I really don't know
ThirdpartyToolchain.cmake, but ISTM that the problem begins by looking forFindopentelemetry-cpp.cmake, rather than just going directly to$PREFIX/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmake(which exists as I pointed out in the OP; it appears in a kind of no-man's-land in the log below, no idea what to make of that).kou commentedon Dec 10, 2024
Findopentelemetry-cpp.cmakemust not be a problem.If
Findopentelemetry-cpp.cmakedoesn't exist,opentelemetry-cpp-config.cmakeis searched automatically.Does
/home/conda/feedstock_root/build_artifacts/apache-arrow_1733797696439/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmakereally exist?h-vetinari commentedon Dec 10, 2024
Yes, see the package contents I posted above, in particular (2nd line under "Files")
(which is relative to
$PREFIX, which will have a different value per build invocation)6 remaining items
kou commentedon Dec 10, 2024
Do we really need https://github.com/conda-forge/arrow-cpp-feedstock/pull/1048/files#diff-54cf74e113dd3f6d11e092fdb1d888ec82c69bdafbb15cfb6570c83ecad28f33R64 ?
kou commentedon Dec 10, 2024
Ah, sorry. It's for Windows.
Do we really need https://github.com/conda-forge/arrow-cpp-feedstock/pull/1048/files#diff-d7075654874cb08007a21aaab3ecd4b3453a9087e7505d034d548b8938b599bcR107 ?
h-vetinari commentedon Dec 10, 2024
This is in reaction to the admonition by CMake mentioned in the OP:
If you're referring to
-Dopentelemetry-cpp_DIR=%LIBRARY_LIB%\cmake\opentelemetry-cpp, it doesn't work without it either (but causes a warning to add it).kou commentedon Dec 10, 2024
Is
libopentelemetry-cppreally installed?The following log doesn't include
libopentelemetry-cpp:assignUser commentedon Dec 10, 2024
Yeah it's not there, I added
ls -R $PREFIX/lib/cmaketo the build.sh:So this is not on our end.
h-vetinari commentedon Dec 10, 2024
I apologise, the recipe had changed enough since I initially opened the PR for otel that I must have missed a spot while rebasing. I had added it as a dependency to
libarrow, but not the global build environment (that's used for runningbuild.sh).I've pushed a new run with more minimal changes (e.g.
-Dopentelemetry-cpp_DIR=).h-vetinari commentedon Dec 10, 2024
Good news: the builds have passed the config stage on all platforms!
I left the patch removing
set(opentelemetry-cpp_SOURCE "AUTO")for now, that likely still worth doing.I'll also need to double-check if a patch I had come with 1.5 years ago for this (that still applies) is still relevant
It likely is though, as shared builds on windows tend to fail if required symbols aren't exported.
h-vetinari commentedon Dec 10, 2024
Hm. Windows fails with something that sounds related to
NOMINMAX. Surprising that this triggers based on whether otel is present/enabled or not...GH-44982: [C++] Add support for building system OpenTelemetry (#44983)
kou commentedon Dec 10, 2024
Issue resolved by pull request 44983
#44983
kou commentedon Dec 10, 2024
The Windows related problems are another problems. Let's work on them in another issue.
h-vetinari commentedon Dec 11, 2024
Thanks a lot! 🙏
Sorry again for the false start.
How so? They appeared only once I enabled otel support...
Fine by me!
kou commentedon Dec 11, 2024
The
set(opentelemetry-cpp_SOURCE "AUTO")problem is that-DARROW_DEPENDENCY_SOURCE=SYSTEMis ignored. Bundled opentelemetry-cpp may be used with-DARROW_DEPENDENCY_SOURCE=SYSTEM.The
ARROW_EXPORT/maxproblems are that our OpenTelemetry integration doesn't work on Windows. It doesn't depend on bundled opentelemetry-cpp nor system opentelemetry-cpp.