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

Homebrew formula #214

Open
mhx opened this issue Apr 19, 2024 · 22 comments
Open

Homebrew formula #214

mhx opened this issue Apr 19, 2024 · 22 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mhx
Copy link
Owner

mhx commented Apr 19, 2024

It would be helpful if the build instructions could be turned into a Homebrew formula.

@mhx mhx added help wanted Extra attention is needed good first issue Good for newcomers labels May 4, 2024
@alexmyczko
Copy link

alexmyczko commented May 7, 2024

now that i got it building on debian (http://bananas.debian.net/debian/dwarfs/), it should be easy to create a homebrew formula with the help of https://github.com/mhx/dwarfs?tab=readme-ov-file#building-on-macos

99% tests passed, 9 tests failed out of 3095

Total Test time (real) =  27.37 sec

The following tests FAILED:
	2970 - dwarfs/tools_test.end_to_end/standalone (Subprocess aborted)
	2971 - dwarfs/tools_test.end_to_end/universal-tool (Subprocess aborted)
	2972 - dwarfs/tools_test.end_to_end/universal-symlink (Subprocess aborted)
	2973 - dwarfs/tools_test.mutating_and_error_ops/standalone (Subprocess aborted)
	2974 - dwarfs/tools_test.mutating_and_error_ops/universal-tool (Subprocess aborted)
	2975 - dwarfs/tools_test.mutating_and_error_ops/universal-symlink (Subprocess aborted)
	2976 - dwarfs/tools_test.categorize/standalone (Subprocess aborted)
	2977 - dwarfs/tools_test.categorize/universal-tool (Subprocess aborted)
	2978 - dwarfs/tools_test.categorize/universal-symlink (Subprocess aborted)
Errors while running CTest
Output from these tests are in: /Users/amyczko/homebrew/dwarfs/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
FAILED: CMakeFiles/test.util 
cd /Users/amyczko/homebrew/dwarfs/build && /opt/homebrew/Cellar/cmake/3.29.2/bin/ctest --force-new-ctest-process
ninja: build stopped: subcommand failed.

some tests failed, otherwise looks good, most difficult part will be the system extension with special reboot needed to install... any chance to skip the fuse part and use it without?

ok there are some binaries in build/ i guess those should be installed by the formula, and that'll be a good start...
when i have something, you'll find it at https://github.com/alexmyczko/homebrew-mac

binaries are quite large...

-rwxr-xr-x  1 amyczko  staff  3414184 May  7 18:37 dwarfs
-rwxr-xr-x  1 amyczko  staff  2437008 May  7 18:47 dwarfs.strip
-rwxr-xr-x  1 amyczko  staff   737296 May  7 18:47 dwarfs.strip.upx

@mhx
Copy link
Owner Author

mhx commented May 7, 2024

Many thanks for looking into this!

some tests failed, otherwise looks good

These tests likely fail because macFUSE isn't fully enabled yet. It's exactly the same failures as when running in a docker container without proper privileges.

most difficult part will be the system extension with special reboot needed to install...

That should be taken care of by the macFUSE install. I agree that it's a real pain, but I don't think there's much that we can do here. (Happy to be convinced otherwise, though!)

any chance to skip the fuse part and use it without?

Yeah, I should have made it easier to disable these tests at run-time. Noted for the next release.

In the meantime, the simplest fix would be to just patch CMakeLists.txt and remove the tools_test line.

ok there are some binaries in build/ i guess those should be installed by the formula

The install target should take care of everything that's worth installing, which is essentially all binaries + all manpages.

binaries are quite large...

Do you think so? I'd consider them quite moderate at a few MiBs. :)

Anyway, really appreciate that you're looking into this!

@mhx
Copy link
Owner Author

mhx commented May 7, 2024

any chance to skip the fuse part and use it without?

A much better way would be something like 2cb5542.

@alexmyczko
Copy link

As starting point I've created this tarball using git2deb: http://bananas.debian.net/macos/dwarfs/

@alexmyczko
Copy link

alexmyczko commented May 8, 2024

so download dwarfs.rb, run brew install ./dwarfs.rb and it fails:

https://github.com/alexmyczko/homebrew-mac/blob/main/dwarfs.rb

ah my tarball is bad, i'll get that fixed and soon there'll be a formula...

now it's:

-- Checking for module 'flac++>=1.4.2'
--   Found flac++, version 1.4.3
-- Checking for module 'libzstd>=1.5.2'
--   Found libzstd, version 1.5.6
-- Checking for module 'libxxhash>=0.8.1'
--   Found libxxhash, version 0.8.2
-- Checking for module 'fuse>=2.9.9'
--   No package 'fuse' found
-- Checking for module 'fuse3>=3.10.5'
--   No package 'fuse3' found
CMake Error at CMakeLists.txt:354 (message):
  No FUSE or FUSE3 library found


-- Configuring incomplete, errors occurred!

will need to check ccmake options if i can do something about it...

@mhx
Copy link
Owner Author

mhx commented May 8, 2024

now it's:

-- Checking for module 'flac++>=1.4.2'
--   Found flac++, version 1.4.3
-- Checking for module 'libzstd>=1.5.2'
--   Found libzstd, version 1.5.6
-- Checking for module 'libxxhash>=0.8.1'
--   Found libxxhash, version 0.8.2
-- Checking for module 'fuse>=2.9.9'
--   No package 'fuse' found
-- Checking for module 'fuse3>=3.10.5'
--   No package 'fuse3' found
CMake Error at CMakeLists.txt:354 (message):
  No FUSE or FUSE3 library found


-- Configuring incomplete, errors occurred!

I'd guess that it's because the macfuse dependency is missing from the build script?

@mhx
Copy link
Owner Author

mhx commented May 8, 2024

I think we should still depend on macfuse, but just not require that it is already fully set up (with reboots and stuff) when running the tests.

@alexmyczko
Copy link

and the brew formula is just called macfuse? i will try...

@mhx
Copy link
Owner Author

mhx commented May 8, 2024

and the brew formula is just called macfuse? i will try...

Yeah, it's the 4th item in the brew install command from the instructions. :)

@alexmyczko
Copy link

hmmm

Cask 'dwarfs' is unreadable: wrong constant name #<Class:0x000000010fcb6af0>
Warning: Treating ./dwarfs.rb as a formula.
Warning: No available formula with the name "macfuse" (dependency of dwarfs). Did you mean afuse?
==> Searching for similarly named formulae and casks...
==> Casks
macfuse ✔                                                                                          macfuse@dev

To install macfuse ✔, run:
  brew install --cask macfuse ✔

@mhx
Copy link
Owner Author

mhx commented May 8, 2024

Meh: https://github.com/orgs/Homebrew/discussions/3163#discussioncomment-2526187

@mhx
Copy link
Owner Author

mhx commented May 8, 2024

Although this seems to suggest that a formula can depend on a cask...

@mhx
Copy link
Owner Author

mhx commented May 8, 2024

Also interesting: Homebrew/homebrew-core#64491

@mhx
Copy link
Owner Author

mhx commented May 8, 2024

Oh, here we go: https://github.com/gromgit/homebrew-fuse

@mhx
Copy link
Owner Author

mhx commented May 8, 2024

This might help: https://github.com/gromgit/homebrew-fuse/blob/main/require/macfuse.rb
And this: https://github.com/gromgit/homebrew-fuse/blob/main/Formula/squashfuse-mac.rb

@alexmyczko
Copy link

now it's:

-- Checking for module 'flac++>=1.4.2'

-- Found flac++, version 1.4.3

-- Checking for module 'libzstd>=1.5.2'

-- Found libzstd, version 1.5.6

-- Checking for module 'libxxhash>=0.8.1'

-- Found libxxhash, version 0.8.2

-- Checking for module 'fuse>=2.9.9'

-- No package 'fuse' found

-- Checking for module 'fuse3>=3.10.5'

-- No package 'fuse3' found

CMake Error at CMakeLists.txt:354 (message):

No FUSE or FUSE3 library found

-- Configuring incomplete, errors occurred!

I'd guess that it's because the macfuse dependency is missing from the build script?

i tried with, without luck

@alexmyczko
Copy link

alexmyczko commented May 9, 2024

yay! i think the last two comments helped. i've got it soon

==> Fetching dwarfs
==> Downloading http://bananas.debian.net/macos/dwarfs/dwarfs-0.9.9.orig.tar.xz
Already downloaded: /Users/amyczko/Library/Caches/Homebrew/downloads/3a4ad90117afea0b5c8344658ca4a4984055b55d0b46dbe267796f2f4b59d8e3--dwarfs-0.9.9.orig.tar.xz
==> cmake .
==> make
Error: Empty installation

it's installing for me the binaries and manpages. do you need any libs installed or so?
got a better test suggestion?

dwarfs (v0.9.9-30-g2cb5542a5d on branch main [2024-05-07], fuse version 29)
built for arm64, Darwin-23.4.0, AppleClang 15.0.0.15000309

@mhx
Copy link
Owner Author

mhx commented May 9, 2024

yay! i think the last two comments helped. i've got it soon

That is awesome!

==> Fetching dwarfs
==> Downloading http://bananas.debian.net/macos/dwarfs/dwarfs-0.9.9.orig.tar.xz
Already downloaded: /Users/amyczko/Library/Caches/Homebrew/downloads/3a4ad90117afea0b5c8344658ca4a4984055b55d0b46dbe267796f2f4b59d8e3--dwarfs-0.9.9.orig.tar.xz
==> cmake .
==> make
Error: Empty installation

it's installing for me the binaries and manpages. do you need any libs installed or so?

Binaries and manpages should be sufficient.

got a better test suggestion?

If you could get the following sequence of commands to run via homebrew that would be ideal (for the ninja version you need ninja as a dependency):

  1. cmake -DWITH_TESTS=ON -GNinja, or at least cmake -DWITH_TESTS=ON
  2. ninja or make -j$(sysctl -n hw.physicalcpu)
  3. ninja test / make test, preferably with CTEST_PARALLEL_LEVEL=$(sysctl -n hw.physicalcpu) and DWARFS_SKIP_FUSE_TESTS=1 set in the environment
  4. ninja install / make install (this should install everything needed)
dwarfs (v0.9.9-30-g2cb5542a5d on branch main [2024-05-07], fuse version 29)
built for arm64, Darwin-23.4.0, AppleClang 15.0.0.15000309

Once this is working I'll roll a new release so you can reference a release tag rather than a random commit.

@alexmyczko
Copy link

I guess we have to build and be installable without macfuse. Homebrew/homebrew-core#171264 (comment)

@mhx
Copy link
Owner Author

mhx commented May 10, 2024

I guess we have to build and be installable without macfuse. Homebrew/homebrew-core#171264 (comment)

That kinda defeats the whole point of DwarFS and is going to be confusing and annoying at the same time. Confusing because likely people installing it won't know they can't use the FUSE part until they've finished installation. And annoying because then they have to re-install the whole thing (which takes a while to build) after installing macFUSE.

My personal (likely biased) opinion is that banning the dependency on macFUSE is... suboptimal.

There are a couple of ways that I can see this proceeding:

  1. As you suggest, make DwarFS build/install without FUSE. Then it'd depend on whether or not macFUSE is already installed if you get the FUSE driver or not.
  2. Add the formula to gromgit/homebrew-fuse rather than homebrew-core.
  3. Have a dwarfs formula in homebrew-core, with a :linux dependency, and a dwarfs-mac formula in homebrew-fuse.
  4. Have libdwarfs, dwarfs-tools, dwarfs (:linux) formulae, all in homebrew/core, and a dwarfs-mac formula in homebrew/fuse. The latter 3 formulae would all have a dependency on libdwarfs; dwarfs-tools would be installable without the dependency on macFUSE.

I personally like option (4) the most, but it's going to be a significant amount of work on the codebase. Until we get there, (2)/(3) are probably my preference.

@alexmyczko
Copy link

alexmyczko commented May 11, 2024

  1. for homebrew-core
  2. it is already there https://github.com/alexmyczko/homebrew-mac
  3. exercise for someone else, i will do the debian package, that devuan, raspbian, ubuntu will copy
  4. no idea

@mhx
Copy link
Owner Author

mhx commented May 18, 2024

  1. for homebrew-core
  2. it is already there https://github.com/alexmyczko/homebrew-mac
  3. exercise for someone else, i will do the debian package, that devuan, raspbian, ubuntu will copy
  4. no idea

I'm trying to get the code into a state where (4) is possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants