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

[package] backward-cpp/1.6: Build fails on Linux with dwarf.h: No such file or directory #16799

Open
SpaceIm opened this issue Mar 30, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@SpaceIm
Copy link
Contributor

SpaceIm commented Mar 30, 2023

Description

backward-cpp cannot be built or consumed on Linux with default stack_details option value (dwarf) if libdw is not installed on the system (in conancenter, it lives in elfutils recipe).

It's similar to #16787, but this issue is about an other missing dependency when stack_details=dwarf.

Package and Environment Details

  • Package Name/Version: backward-cpp/1.6
  • Operating System+version: Linux Ubuntu 22.04 (WSL2)
  • Compiler+version: GCC 12.1.0
  • Conan version: conan 2.0.2
  • Python version: Python 3.10.6

Conan profile

{% set cc = "/usr/bin/gcc-12" %}
{% set cxx = "/usr/bin/g++-12" %}

[settings]
os=Linux
arch=x86_64
compiler=gcc
compiler.version=12
compiler.libcxx=libstdc++11
build_type=Release
[options]
[tool_requires]
[conf]
tools.build:compiler_executables={"c": "{{ cc }}", "cpp": "{{ cxx }}"}
[buildenv]
CMAKE_EXPORT_COMPILE_COMMANDS=ON
CC={{ cc }}
CXX={{ cxx }}

Steps to reproduce

conan install --requires="backward-cpp/1.6" -o "*:shared=True" -b missing

Logs

Click to expand log
backward-cpp/1.6: Building from source
backward-cpp/1.6: Package backward-cpp/1.6:db4452691a621f2684c9df9c022149ba458ac96c
backward-cpp/1.6: Copying sources to build folder
backward-cpp/1.6: Building your package in /home/spaceim/.conan2/p/t/backw1051c59941fd2/b
backward-cpp/1.6: Calling generate()
backward-cpp/1.6: Generators folder: /home/spaceim/.conan2/p/t/backw1051c59941fd2/b/build/Release/generators
backward-cpp/1.6: CMakeToolchain generated: conan_toolchain.cmake
backward-cpp/1.6: CMakeToolchain generated: CMakePresets.json
backward-cpp/1.6: CMakeToolchain generated: ../../../src/CMakeUserPresets.json
backward-cpp/1.6: Generating aggregated env files
backward-cpp/1.6: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
backward-cpp/1.6: Calling build()
backward-cpp/1.6: Running CMake.configure()
backward-cpp/1.6: RUN: cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="/home/spaceim/.conan2/p/t/backw1051c59941fd2/b/build/Release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/home/spaceim/.conan2/p/t/backw1051c59941fd2/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/home/spaceim/.conan2/p/t/backw1051c59941fd2/b/src"
-- Using Conan toolchain: /home/spaceim/.conan2/p/t/backw1051c59941fd2/b/build/Release/generators/conan_toolchain.cmake
-- Conan toolchain: Setting BUILD_SHARED_LIBS = ON
-- The CXX compiler identification is GNU 12.1.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-12 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Backward: /home/spaceim/.conan2/p/t/backw1051c59941fd2/b/src
-- Conan: Target declared 'libdwarf::libdwarf'
-- Conan: Target declared 'libelf::libelf'
-- Conan: Target declared 'ZLIB::ZLIB'
-- Configuring done (3.2s)
-- Generating done (0.0s)
-- Build files have been written to: /home/spaceim/.conan2/p/t/backw1051c59941fd2/b/build/Release

backward-cpp/1.6: Running CMake.build()
backward-cpp/1.6: RUN: cmake --build "/home/spaceim/.conan2/p/t/backw1051c59941fd2/b/build/Release" -- -j8
[1/2] Building CXX object CMakeFiles/backward.dir/backward.cpp.o
FAILED: CMakeFiles/backward.dir/backward.cpp.o
/usr/bin/g++-12 -DBACKWARD_HAS_BACKTRACE=0 -DBACKWARD_HAS_BACKTRACE_SYMBOL=0 -DBACKWARD_HAS_BFD=0 -DBACKWARD_HAS_DW=0 -DBACKWARD_HAS_DWARF=1 -DBACKWARD_HAS_LIBUNWIND=0 -DBACKWARD_HAS_UNWIND=1 -Dbackward_EXPORTS -I/home/spaceim/.conan2/p/t/backw1051c59941fd2/b/src -isystem /home/spaceim/.conan2/p/libdw20641830725ba/p/include -m64 -Wall -Wextra -Wpedantic -g -O3 -DNDEBUG -fPIC -MD -MT CMakeFiles/backward.dir/backward.cpp.o -MF CMakeFiles/backward.dir/backward.cpp.o.d -o CMakeFiles/backward.dir/backward.cpp.o -c /home/spaceim/.conan2/p/t/backw1051c59941fd2/b/src/backward.cpp
In file included from /home/spaceim/.conan2/p/t/backw1051c59941fd2/b/src/backward.cpp:36:
/home/spaceim/.conan2/p/t/backw1051c59941fd2/b/src/backward.hpp:247:10: fatal error: dwarf.h: No such file or directory
  247 | #include <dwarf.h>
      |          ^~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.

backward-cpp/1.6: ERROR:
Package 'db4452691a621f2684c9df9c022149ba458ac96c' build failed
backward-cpp/1.6: WARN: Build folder /home/spaceim/.conan2/p/t/backw1051c59941fd2/b/build/Release
*********************************************************
Recipe 'backward-cpp/1.6' cannot build its binary
It is possible that this recipe is not Conan 2.0 ready
If the recipe comes from ConanCenter check: https://conan.io/cci-v2.html
If it is your recipe, check if it is updated to 2.0
*********************************************************

ERROR: backward-cpp/1.6: Error in build() method, line 110
        cmake.build()
        ConanException: Error 1 while executing
@SpaceIm
Copy link
Contributor Author

SpaceIm commented May 7, 2023

Related to #17403?

@SoShiny
Copy link

SoShiny commented Nov 4, 2023

Hi, I have just run into this issue as well and I thought I share my two cents in case someone finds it useful.

backward-cpp requires libdwarf/20191104 , which in the current recipe version does not package neither dwarf.h nor libdwarf.h. Later versions of the libdwarf package do package the headers in include/libdwarf, but this subdirectory is not added to the self.cpp_info.includedirs (Is it supposed to be imported as <libdwarf/dwarf.h>?).

When altering the libdwarf/20191104 recipe to explicitly copy dwarf.h from its source directory and libdwarf.h from its build directory to the package include directory, backward-cpp can find the headers and continues.

Unfortunately, it immediately runs into the issue that it can't find libelf.h.
This time the libelf package seems to correctly handle the include directories, but backward-cpp does not link against the libelf::libelf target.

When altering the backward-cpp-1.5.patch to include a find_package and a target_link_libraries to for libelf after line 65, backward-cpp finally builds.

On a related note, I wasn't able to compile backward-cpp with the newest libdwarf package due to some compilation error.

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