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

whisper-cpp: make compatible with --HEAD install #202270

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mislav
Copy link
Contributor

@mislav mislav commented Dec 23, 2024

This is to accommodate the build system changes in the upcoming v1.7.4 release.

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

In --HEAD mode, the main changes are that dylibs are now enabled and that the main binary is now called whisper-cli.

Libraries and header files currently unfortunately conflict with the llama.cpp formula, so in this installation we rename the "lib" folder and omit the header files to avoid the conflict. ggerganov/ggml#1050 (comment)

Formula/w/whisper-cpp.rb Outdated Show resolved Hide resolved
Formula/w/whisper-cpp.rb Outdated Show resolved Hide resolved
system "cmake", "--build", "build", "--target", "main"
bin.install "build/bin/main" => "whisper-cpp"
# avoid installing libggml libraries to "lib" since they would conflict with llama.cpp
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args(install_libdir: "libinternal")
Copy link
Member

@carlocab carlocab Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args(install_libdir: "libinternal")
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args(install_libdir: "lib/ggml")

Maybe? You'll need to adjust the argument to #rpath from my suggestion above if you apply this. (to rpath(target: lib/"ggml")).

Though, ideally we should be using libggml from llama.cpp instead (or vice-versa).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though, ideally we should be using libggml from llama.cpp instead (or vice-versa).

I've suggested this with maintainers of libggml/llama.cpp/whisper.cpp and they said that could be an eventual goal but that the codebases aren't ready for that at this moment since libggml seems to be such a fast-moving target.

Formula/w/whisper-cpp.rb Outdated Show resolved Hide resolved
Comment on lines 43 to 49
(bin/"whisper-cpp").write <<~EOS
#!/bin/bash
here="${BASH_SOURCE[0]}"
echo "${BASH_SOURCE[0]}: warning: whisper-cpp is deprecated. Use whisper-cli instead." >&2
exec "$(dirname "$here")/whisper-cli" "$@"
EOS
(bin/"whisper-cpp").chmod 0755
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably do this unconditionally?

This is to accommodate the build system changes in the upcoming v1.7.4
@mislav
Copy link
Contributor Author

mislav commented Dec 25, 2024

@carlocab Thanks for the detailed review; I've addressed the comments.

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

Successfully merging this pull request may close these issues.

2 participants