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

Compatibility for Homebrew Formula #185

Open
mhx opened this issue Oct 18, 2024 · 2 comments
Open

Compatibility for Homebrew Formula #185

mhx opened this issue Oct 18, 2024 · 2 comments

Comments

@mhx
Copy link
Contributor

mhx commented Oct 18, 2024

First of all, thanks for this project! I've started using it (optionally, for now) in one of my projects.

While trying to build on macOS, I noticed that cpptrace isn't yet available in Homebrew. So I thought "how hard can it be" and started writing up a formula, which is currently on a dev branch.

While this works fine, there are a two issues:

  1. ccache is currently a hard dependency. I believe the issue here is that if ccache happens to be installed, but it's not a dependency, then cmake will somehow find the ccache binary, but it won't be in the PATH while building. Making it a hard dependency will put ccache in the PATH. This should be fixed by fix: actually use ccache binary returned by find_program #184.
  2. A more serious issue is that libdwarf (the formula is called dwarfutils in Homebrew) must be found via pkgconfig, as the formula doesn't installed a CMake config. This is fine for just building cpptrace, but when using cpptrace from another CMake project via find_package, the cpptrace::cpptrace target will try to link -ldwarf, which it doesn't find because it doesn't recall the linker search path from building cpptrace. This should be fixable by adding the original pkg_check_modules call to cpptrace-config-cmake.in and making sure the dependency is correctly resolved. Maybe you have a better idea.
@jeremy-rifkin
Copy link
Owner

Hello! Thank you for opening this and taking the time to look into a homebrew formula!

Regarding libdwarf, unfortunately I'm not sure the best solution. Even with cmake this stuff is a pain (at least for me). I think what you are suggesting sounds reasonable. The current code checks for a configuration option due to something I encountered when packaging the library for conda.

if(NOT @CPPTRACE_FIND_LIBDWARF_WITH_PKGCONFIG@)
find_dependency(libdwarf REQUIRED)
endif()

And easy and safe solution would be to add something similar to facilitate homebrew. Using pkg_check_modules in the config file any time pkg_check_modules is used in the CMakeLists.txt could also be correct though I'd want to test that locally.

P.s.: Nice project, I think I've heard of DwarFS before :)

@mhx
Copy link
Contributor Author

mhx commented Oct 21, 2024

And easy and safe solution would be to add something similar to facilitate homebrew. Using pkg_check_modules in the config file any time pkg_check_modules is used in the CMakeLists.txt could also be correct though I'd want to test that locally.

Cool, I'll see if I can play with this a bit and come up with a PR. I have the same problem in DwarFS and what I suggested is what worked for me.

P.s.: Nice project, I think I've heard of DwarFS before :)

Thanks! :)

cpptrace helped significantly in the investigation of a recent Windows-specific bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants