Repository navigation
Description
Describe your environment Describe any aspect of your environment relevant to the problem, including your platform, build system, version numbers of installed dependencies, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main branch.
Platform - WSL
Buildsystem - CMake v3.19
Code
main.cpp
#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "Hello CMake!" << std::endl;
return 0;
}
CMakeLists.txt
# Set the minimum version of CMake that can be used
# To find the cmake version run
# $ cmake --version
cmake_minimum_required (VERSION 3.19)
cmake_policy(SET CMP0110 NEW)
# Set the project name
project (hello_cmake)
# Add an executable
add_executable(hello_cmake main.cpp)
find_package(opentelemetry-cpp REQUIRED)
target_include_directories(hello_cmake PUBLIC ${OPENTELEMETRY_CPP_INCLUDE_DIRS})
target_link_libraries(hello_cmake PUBLIC ${OPENTELEMETRY_CPP_LIBRARIES})
Steps to reproduce
Describe exactly how to reproduce the error. Include a code sample if applicable.
I have attached a sample CMake code
cmake -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="hello-cmake/out/install/WSL-GCC-Debug" hello-cmake/CMakeLists.txt
What is the expected behavior?
CMake Generation should happen without any warnings or errors
What is the actual behavior?
-- Configuring done
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0111 is not set: An imported target missing its location property
fails during generation. Run "cmake --help-policy CMP0111" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
IMPORTED_LOCATION not set for imported target "opentelemetry-cpp::version"
configuration "Debug".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0111 is not set: An imported target missing its location property
fails during generation. Run "cmake --help-policy CMP0111" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
IMPORTED_LOCATION not set for imported target "opentelemetry-cpp::common"
configuration "Debug".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0111 is not set: An imported target missing its location property
fails during generation. Run "cmake --help-policy CMP0111" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
IMPORTED_LOCATION not set for imported target "opentelemetry-cpp::trace"
configuration "Debug".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0111 is not set: An imported target missing its location property
fails during generation. Run "cmake --help-policy CMP0111" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
IMPORTED_LOCATION not set for imported target "opentelemetry-cpp::metrics"
configuration "Debug".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0111 is not set: An imported target missing its location property
fails during generation. Run "cmake --help-policy CMP0111" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
IMPORTED_LOCATION not set for imported target "opentelemetry-cpp::logs"
configuration "Debug".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0111 is not set: An imported target missing its location property
fails during generation. Run "cmake --help-policy CMP0111" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
IMPORTED_LOCATION not set for imported target
"opentelemetry-cpp::ostream_log_exporter" configuration "Debug".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0111 is not set: An imported target missing its location property
fails during generation. Run "cmake --help-policy CMP0111" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
IMPORTED_LOCATION not set for imported target
"opentelemetry-cpp::ostream_metrics_exporter" configuration "Debug".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in CMakeLists.txt:
Policy CMP0111 is not set: An imported target missing its location property
fails during generation. Run "cmake --help-policy CMP0111" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
IMPORTED_LOCATION not set for imported target
"opentelemetry-cpp::ostream_span_exporter" configuration "Debug".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in [CMakeLists.txt:](url)
Policy CMP0111 is not set: An imported target missing its location property
fails during generation. Run "cmake --help-policy CMP0111" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
IMPORTED_LOCATION not set for imported target "opentelemetry-cpp::zpages"
configuration "Debug".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Generating done
-- Build files have been written to: /mnt/c/users/jejosep/source/repos/cmake-examples-master/01-basic/hello-cmake
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
lalitb commentedon Apr 27, 2021
Thanks for reporting the issue with all relevant details.
I had a quick run on the example posted above ( using cmake 3.15.2 - the one which is installed with me locally ), and was able to build it successfully. Will try it out with the cmake version used in the test above (i.e 3.19)
lalitb commentedon Apr 28, 2021
Ok. I validated using cmake-3.20.1 too, and it works fine. Can you ensure that opentelemetry-cpp is installed correctly in the system path, probably check the content of below directories ( on *nix/wsl ):
nkrishnappa commentedon Apr 29, 2021
Hi @lalitb ,
We have also tried linking cpp client , However facing similar issue.
Platform - ubi8, rhel 8
Buildsystem -
[root@c75b9f14a114 build]# cmake --version cmake version 3.19.6 CMake suite maintained and supported by Kitware (kitware.com/cmake)Installation Steps:
Observations:
Thanks,
Nandisha
jefjos commentedon Apr 29, 2021
The only difference I can spot is I'm missing the file - opentelemetry-cpp-target-noconfig.cmake
ThomsonTan commentedon Apr 30, 2021
@jefjos what is the linking issue? From the original post, there is CMake warnings but the build files were still produced. Would the build succeed based on that?
jefjos commentedon Apr 30, 2021
The subsequent build with ninja is failing with the following error
Installed OTEL files
nkrishnappa commentedon Apr 30, 2021
After manually copied the noconfig.cmake to lib directory able to link it.
ThomsonTan commentedon Apr 30, 2021
@jefjos where is opentelemetry-cpp installed? I saw below option is passed to cmake, was it intended to install opentelemetry-cpp under the test project folder like
hello-cmake/out? If opentelemetry-cpp is installed to system default location like /usr/local/include and /usr/local/lib, below option should not be passed as a customized path.-DCMAKE_INSTALL_PREFIX:PATH="hello-cmake/out/install/WSL-GCC-Debug"jefjos commentedon Apr 30, 2021
I tried again after deleting all cached files and running
cmake -G "Ninja"Getting same warnings and build error
jefjos commentedon Apr 30, 2021
Have added the following lines in CMakeLists.txt as a workaround for now
ThomsonTan commentedon Apr 30, 2021
@jefjos based on your listing above, the problem is you are missing the configuration specific target CMake file in below directory, like
opentelemetry-cpp-target-debug.cmake. Could you please clean all the installed files for opentelemetry-cpp and re-build and re-install it? I did the build and installation in WSL as well and got the config file there.owent commentedon Jun 5, 2021
The cmake config file are installed under
<CMAKE_INSTALL_PREFIX>/lib/cmake/opentelemetry-cppor<CMAKE_INSTALL_PREFIX>/lib64/cmake/opentelemetry-cpp.The
opentelemetry-cpp-target.cmakewill include allopentelemetry-cpp-target-*.cmakeand the suffix ofopentelemetry-cpp-target-*.cmakedepend on what you pass to--configif you usecmake --build ...to build.For example:
When using
cmake --build . --target install --config RedWithDebInfoto build opentelemetry-cpp,opentelemetry-cpp-target-relwithdebinfo.cmakewill be installed.When nothing passed into--config,opentelemetry-cpp-target-noconfig.cmakewill be installed.lalitb commentedon Jun 22, 2021
@jefjos @nkrishnappa please update whether you are able to build it successfully with the latest release.
owent commentedon Jun 23, 2021
Please consider using codes below to move some properties out of CONFIG if there are still problems to link.
github-actions commentedon Nov 23, 2021
This issue was marked as stale due to lack of activity. It will be closed in 7 days if no furthur activity occurs.
github-actions commentedon Jan 23, 2022
This issue was marked as stale due to lack of activity. It will be closed in 7 days if no furthur activity occurs.
github-actions commentedon Mar 25, 2022
This issue was marked as stale due to lack of activity. It will be closed in 7 days if no furthur activity occurs.
github-actions commentedon Apr 1, 2022
Closed as inactive. Feel free to reopen if this is still an issue.
MartinEmrich commentedon Nov 17, 2023
Same issue. Built the Debian .deb package for 1.12.2 according to docs, but the package was missing the
opentelemetry-cpp-target-noconfig.cmakefile.I found it in my build directory, and copied it manually to /usr/lib/cmake/opentelemetry-cpp.
MartinEmrich commentedon Nov 17, 2023
... and this happens because of
cpack -C Debugfrom https://github.com/open-telemetry/opentelemetry-cpp/blob/main/INSTALL.mdIf I just do
cpack, the file is contained in the .deb package.