azkadev / whisper

Whisper Dart is a cross platform library for dart and flutter that allows converting audio to text / speech to text / inference from Open AI models
https://azkadev.github.io/whisper/
Other
541 stars 33 forks source link

Add support to additional platforms #4

Closed JeisonSanches closed 1 year ago

JeisonSanches commented 1 year ago

Well... there is a lot of changes:

And as a consequence of all the above, it makes the code portable for other additional platforms (macOS and iOS) and also improves the use on the other already supported ones (without the need for a binary explicitly included in the project).

As specified in the README file, I tested it on the following devices/platforms:

At the moment, I am not able to test it on macOS, iOS, and Linux, but it should work (it may need some minor tweaking).

Well, that's basically it. Thanks for coming up with the idea of migrating the code to dart and doing the initial setup!

I hope to be able to continue to contribute :)

azkadev commented 1 year ago

Thank you very much for wanting to contribute a lot, but sorry I can't accept this because you made my library only run on the client side (Flutter App)

azkadev commented 1 year ago

@JeisonSanches

Can you help me? I tried your project it worked but only for android, I tried to build for the windows platform, and linux didn't work

JeisonSanches commented 1 year ago

Thank you very much for wanting to contribute a lot, but sorry I can't accept this because you made my library only run on the client side (Flutter App)

Currently, we don't have a way to have a package like this one to work seamleslly for both Dart and Flutter. But I liked the idea (as you did) to split in two different packages: whisper_dart and whisper_flutter. That is exactly what I was going to suggest.

@JeisonSanches

Can you help me? I tried your project it worked but only for android, I tried to build for the windows platform, and linux didn't work

I can try. Could you share the build errors you got as well as the details of your environment?

azkadev commented 1 year ago

Thank you very much for wanting to contribute a lot, but sorry I can't accept this because you made my library only run on the client side (Flutter App)

Currently, we don't have a way to have a package like this one to work seamleslly for both Dart and Flutter. But I liked the idea (as you did) to split in two different packages: whisper_dart and whisper_flutter. That is exactly what I was going to suggest.

@JeisonSanches Can you help me? I tried your project it worked but only for android, I tried to build for the windows platform, and linux didn't work

I can try. Could you share the build errors you got as well as the details of your environment?

I tried to compile on linux it shows an error like this command: flutter build linux --release -v

---
[        ] FAILED: plugins/whisper_flutter/shared/libwhisper.so 
[        ] : && /usr/bin/clang++ -fPIC -std=c++2a -O3 -DNDEBUG   -shared -Wl,-soname,libwhisper.so -o plugins/whisper_flutter/shared/libwhisper.so plugins/whisper_flutter/shared/CMakeFiles/whisper_flutter.dir/main.cpp.o
plugins/whisper_flutter/shared/libwhisper.a  plugins/whisper_flutter/shared/libggml.a && :
[        ] /usr/bin/ld: plugins/whisper_flutter/shared/libwhisper.a(whisper.cpp.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
[        ] /usr/bin/ld: plugins/whisper_flutter/shared/libggml.a(ggml.c.o): relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
[        ] clang: error: linker command failed with exit code 1 (use -v to see invocation)

---- 
[        ] ninja: build stopped: subcommand failed.
[  +10 ms] Building Linux application... (completed in 31.2s)
[        ] "flutter linux" took 34,237ms.
[   +3 ms] Build process failed
[        ] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _runBuild (package:flutter_tools/src/linux/build_linux.dart:183:5)
           <asynchronous suspension>
           #2      buildLinux (package:flutter_tools/src/linux/build_linux.dart:76:5)
           <asynchronous suspension>
           #3      BuildLinuxCommand.runCommand (package:flutter_tools/src/commands/build_linux.dart:86:5)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1257:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:283:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>

i don't have much experience in cpp and cmake languages

JeisonSanches commented 1 year ago

@azkadev Could you try it again adding -fPIC to CMAKE_CXX_FLAGS in the sr/CMakeLists.txt file? Also, before you try to build again run:

sudo make uninstall
sudo make clean
JeisonSanches commented 1 year ago

@azkadev Could you try it again adding -fPIC to CMAKE_CXX_FLAGS in the sr/CMakeLists.txt file? Also, before you try to build again run:

sudo make uninstall
sudo make clean

@azkadev Did you get success with it?

azkadev commented 1 year ago

@azkadev Could you try it again adding -fPIC to CMAKE_CXX_FLAGS in the sr/CMakeLists.txt file? Also, before you try to build again run:

sudo make uninstall
sudo make clean

Still can't, the same error appears, maybe if you don't mind + have time please make another pull request, sorry I bothered you because I don't really understand cpp + compile cmake

Sorry, my English is bad

JeisonSanches commented 1 year ago

Still can't, the same error appears, maybe if you don't mind + have time please make another pull request, sorry I bothered you because I don't really understand cpp + compile cmake

Sorry, my English is bad

@azkadev Don't worry, mate. Also, I fixed the error in my latest commits: now I'm able to build the project with no erros using a Ubuntu VM. Give it a try :)

azkadev commented 1 year ago

Thank you very much for helping me, now thanks to you my library can run on various platforms