openfst
openfst copied to clipboard
Build ngram and other extensions
When I compile some other projects using fst with vs.net 201, got the following errors. Looks like it needs the ngram extension, please advise how to build it in vs.net with extension, very appreciated it!
model.obj: error LNK2019: Unresolved external symbol "public: unsigned __int64 __cdecl fst :: BitmapIndex :: Rank1 (unsigned __int64) const" (? Rank1 @ BitmapIndex @ fst @@ QEBA_K_K @ Z) in the function "public: class fst :: TropicalWeightTpl __cdecl fst :: internal :: NGramFstImpl <struct fst :: ArcTpl <class fst :: TropicalWeightTpl >> :: Final (int) const "(? Final @? $ NGramFstImpl @ U ? $ ArcTpl @ V? $ TropicalWeightTpl @ M @ fst @@@ fst @@@ internal @ fst @@ QEBA? AV? $ TropicalWeightTpl @ M @ 3 @ H @ Z) is referenced
model.obj: error LNK2019: unresolved external symbol "public: unsigned __int64 __cdecl fst :: BitmapIndex :: Select1 (unsigned __int64) const" (? Select1 @ BitmapIndex @ fst @@ QEBA_K_K @ Z) in function "public: virtual bool __cdecl fst :: NGramFstMatcher <struct fst :: ArcTpl <class fst :: TropicalWeightTpl >> :: Find (int) "(? Find @? $ NGramFstMatcher @ U? $ ArcTpl @ V? $ TropicalWeightTpl @ M @fst @@@ fst @@@ fst @@ UEAA_NH @ Z)
model.obj: error LNK2019: Unresolved external symbol "public: struct std :: pair <unsigned __int64, unsigned __int64> __cdecl fst :: BitmapIndex :: Select0s (unsigned __int64) const" (? Select0s @ BitmapIndex @ fst @@ QEBA? AU? $ Pair @ _K_K @ std @@ _ K @ Z) in the function "public: void __cdecl fst :: internal :: NGramFstImpl <struct fst :: ArcTpl <class fst :: TropicalWeightTpl > :: Init (char const *, bool, class fst :: MappedFile *) "(? Init @? $ NGramFstImpl @ U? $ ArcTpl @ V? $ TropicalWeightTpl @ M @ fst @@ fst @@@ internal @ fst @@ QEAAXPEBD_NPEAVMappedFile @ 3 @@ Z) is referenced
model.obj: error LNK2019: Unresolved external symbol "public: void __cdecl fst :: BitmapIndex :: BuildIndex (unsigned __int64 const *, unsigned __int64)" (? BuildIndex @ BitmapIndex @ fst @@ QEAAXPEB_K_K @ Z) in function "public: void __cdecl fst :: internal :: NGramFstImpl <struct fst :: ArcTpl <class fst :: TropicalWeightTpl >> :: Init (char const *, bool, class fst :: MappedFile *)" (? Init @? $ NGramFstImpl @ U? $ ArcTpl @ V? $ TropicalWeightTpl @ M @ fst @@@ fst @@@ internal @ fst @@ QEAAXPEBD_NPEAVMappedFile @ 3 @@ Z) is referenced
MSVCRTD.lib (exe_main.obj): error LNK2019: Unresolved external symbol main is referenced in function "int __cdecl invoke_main (void)" (? Invoke_main @@ YAHXZ)
Sorry, I never heard of "vs.net 201". What are you talking about?
But yeah, we're not compiling ngram extensions yet. You can use cmake though, it compiles everything the original Makefiles do.
If i compile extensions with cmake, will binaries be compatible with nmake? Trying to make alphacep/vosk work, gettin` the same error stack
@LuggerMan, depends on the compiler. CMake is only a meta-builder, the choice of the toolchain is yours. cl
and clang-cl
in fact use the same Microsoft's own code generation 2nd pass c2.dll. The Intel compiler, icc
, is also compatible.
Looks like some source file where these symbols are defined is not compiled. It's possible that a file is compiled, but its .o file is discarded by the linker, since it does not have referenced symbols, essentially like this problem: https://github.com/kkm000/openfst/pull/36#issuecomment-731199494. FWIW, it may happen only with static linking; can you try DLL build? It it goes through, that's a hint.
Unfortunately, I'm out of free cycles now to look into this. Will appreciate it if you diagnose the issue deeper.