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

libdwarf cannot find when using vcpkg, and ibdw has become a rerequisite for libdwarf? #330

Open
yhyu13 opened this issue Feb 3, 2024 · 5 comments

Comments

@yhyu13
Copy link

yhyu13 commented Feb 3, 2024

ubuntu 20.04 x64

vcpkg.json

{
    "dependencies": [  
        "spdlog",
        "mimalloc",
        "magic-enum",
        "boost",
        "libdwarf"
    ],
    "builtin-baseline": "53bef8994c541b6561884a8395ea35715ece75db"
}
find_package(libdwarf CONFIG REQUIRED)
# Also requires one of: libbfd (gnu binutils), libdwarf, libdw (elfutils)
FetchContent_Declare(
    backward
    GIT_REPOSITORY https://github.com/yhyu13/backward-cpp
    GIT_TAG 51f0700452cf71c57d43c2d028277b24cde32502  # or a version tag, such as v1.6
    GIT_SHALLOW 1 # optional ( --depth=1 )
    SYSTEM          # optional, the Backward include directory will be treated as system directory
)
FetchContent_MakeAvailable(backward)

Cmake output

-- Could NOT find libdw (missing: LIBDW_LIBRARY LIBDW_INCLUDE_DIR) 
-- Could NOT find libbfd (missing: LIBBFD_LIBRARY LIBBFD_INCLUDE_DIR) 
-- Could NOT find libdwarf (missing: LIBELF_LIBRARY LIBELF_INCLUDE_DIR) 

My main targe could find and link with libdwarf, but it seems backward.cpp cannot?

@yhyu13
Copy link
Author

yhyu13 commented Feb 3, 2024

I am not even sure where to to start debugging this problem, any kindly guide on where to start, thanks!

Edit:
ok, I added ``--debug-output ``` to cmake as here https://stackoverflow.com/questions/57999508/verbose-output-for-cmake-command

@yhyu13

This comment was marked as outdated.

@yhyu13
Copy link
Author

yhyu13 commented Feb 3, 2024

Ok, somehow cmake could find the libdwarf installed by vcpkg after installing libdw by sudo apt-get install libdw-dev -y

It seems to me there is problem in the cmake config for backward on finding these libs?

-- Found libdw: /usr/lib/x86_64-linux-gnu/libdw.so  
-- Could NOT find libbfd (missing: LIBBFD_LIBRARY LIBBFD_INCLUDE_DIR) 
-- Found libdwarf: /home/hangyu5/Documents/Gitrepo-My/HLVM-Engine/Engine/Source/Common/cmake-build-debug-cmake28clang16/vcpkg_installed/x64-linux/debug/lib/libdwarf.a

Notice libdw is from system path, and libdwarf is from vcpkg path

@yhyu13
Copy link
Author

yhyu13 commented Feb 3, 2024

(maybe final update)

Here is the vcpkg.json that would allow backward in cmake to find both libdw and libdwarf

{
    "dependencies": [  
        "libdwarf",
        "elfutils"
    ],
    "builtin-baseline": "53bef8994c541b6561884a8395ea35715ece75db"
}

And elfutils actually requires some apt prerequisites:

sudo apt-get install flex bison autoconf autopoint -y

My output when configuration:

-- Found libdw: /home/hangyu5/Documents/Gitrepo-My/HLVM-Engine/Engine/Source/Common/cmake-build-debug-cmake28clang16/vcpkg_installed/x64-linux/debug/lib/libdw.a  
-- Could NOT find libbfd (missing: LIBBFD_LIBRARY LIBBFD_INCLUDE_DIR) 
-- Found libdwarf: /home/hangyu5/Documents/Gitrepo-My/HLVM-Engine/Engine/Source/Common/cmake-build-debug-cmake28clang16/vcpkg_installed/x64-linux/debug/lib/libdwarf.a  
-- Found Backward: $<BUILD_INTERFACE:/home/hangyu5/Documents/Gitrepo-My/HLVM-Engine/Engine/Source/Common/cmake-build-debug-cmake28clang16/_deps/backward-src>;$<INSTALL_INTERFACE:include> 

notice both libdw and libdwarf comes from vcpkg installed location. (Certainly you need to remove previous apt install llibdw dev and libdwarf dev)

@yhyu13
Copy link
Author

yhyu13 commented Feb 4, 2024

I will keep this issue open as libdw has become a rerequisite for libdwarf? It is a must?

@yhyu13 yhyu13 changed the title libdwarf cannot find for vcpkg libdwarf cannot find for vcpkg, and ibdw has become a rerequisite for libdwarf? Feb 4, 2024
@yhyu13 yhyu13 changed the title libdwarf cannot find for vcpkg, and ibdw has become a rerequisite for libdwarf? libdwarf cannot find when using vcpkg, and ibdw has become a rerequisite for libdwarf? Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant