Closed xuducan closed 2 years ago
Looks like you are trying to build on OSX, I'd better try on Linux.
If you still want to build on OSX, you'd need to edit this part, it should be ignored on cross-compilation:
https://github.com/kaldi-asr/kaldi/blob/cbed4ff688a172a7f765493d24771c1bd57dcd20/src/Makefile#L63
You are so nice, Thanks so much! I have built success on Linux. Do you known the reason why kaldi built failed on OSX, especially error happened because of stdin stdout stderr and MAINI__ in libf2c.a? What i can realize is just because of the system library,such as libc.
Do you known the reason why kaldi built failed on OSX,
The make has to create dynamic library (adds -dynamic flag), but due to wrongly detected compiler flag (its actually linux compiler, not OSX) it tries to create an executable (-dynamic is ignored) and it expectedly fails. You need to fix make process so it properly creates dynamic library even on OSX even with cross-compiler.
Got it!Thank you and your amazing project!
Same as #260
Looks like you are trying to build on OSX, I'd better try on Linux.
If you still want to build on OSX, you'd need to edit this part, it should be ignored on cross-compilation:
https://github.com/kaldi-asr/kaldi/blob/cbed4ff688a172a7f765493d24771c1bd57dcd20/src/Makefile#L63
@nshmyrev I'm getting the same error even when this change is already present. Do you have any idea about that?
clang-12: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument]
clang-12: warning: argument unused during compilation: '-install_name @rpath/libkaldi-base.so' [-Wunused-command-line-argument]
ld: error: undefined symbol: MAIN__
>>> referenced by main.c
>>> main.c.obj:(main) in archive /Users/itabluebelt/Desktop/Projects/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a
ld: error: undefined symbol: stderr
>>> referenced by sig_die.c
>>> sig_die.c.obj:(sig_die) in archive /Users/itabluebelt/Desktop/Projects/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a
>>> referenced by sig_die.c
>>> sig_die.c.obj:(sig_die) in archive /Users/itabluebelt/Desktop/Projects/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a
>>> referenced by err.c
>>> err.c.obj:(f__fatal) in archive /Users/itabluebelt/Desktop/Projects/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a
>>> referenced 7 more times
ld: error: undefined symbol: stdin
>>> referenced by err.c
>>> err.c.obj:(f_init) in archive /Users/itabluebelt/Desktop/Projects/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a
ld: error: undefined symbol: stdout
>>> referenced by err.c
>>> err.c.obj:(f_init) in archive /Users/itabluebelt/Desktop/Projects/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
I'm building in Apple Macbook M2
. OS version: 13.4 (22F66)
When i use the script build-vosk.sh to built the project, openblas, clapack and openfst are no problem. the bug appears in kaldi. The log is like below. My ndk version is 22.0.7026061. Waiting for your reply, Thanks!
armv7a-linux-androideabi21-clang++ -dynamiclib -o libkaldi-base.so -install_name @rpath/libkaldi-base.so -Wl,-rpath -Wl,vosk-api/android/lib/build/kaldi_armeabi-v7a/kaldi/src/lib kaldi-math.o kaldi-error.o io-funcs.o kaldi-utils.o timer.o vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libfst.a vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libopenblas.a vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/liblapack.a vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libblas.a vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a -lm -ldl clang++: warning: argument unused during compilation: '-dynamiclib' [-Wunused-command-line-argument] clang++: warning: argument unused during compilation: '-install_name @rpath/libkaldi-base.so' [-Wunused-command-line-argument] /Users/xuducan/project/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a(sig_die.c.obj):sig_die.c:function sig_die: error: undefined reference to 'stderr' /Users/xuducan/project/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a(sig_die.c.obj):sig_die.c:function sig_die: error: undefined reference to 'stderr' /Users/xuducan/project/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a(err.c.obj):err.c:function ffatal: error: undefined reference to 'stderr' /Users/xuducan/project/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a(err.c.obj):err.c:function f__fatal: error: undefined reference to 'stderr' /Users/xuducan/project/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a(err.c.obj):err.c:function f_init: error: undefined reference to 'stdin' /Users/xuducan/project/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a(err.c.obj):err.c:function f_init: error: undefined reference to 'stdout' /Users/xuducan/project/vosk-api/android/lib/build/kaldi_armeabi-v7a/local/lib/libf2c.a(main.c.obj):main.c:function main: error: undefined reference to 'MAIN' clang++: error: linker command failed with exit code 1 (use -v to see invocation)