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

Build Improvements for Packaging #2013

Closed
carlocab opened this issue Nov 23, 2021 · 12 comments · Fixed by #2025
Closed

Build Improvements for Packaging #2013

carlocab opened this issue Nov 23, 2021 · 12 comments · Fixed by #2025
Assignees
Milestone

Comments

@carlocab
Copy link

carlocab commented Nov 23, 2021

Is your feature request related to a problem? Please describe.
@ebmmy was kind enough to work on packaging Rizin for Homebrew. See Homebrew/homebrew-core#89709.

While trying to get the build to pass in Homebrew CI, we encountered issues in meson being able to find Homebrew xxhash and libmagic.

libmagic is found via Meson's find_library. Unfortunately, find_library doesn't seem to know how to find Homebrew-installed libraries by default, so we worked around this by adding a dirs argument to the find_library call.

xxhash is found using Meson's dependency, which uses pkg-config. Unfortunately, pkg-config looks for an xxhash.pc, but a default xxhash build installs only libxxhash.pc. We worked around this by creating a symlink, but it would be nice if this were not needed.

Describe the solution you'd like
For libmagic, it might help if there were additional options in meson_options.txt that allow passing the path to the directory containing libmagic, which is then passed to the dirs argument of find_library. This would allow us to pass this as a flag to meson rather than modifying your build script (which can be a bit fragile).

I'm not sure if a similar fix would work for xxhash, but since meson.build seems to fall back to find_library when dependency doesn't work, this might too.

Describe alternatives you've considered
We could keep carrying around our workarounds, but it would be nice if we didn't have to. Finding fixes here would also ensure that your users who encounter the same problems we did (outside of Homebrew) wouldn't have to discover our workarounds for themselves.

Additional context
As mentioned above, this is related to Homebrew/homebrew-core#89709.

@ret2libc
Copy link
Member

@ebmmy was kind enough to work on packaging Rizin for Homebrew. See Homebrew/homebrew-core#89709.

Amazing!! <3 Thanks a lot for this, it's much appreciated.

I will work through the rest of your report to find the best solution.

@ret2libc ret2libc self-assigned this Nov 23, 2021
@ret2libc ret2libc added this to the 0.4.0 milestone Nov 23, 2021
@ret2libc
Copy link
Member

xxhash is found using Meson's dependency, which uses pkg-config. Unfortunately, pkg-config looks for an xxhash.pc, but a default xxhash build installs only libxxhash.pc. We worked around this by creating a symlink, but it would be nice if this were not needed.

Nice catch, I think indeed I should replace dependency('xxhash'..) with dependency('libxxhash') because also on Ubuntu, Fedora and Arch linux the file is called libxxhash.pc. I guess this was a mistake on my side and with this change the find_library fallback should not be needed.

@carlocab
Copy link
Author

That makes sense. Maybe a dependency('libmagic'...) would work for our libmagic issue too? We have a libmagic.pc. Is there any reason libmagic doesn't use the dependency-with-fallback-to-find_library pattern for the other dependencies?

@ret2libc
Copy link
Member

libmagic is found via Meson's find_library. Unfortunately, find_library doesn't seem to know how to find Homebrew-installed libraries by default, so we worked around this by adding a dirs argument to the find_library call.

Same for this. We should probably just use dependency('libmagic'...).

@ret2libc
Copy link
Member

Is there any reason libmagic doesn't use the dependency-with-fallback-to-find_library pattern for the other dependencies?

From the top of my head I think I did it that way because I couldn't find the .pc files, but I could be wrong as well and I could have just missed those files. The safest approach is probably to use the dependency + find_library fallback approach for both libs.

@carlocab
Copy link
Author

I couldn't find the .pc files

libmagic's .pc file is also called libmagic.pc, so that might also be why dependency('magic'...) doesn't work.

@ret2libc
Copy link
Member

@carlocab is it ok if we reference homebrew in our INSTALL section as a way to install Rizin on Mac after the formula will be mergd?

@carlocab
Copy link
Author

Of course; that's more than okay. :)

@ret2libc
Copy link
Member

@carlocab #2023

@carlocab
Copy link
Author

Thanks!

@XVilka
Copy link
Member

XVilka commented Jan 7, 2022

@carlocab the fix is now included in the 0.3.3 release: https://github.com/rizinorg/rizin/releases/tag/v0.3.3

@carlocab
Copy link
Author

carlocab commented Jan 7, 2022

Yep, I noticed. Thanks for the update!

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