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 on FreeBSD #56

Closed
abelbabel opened this issue Oct 16, 2022 · 9 comments
Closed

Build on FreeBSD #56

abelbabel opened this issue Oct 16, 2022 · 9 comments
Labels
build Build related issues

Comments

@abelbabel
Copy link

abelbabel commented Oct 16, 2022

Hi,

I could compile this on FreeBSD 13.1-RELEASE-p2 amd64, having devel/gmake installed (using gmake then instead of make) and using the following modifications:

--- Makefile_ori        2022-10-16 21:19:22.498824000 +0200
+++ Makefile    2022-10-16 22:40:53.787014000 +0200
@@ -22,10 +22,17 @@
        CFLAGS   += -pthread
        CXXFLAGS += -pthread
 endif
+ifeq ($(UNAME_S),FreeBSD)
+       CFLAGS   += -pthread
+       CXXFLAGS += -pthread
+endif
 
 # Architecture specific
 # TODO: probably these flags need to be tweaked on some architectures
 ifeq ($(UNAME_M),x86_64)
+       CFLAGS += -mavx -mavx2 -mfma -mf16c
+endif
+ifeq ($(UNAME_M),amd64)
        CFLAGS += -mavx -mavx2 -mfma -mf16c
 endif
 ifneq ($(filter arm%,$(UNAME_M)),)

(don't know gmake-Makefiles too much, could be prettier with logical or here ...)

--- ggml.c_ori  2022-10-16 21:19:22.502786000 +0200
+++ ggml.c      2022-10-16 21:28:00.140594000 +0200
@@ -2,7 +2,7 @@

 #if defined(_MSC_VER) || defined(__MINGW32__)
 #include <malloc.h> // using malloc.h with MSC/MINGW
-#else
+#elif !defined(__FreeBSD__)
 #include <alloca.h>
 #endif

Seems not so hard to merge changes into upstream ...

For downloading models ftp/wget is needed.

Kind regards,
abelbabel

@ggerganov ggerganov added the build Build related issues label Oct 17, 2022
@abelbabel
Copy link
Author

Found recently that shells/bash also has to be installed in order to be able to download models.

@abelbabel
Copy link
Author

For downloading samples (as defined by Makefile) multimedia/ffmpeg is also needed ...

@abelbabel
Copy link
Author

And an additional note, since I saw whisper.cpp being compiled with GCC: on the above FreeBSD it uses clang by default:

$ cc --version
FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)
...
$ cpp --version
FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)
...

@Baenwort
Copy link

I would be interested in getting this to work for me @abelbabel as I'm starting to plan how to use Whisper to create srt subtitles for broadcasts I've recorded that either didn't have functioning CC or only had them in English for other language audio.

Any chance you might make a port package or some instructions that are step by step from a fresh jail?

@abelbabel
Copy link
Author

abelbabel commented Dec 10, 2022

In fact everything should already be here.

To sum it up:

  1. Install pre-requisites
# pkg install devel/gmake shells/bash ftp/wget git-lite
  1. Clone the git repo ...
  2. in root of git repo do gmake
  3. use the program like $ ./main -m ...

I recently got the impression that if you want/need to compile it for other architectures than amd64, you might need to improve Makefile ...

Please have a try and if you run in some trouble, share them.

@abelbabel
Copy link
Author

abelbabel commented Dec 10, 2022

You could also use an "ad-hoc"-jail using the main systems bins and libs (so you won't need an extra jails) - to be 1000%-sure the whisper-implementation does not call home, you can even disallow all ip-access ...

example:

# jail -c -u USER path=/ ip4=disable ip6=disable command=WHISPER_ROOT/main -m WHISPER_ROOT/models/ggml-small.bin WAVE-FILE-WITH-FULL-PATH

@abelbabel
Copy link
Author

While being here: depending on what "supported" means, FreeBSD could also be included in the "supported platforms" section in readme.

ggerganov added a commit that referenced this issue Dec 16, 2022
@leonardorame
Copy link

Hi, I cannot compile the examples/stream program on FreeBSD 13.1 amd64. Just went to examples/stream and tried make and/or gmake, but nothing was built.

Any pointers on how to build it?

@leonardorame
Copy link

I found a way!:

sudo pkg install sdl2
cmake -D WHISPER_SUPPORT_SDL2=ON .
make

rock3125 pushed a commit to rock3125/whisper.cpp that referenced this issue Feb 21, 2023
anandijain pushed a commit to anandijain/whisper.cpp that referenced this issue Apr 28, 2023
Thanks to @abelbabel for the contribution
anandijain pushed a commit to anandijain/whisper.cpp that referenced this issue Apr 28, 2023
jacobwu-b pushed a commit to jacobwu-b/Transcriptify-by-whisper.cpp that referenced this issue Oct 24, 2023
Thanks to @abelbabel for the contribution
jacobwu-b pushed a commit to jacobwu-b/Transcriptify-by-whisper.cpp that referenced this issue Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build related issues
Projects
None yet
Development

No branches or pull requests

4 participants