You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to use project level flake.nix to configure a cpp project and need to add opentelemetry-cpp as a dependency. My flake.nix file looks like follows:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
nix-vscode-extensions.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {self, nixpkgs, flake-utils, nix-vscode-extensions, ...} @inputs:
flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-darwin" "x86_64-darwin"] (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
extensions = nix-vscode-extensions.extensions.${system};
my-cmake-tools = extensions.vscode-marketplace.ms-vscode.cmake-tools.overrideAttrs (_: {sourceRoot = "extension";});
custom-vscode-extensions = builtins.attrValues {
inherit (extensions.vscode-marketplace.redhat) vscode-yaml;
inherit (extensions.vscode-marketplace.ms-vscode) vscode-typescript-tslint-plugin;
inherit (extensions.vscode-marketplace.ms-python) python;
inherit (extensions.vscode-marketplace.tamasfe) even-better-toml;
inherit (extensions.vscode-marketplace.vadimcn) vscode-lldb;
inherit (extensions.vscode-marketplace.llvm-vs-code-extensions) vscode-clangd;
inherit (extensions.vscode-marketplace.bbenoist) nix;
inherit (extensions.vscode-marketplace.twxs) cmake;
inherit (extensions.vscode-marketplace.mkhl) direnv;
inherit (extensions.vscode-marketplace.github) copilot github-vscode-theme copilot-chat;
inherit (extensions.vscode-marketplace.vscodevim) vim;
inherit(extensions.vscode-marketplace.tdennis4496) cmantic;
inherit my-cmake-tools;
};
codium =
let
inherit (pkgs) vscode-with-extensions vscodium vscodium-fhs;
in (vscode-with-extensions.override {
vscode = vscodium;
vscodeExtensions = custom-vscode-extensions;
});
shellHook = ''
echo -e "Welcome to Shell\nCMake Version: $(cmake -version)\nCompiler: $CC\nCompiler Version: $($CC -v 2>&1)"
''
+ (if pkgs.stdenv.hostPlatform.isDarwin then
''
export MACOSX_DEPLOYMENT_TARGET=14.0
# do not use nixpkgs provided core foundation
export NIX_COREFOUNDATION_RPATH=/System/Library/Frameworks
# magic speedup pony :facepalm:
#
# nix has the ugly habbit of duplicating ld flags more than necessary. This
# somewhat consolidates this.
export NIX_LDFLAGS=$(for a in $NIX_LDFLAGS; do echo $a; done |sort|uniq|xargs)
export NIX_LDFLAGS_FOR_TARGET=$(for a in $NIX_LDFLAGS_FOR_TARGET; do echo $a; done |sort|uniq|xargs)
export NIX_LDFLAGS_FOR_TARGET=$(comm -3 <(for l in $NIX_LDFLAGS_FOR_TARGET; do echo $l; done) <(for l in $NIX_LDFLAGS; do echo $l; done))
# drop curses from the LDFLAGS, we really want the system ones, not the nix ones.
export NIX_LDFLAGS=$(for lib in $NIX_LDFLAGS; do case "$lib" in *curses*);; *) echo -n "$lib ";; esac; done;)
# unconditionally add the MacOSX.sdk
export NIX_LDFLAGS="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib $NIX_LDFLAGS"
''
else '''');
nativeBuildInputs = with pkgs; [
cmake
ninja
pkg-config
doxygen
prometheus-cpp
# opentelemetry-cpp
(opentelemetry-cpp.overrideAttrs(oldAttrs: rec {
version = "1.14.2";
src = fetchFromGitHub {
owner = "open-telemetry";
repo = "opentelemetry-cpp";
rev = "v${version}";
sha256 = "sha256-jLRUpB9aDvxsc7B42b08vN2rygN/ycgOyt78i2Hms0Q=";
};
cmakeFlags = oldAttrs.cmakeFlags ++ [
"-DWITH_ABSEIL=OFF"
"-DBUILD_SHARED_LIBS=OFF"
"-DBUILD_TESTING=OFF"
"-DCMAKE_CXX_STANDARD=20"
"-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE"
"-DWITH_STL=ON"
"-DWITH_PROMETHEUS=ON"
"-DWITH_BENCHMARK=OFF"
"-DWITH_OTLP_GRPC=OFF"
"-DWITH_OTLP_HTTP=OFF"
];
}))
curl # needed by prometheus
fmt
];
in
rec {
metric_lib = (with pkgs; llvmPackages_16.stdenv.mkDerivation rec {
pname = "metric_lib";
name = pname;
version = "0.0.0";
src = self;
cmakeFlags = [
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
"-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=1"
];
inherit nativeBuildInputs;
});
defaultPackage = metric_lib;
devShells = {
libEnv = pkgs.mkShell {
inherit nativeBuildInputs;
inherit shellHook;
buildInputs = with pkgs; [ # things that should exist at runtime
graphviz
mas
jq
shellcheck
codium
];
};
default = devShells.libEnv;
};
}
);
}
The current version in nixpkgs is 1.13.0 and i wanted to use 1.14.2 the latest but after overrides I get an error during cmake.
The error
-- The CXX compiler identification is Clang 16.0.6
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/24ljvc5iwbs01svv9s8zvfcl5qs876kp-clang-wrapper-16.0.6/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found LibDl: /nix/store/p4dv7f7icpnwf3zflxyq76k1pybm895q-libSystem-11.0.0/lib/libdl.tbd
-- Found ZLIB: /nix/store/82i7jfq9lgbpvbkcm0wraxnyrjxirka8-zlib-1.3.1/lib/libz.dylib (found version "1.3.1")
-- Found CURL: /nix/store/sjd48k88anskbjaw5q6cwrv2hsnpasgh-curl-8.6.0/lib/libcurl.dylib (found version "8.6.0")
-- Found opentelemetry-cpp: /nix/store/qmgfdqgmcijn54xlryzx2pk0xvf8gfgj-opentelemetry-cpp-1.14.2-dev/include
-- Configuring done (2.2s)
CMake Error in opentelemetry/CMakeLists.txt:
Imported target "opentelemetry-cpp::api" includes non-existent path
"/nix/store/gsh6k7dyhy7x9k20rcyzr2klzf27bfa2-opentelemetry-cpp-1.14.2/include"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
* The path was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and references files it does not
provide.
CMake Error in opentelemetry/CMakeLists.txt:
Imported target "opentelemetry-cpp::api" includes non-existent path
"/nix/store/gsh6k7dyhy7x9k20rcyzr2klzf27bfa2-opentelemetry-cpp-1.14.2/include"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
* The path was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and references files it does not
provide.
CMake Error at /nix/store/qmgfdqgmcijn54xlryzx2pk0xvf8gfgj-opentelemetry-cpp-1.14.2-dev/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-target.cmake:120 (set_target_properties):
The link interface of target "opentelemetry-cpp::http_client_curl"
contains:
CURL::libcurl
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
/nix/store/qmgfdqgmcijn54xlryzx2pk0xvf8gfgj-opentelemetry-cpp-1.14.2-dev/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmake:88 (include)
opentelemetry/CMakeLists.txt:2 (find_package)
CMake Error at /nix/store/qmgfdqgmcijn54xlryzx2pk0xvf8gfgj-opentelemetry-cpp-1.14.2-dev/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-target.cmake:156 (set_target_properties):
The link interface of target "opentelemetry-cpp::prometheus_exporter"
contains:
prometheus-cpp::pull
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
/nix/store/qmgfdqgmcijn54xlryzx2pk0xvf8gfgj-opentelemetry-cpp-1.14.2-dev/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmake:88 (include)
opentelemetry/CMakeLists.txt:2 (find_package)
CMake Error at /nix/store/qmgfdqgmcijn54xlryzx2pk0xvf8gfgj-opentelemetry-cpp-1.14.2-dev/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-target.cmake:172 (set_target_properties):
The link interface of target
"opentelemetry-cpp::elasticsearch_log_record_exporter" contains:
nlohmann_json::nlohmann_json
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
Call Stack (most recent call first):
/nix/store/qmgfdqgmcijn54xlryzx2pk0xvf8gfgj-opentelemetry-cpp-1.14.2-dev/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmake:88 (include)
opentelemetry/CMakeLists.txt:2 (find_package)
The path that is listed in the cmake output Found opentelemetry -> /nix/store/qmgfdqgmcijn54xlryzx2pk0xvf8gfgj-opentelemetry-cpp-1.14.2-dev/ has include files and a lib folder that only contains cmake and pkgconfig folders, but no actual libs files.
The libs are installed in /nix/store/gsh6k7dyhy7x9k20rcyzr2klzf27bfa2-opentelemetry-cpp-1.14.2/lib/ notice this does not have the -dev suffix to the path.
I cannot figure out how to fix this issue.
I looked inside one of the cmake config files vi /nix/store/qmgfdqgmcijn54xlryzx2pk0xvf8gfgj-opentelemetry-cpp-1.14.2-dev/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmake
Hi,
I am trying to use project level flake.nix to configure a cpp project and need to add opentelemetry-cpp as a dependency. My flake.nix file looks like follows:
The current version in nixpkgs is 1.13.0 and i wanted to use 1.14.2 the latest but after overrides I get an error during cmake.
The error
The path that is listed in the cmake output Found opentelemetry ->
/nix/store/qmgfdqgmcijn54xlryzx2pk0xvf8gfgj-opentelemetry-cpp-1.14.2-dev/
has include files and a lib folder that only contains cmake and pkgconfig folders, but no actual libs files.The libs are installed in
/nix/store/gsh6k7dyhy7x9k20rcyzr2klzf27bfa2-opentelemetry-cpp-1.14.2/lib/
notice this does not have the-dev
suffix to the path.I cannot figure out how to fix this issue.
I looked inside one of the cmake config files
vi /nix/store/qmgfdqgmcijn54xlryzx2pk0xvf8gfgj-opentelemetry-cpp-1.14.2-dev/lib/cmake/opentelemetry-cpp/opentelemetry-cpp-config.cmake
and I notice that 2 variables get set like this
The include directory has a path while the lib is on a different path due to this variable PACKAGE_PREFIX_DIR
A Sample CmakeLists.txt for this
Not sure if someone can help figure out what is different in my settings to cause this.
The text was updated successfully, but these errors were encountered: