I've successfully compiled SphinxTrain using Cygwin and gcc 3.4.4-3. Now, I'm having problems with sphinxbase. At first, trying to compile sphinxbase gave an error about the fact that Python was compiled using Visual Studio 2003. The solution was to add "-c mingw32" to the "setup.py build" command in the Python makefile. Then, I received an error regarding an invalid ld_version value. I fixed that by changing the regular expression which checks the version in the cygwinccompiler.py lib file. Now, when I try to compile sphinxbase, I receive several "undefined reference" errors:
C:\cygwin\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.5\Release\sphinx
base.o build\temp.win32-2.5\Release\sphinxbase.def -L../src/libsphinxbase/.libs
-Lc:\python25\libs -Lc:\python25\PCBuild -lsphinxbase -lpython25 -lmsvcr71 -o bu
ild\lib.win32-2.5\sphinxbase.pyd
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xa9): undefined r
eference to __imp__logmath_init'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x12c): undefined
reference toimp__ngram_model_read'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x1ec): undefined
reference to __imp__ngram_model_apply_weights'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x343): undefined
reference to__imp__ngram_model_retain'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x34f): undefined
reference to __imp__ngram_model_free'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x393): undefined
reference to__imp__logmath_retain'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x39f): undefined
reference to __imp__logmath_free'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x3de): undefined
reference to__imp__logmath_free'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x3ea): undefined
reference to __imp__ngram_model_free'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x5df): undefined
reference to__imp__ngram_model_apply_weights'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x6e6): undefined
reference to __imp__ngram_wid'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x7fa): undefined
reference to__imp__ngram_word'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x9d1): undefined
reference to __imp__ngram_wid'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xa24): undefined
reference to__imp____ckd_calloc'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xade): undefined
reference to __imp__ngram_wid'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xb1e): undefined
reference toimp__ngram_ng_score'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xb2c): undefined
reference to __imp__ckd_free'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xb3f): undefined
reference to__imp__logmath_log_to_ln'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xea8): undefined
reference to __imp__ngram_wid'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xefb): undefined
reference to__imp____ckd_calloc'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xfb5): undefined
reference to __imp__ngram_wid'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xff5): undefined
reference to__imp__ngram_ng_prob'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x1003): undefined
reference to __imp__ckd_free'
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x1016): undefined
reference to__imp__logmath_log_to_ln'
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
make[1]: *** [pymod-build-stamp] Error 1
make[1]: Leaving directory `/cygdrive/c/tutorial/sphinxbase/python'
make: *** [all-recursive] Error 1
I verified the include line in the makefile is correct, and that the header files exist with the appropriate references which the compiler says are undefined. Can anybody help?
Thanks,
Ruben
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, everyone -
I've successfully compiled SphinxTrain using Cygwin and gcc 3.4.4-3. Now, I'm having problems with sphinxbase. At first, trying to compile sphinxbase gave an error about the fact that Python was compiled using Visual Studio 2003. The solution was to add "-c mingw32" to the "setup.py build" command in the Python makefile. Then, I received an error regarding an invalid ld_version value. I fixed that by changing the regular expression which checks the version in the cygwinccompiler.py lib file. Now, when I try to compile sphinxbase, I receive several "undefined reference" errors:
C:\cygwin\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.5\Release\sphinx
base.o build\temp.win32-2.5\Release\sphinxbase.def -L../src/libsphinxbase/.libs
-Lc:\python25\libs -Lc:\python25\PCBuild -lsphinxbase -lpython25 -lmsvcr71 -o bu
ild\lib.win32-2.5\sphinxbase.pyd
build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xa9): undefined r
eference to
__imp__logmath_init' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x12c): undefined reference to
imp__ngram_model_read'build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x1ec): undefined
reference to
__imp__ngram_model_apply_weights' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x343): undefined reference to
__imp__ngram_model_retain'build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x34f): undefined
reference to
__imp__ngram_model_free' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x393): undefined reference to
__imp__logmath_retain'build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x39f): undefined
reference to
__imp__logmath_free' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x3de): undefined reference to
__imp__logmath_free'build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x3ea): undefined
reference to
__imp__ngram_model_free' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x5df): undefined reference to
__imp__ngram_model_apply_weights'build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x6e6): undefined
reference to
__imp__ngram_wid' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x7fa): undefined reference to
__imp__ngram_word'build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x9d1): undefined
reference to
__imp__ngram_wid' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xa24): undefined reference to
__imp____ckd_calloc'build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xade): undefined
reference to
__imp__ngram_wid' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xb1e): undefined reference to
imp__ngram_ng_score'build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xb2c): undefined
reference to
__imp__ckd_free' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xb3f): undefined reference to
__imp__logmath_log_to_ln'build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xea8): undefined
reference to
__imp__ngram_wid' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xefb): undefined reference to
__imp____ckd_calloc'build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xfb5): undefined
reference to
__imp__ngram_wid' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0xff5): undefined reference to
__imp__ngram_ng_prob'build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x1003): undefined
reference to
__imp__ckd_free' build\temp.win32-2.5\Release\sphinxbase.o:sphinxbase.c:(.text+0x1016): undefined reference to
__imp__logmath_log_to_ln'collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
make[1]: *** [pymod-build-stamp] Error 1
make[1]: Leaving directory `/cygdrive/c/tutorial/sphinxbase/python'
make: *** [all-recursive] Error 1
I verified the include line in the makefile is correct, and that the header files exist with the appropriate references which the compiler says are undefined. Can anybody help?
Thanks,
Ruben
Just install Linux or use Visual Studio project which is distributed with pocketsphinx to compile it on Win32. Don't bother us with Cygwin please :)
Alternatively, look on the file sphinxbase_export.h:
/ Win32/WinCE DLL gunk /
if (defined(_WIN32) || defined(_WIN32_WCE))
if defined(SPHINXBASE_EXPORTS) / Visual Studio /
define SPHINXBASE_EXPORT __declspec(dllexport)
elif defined(CYGWIN) / Disable this on Cygwin, it doesn't work /
define SPHINXBASE_EXPORT
else
define SPHINXBASE_EXPORT __declspec(dllimport)
endif
else / !_WIN32 /
define SPHINXBASE_EXPORT
endif
to avoid imp errors you need to remove define __declspec(dllimport), it causes problems. Most probably cygwin is not detected properly on your system.