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

macOS support #13

Open
sergsavchuk opened this issue Apr 12, 2023 · 6 comments
Open

macOS support #13

sergsavchuk opened this issue Apr 12, 2023 · 6 comments
Labels
help wanted Extra attention is needed

Comments

@sergsavchuk
Copy link
Collaborator

sergsavchuk commented Apr 12, 2023

I tried to use libvosk.dylib from vosk-0.3.45 and got an error:

Building macOS application...
dyld[1236]: Library not loaded: 'libvosk.dylib'
  Referenced from: '/Users/mac/projects/flutter/vosk-flutter/example/build/macos/Build/Products/Debug/vosk_flutter_example.app/Contents/MacOS/vosk_flutter_example'
  Reason: tried: 'libvosk.dylib' (no such file), '/usr/local/lib/libvosk.dylib' (no such file), '/usr/lib/libvosk.dylib' (no such file), '/Users/mac/projects/flutter/vosk-flutter/example/libvosk.dylib' (no such file), '/usr/local/lib/libvosk.dylib' (no such file), '/usr/lib/libvosk.dylib' (no such file)

After a little investigation, I found that libvosk.dylib does have a non-rpath reference inside, which is causing the problem:

mac@Mac-mini-Mac Libraries % otool -L libvosk.dylib 
libvosk.dylib:
        libvosk.dylib (compatibility version 0.0.0, current version 0.0.0) # <- this one
        /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)

But I'm not much in macOS and CMake, so would appreciate any help in compiling the voks-api with RPATH enabled 🙏

@sergsavchuk sergsavchuk added the help wanted Extra attention is needed label Apr 12, 2023
@sergsavchuk
Copy link
Collaborator Author

P. S. I've already tried to modify libvosk.dylib using install_name_tool but got stuck with https://github.com/pyinstaller/pyinstaller/wiki/Recipe-OSX-Code-Signing#pyinstaller-fix-implementation

@nshmyrev
Copy link
Contributor

It is not about dylib itself, I believe dylib just have to be in the flutter package where linker finds it

@sergsavchuk
Copy link
Collaborator Author

It is not about dylib itself, I believe dylib just have to be in the flutter package where linker finds it

Actually, it's already there(it's placed to Frameworks during build):
image
but linker tries to find it in the project root. And you gave me an idea - we can just create a symlink in the project root as a workaround 🤔

P. S. It looks like there is wrong version of the libvosk.dylib inside the https://repo1.maven.org/maven2/com/alphacephei/vosk/0.3.45/vosk-0.3.45.jar

00:46 +5 -1: Recognizer Constructor grammar and #setGrammar give same result [E]                                                                                                                                                       
  Invalid argument(s): Failed to lookup symbol 'vosk_recognizer_set_grm': dlsym(0x2020df5a0, vosk_recognizer_set_grm): symbol not found

@nshmyrev
Copy link
Contributor

Yes, we need to rebuild it eventually, see alphacep/vosk-api#681

@nshmyrev
Copy link
Contributor

And we can package libvosk into framework too

@moham96
Copy link

moham96 commented Sep 9, 2023

Can this be implemented please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Development

No branches or pull requests

3 participants