Current Cygwin problems when compiling Kaldi

1,213 views
Skip to first unread message

Prijazen Dom

unread,
May 26, 2016, 7:29:45 AM5/26/16
to kaldi-help
Hello,

I have problem compiling recent Kaldi under Cygwin64. I've compiled /tools directory without problems (only had t osetup env variable OSTYPE to cygwin)
But now in src directory, it seems that currently even ./configure step produces errors :

$ ./configure
Configuring ...
Checking OpenFST library in /cygdrive/i/Kaldi/kaldi-master/tools/openfst ...
Checking OpenFst library was patched.
Backing up kaldi.mk to kaldi.mk.bak
Doing OS specific configurations ...
On Cygwin: checking for linear algebra libraries ...
Configuration succeeded for platform cygwin
cc1plus: error: unknown pass auto-import specified in -fenable
cc1plus: error: unknown pass auto-import specified in -fenable
make: *** [exp-test] Error 1
./configure: vrstica 221: ./exp-test: No such file or directory
SUCCESS
Any idea how to fix this ? Is there any more info available for Kaldi and Cygwin combo ?

Thanks in advance,
Rob.
 

Daniel Povey

unread,
May 26, 2016, 2:36:43 PM5/26/16
to kaldi-help
Well, firstly, you can ignore that error, it was not fatal to the configuration.
It looks like something has changed on cygwin. Perhaps the
--enable-auto-import flag is no longer accepted by gcc there. See if
it causes errors when you do 'make' in src/, and if there are
additional errors.

And see if you can figure out what the current method of figuring out
that you are on Cygwin is. I guess in the past Cygwin used to set the
variable OSTYPE, but that is perhaps no longer supported. We could
change tools/Makefile.

Dan
> --
> You received this message because you are subscribed to the Google Groups
> "kaldi-help" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to kaldi-help+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Prijazen Dom

unread,
May 27, 2016, 10:33:13 AM5/27/16
to kaldi-help, dpo...@gmail.com
Hi,

thanks for response and help. I went past that error and make depend goes through ok (at least it seems so).

When doing make, I get pretty fast following error :
$ make
The version of configure script matches kaldi.mk version. Good.
test
-d  || mkdir
make
-C base
make
[1]: Entering directory '/cygdrive/i/Kaldi/kaldi-master/src/base'
g
++ -msse -msse2 -Wall -I.. -DKALDI_DOUBLEPRECISION=0 -DHAVE_CLAPACK -I ../../tools/CLAPACK/ -Wno-sign-compare -Wno-unused-local-typedefs -Winit-self -I ../../tools/CLAPACK/ -I /cygdrive/i/Kaldi/kaldi-master/tools/openfst/include -DHAVE_OPENFST_GE_10400 -std=c++0x -g    -c -o kaldi-math.o kaldi-math.cc
kaldi
-math.cc: In function int kaldi::Rand(kaldi::RandomState*)’:
kaldi
-math.cc:51:33: error: rand_r was not declared in this scope
     
return rand_r(&(state->seed));
                                 
^
<builtin>: recipe for target 'kaldi-math.o' failed
make
[1]: *** [kaldi-math.o] Error 1
make
[1]: Leaving directory '/cygdrive/i/Kaldi/kaldi-master/src/base'
Makefile:137: recipe for target 'base' failed
make
: *** [base] Error 2

Sorry, I'm just Kaldi newbie trying to compile it under Cygwin - so I guess will need some more help than usual...
Is there any better way to get Kaldi working under Windows ?


Thanks in advance,
regards,
Rob.

Daniel Povey

unread,
May 27, 2016, 2:13:28 PM5/27/16
to Prijazen Dom, kaldi-help
There is no better way to compile Kaldi on Windows.
It looks like some changes have happened to Cygwin and you are
probably the first person reporting these problems.
Try adding
#include <stdlib.h>
near the top of kaldi-math.cc.
If this helps I'll fix it upstream.
Expect to encounter more problems, but I'll help you fix them.
Dan

Daniel Povey

unread,
May 27, 2016, 5:28:32 PM5/27/16
to Prijazen Dom, kaldi-help
I added the include, if you do "git pull" you'll get it.

In tools/Makefile, please test whether replacing

ifeq ($(OSTYPE),cygwin)

with:

ifeq ($(shell uname -o),Cygwin)

works.
You'd have to remove openfst-* first. Check that the -O flag gets
given to "configure" for OpenFst.
Dan

Prijazen Dom

unread,
May 31, 2016, 6:42:47 AM5/31/16
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
Hello,

I've tried your suggestion and this one worked:
ifeq ($(uname -o),Cygwin)

$ shell uname -o
-bash: shell: ukaza ni mogoče najti

Robi@Robi-i7 /cygdrive/i/Kaldi/kaldi-master/src
$ uname
-o
Cygwin

At least I think so...

I've also tried to add include to kaldi-math.cc, but that didn't help...
$ make
The version of configure script matches kaldi.mk version. Good.
test
-d  || mkdir
make
-C base
make
[1]: Entering directory '/cygdrive/i/Kaldi/kaldi-master/src/base'
g
++ -msse -msse2 -Wall -I.. -DKALDI_DOUBLEPRECISION=0 -DHAVE_CLAPACK -I ../../tools/CLAPACK/ -Wno-sign-compare -Wno-unused-local-typedefs -Winit-self -I ../../tools/CLAPACK/ -I /cygdrive/i/Kaldi/kaldi-master/tools/openfst/include -DHAVE_OPENFST_GE_10400 -std=c++0x -g    -c -o kaldi-math.o kaldi-math.cc
kaldi
-math.cc: In function int kaldi::Rand(kaldi::RandomState*)’:

kaldi
-math.cc:50:33: error: rand_r was not declared in this scope
     
return rand_r(&(state->seed));

                                 
^
<builtin>: recipe for target 'kaldi-math.o' failed
make
[1]: *** [kaldi-math.o] Error 1
make
[1]: Leaving directory '/cygdrive/i/Kaldi/kaldi-master/src/base'
Makefile:137: recipe for target 'base' failed
make
: *** [base] Error 2


There is similar discussion ....
https://sourceforge.net/p/kaldi/mailman/message/33340485/

Any advice what to ry? There is a kaldi-math-test.cc - maybe I can try to compile it ?

Jan Trmal

unread,
May 31, 2016, 8:32:05 AM5/31/16
to kaldi-help, prijaz...@gmail.com, Dan Povey
Dan, looking at the man page for rand_r, it seems that rand_r is not exported unless this is fulfilled (_POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE)

I wonder if gcc on cygwin does not define one of these  variables (contrary to what it does on linux)?

jtrmal@login3  /export/a09/jtrmal/kaldi-clean-git/src [(de32102...)] $  cat test_defs.cc 

#include <stdlib.h>

#include <stdio.h>


int main() {

#if _POSIX_C_SOURCE >= 1

  printf("_POSIX_C_SOURCE defined\n");

#endif


#if _XOPEN_SOURCE

  printf("_XOPEN_SOURCE defined\n");

#endif 

  

#if _POSIX_SOURCE

  printf("_POSIX_SOURCE defined\n");

#endif


  return 0;

}

jtrmal@login3  /export/a09/jtrmal/kaldi-clean-git/src [(de32102...)] $  g++ test_defs.cc -o test_defs

jtrmal@login3  /export/a09/jtrmal/kaldi-clean-git/src [(de32102...)] $  ./test_defs 

_POSIX_C_SOURCE defined

_XOPEN_SOURCE defined

_POSIX_SOURCE defined


y.

Daniel Povey

unread,
May 31, 2016, 2:26:26 PM5/31/16
to Prijazen Dom, kaldi-help
> I've tried your suggestion and this one worked:
> ifeq ($(uname -o),Cygwin)

To clarify, we're talking about in tools/Makefile. "ifeq ($(uname
-o),Cygwin)" should not work as intended. There is no point typing
"shell uname -o" into the shell-- 'shell' is something that 'make'
interprets. What happened when you tried my suggestion of ifeq
($(shell uname -o),Cygwin) in the Makefile?


Based on Yenda's comment, and this
http://stackoverflow.com/questions/30230090/how-to-use-rand-c99-version,
try modifying kaldi-math.cc so that the #ifndef block says:


#ifndef _MSC_VER
#include <pthread.h>
#define _POSIX_C_SOURCE 1
#include <stdlib.h>
#endif

and let me know if that works.

Prijazen Dom

unread,
Jun 1, 2016, 6:18:06 AM6/1/16
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
Hi,

I did this :
#include "base/kaldi-math.h"

//#ifndef _MSC_VER
//#include <pthread.h>
//#endif


#ifndef _MSC_VER
#include <pthread.h>
#define _POSIX_C_SOURCE 1
#include <stdlib.h>
#endif

#include <string>

and produced same error :
$ make
The version of configure script matches kaldi.mk version. Good.
test
-d  || mkdir
make
-C base
make
[1]: Entering directory '/cygdrive/i/Kaldi/kaldi-master/src/base'
g
++ -msse -msse2 -Wall -I.. -DKALDI_DOUBLEPRECISION=0 -DHAVE_CLAPACK -I ../../tools/CLAPACK/ -Wno-sign-compare -Wno-unused-local-typedefs -Winit-self -I ../../tools/CLAPACK/ -I /cygdrive/i/Kaldi/kaldi-master/tools/openfst/include -DHAVE_OPENFST_GE_10400 -std=c++0x -g    -c -o kaldi-math.o kaldi-math.cc
kaldi
-math.cc: In function int kaldi::Rand(kaldi::RandomState*)’:

kaldi
-math.cc:58:33: error: rand_r was not declared in this scope
     
return rand_r(&(state->seed));

                                 
^
<builtin>: recipe for target 'kaldi-math.o' failed
make
[1]: *** [kaldi-math.o] Error 1
make
[1]: Leaving directory '/cygdrive/i/Kaldi/kaldi-master/src/base'
Makefile:137: recipe for target 'base' failed
make
: *** [base] Error 2



Thanks in advance,
regards,
Rob.


Daniel Povey

unread,
Jun 1, 2016, 3:06:38 PM6/1/16
to Prijazen Dom, kaldi-help
Do
which gcc
and
gcc --version
and see if it tells us what kind of gcc you have.
How did you install gcc? Or did it just come with cygwin?
Dan

Prijazen Dom

unread,
Jun 2, 2016, 4:09:51 AM6/2/16
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
Hello,

version is 5.3 :
$ gcc --version
gcc
(GCC) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty
; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



Sorry, don't remember whether I did install separately.

Thanks in advance,
regards,
Rob.


Prijazen Dom

unread,
Jun 2, 2016, 5:38:20 AM6/2/16
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
and :
$ which gcc
/usr/bin/gcc

Daniel Povey

unread,
Jun 2, 2016, 3:00:28 PM6/2/16
to Prijazen Dom, kaldi-help
OK, let's try something else.
Whenever it queries _MSC_VER in kaldi-math.cc, change it to _WIN32.
That will mean that it calls rand() even on cygwin.. I believe rand()
is thread-safe in the Windows API, and cygwin uses that.

Jan Trmal

unread,
Jun 2, 2016, 3:04:12 PM6/2/16
to kaldi-help, Prijazen Dom
BTW, just hypothesis: on the man page I've noticed that rand_r is obsoleted -- perhaps glibc and or gcc 5.3 (which I guess is quite fresh) already removed it?
y.

Jan Trmal

unread,
Jun 2, 2016, 3:06:29 PM6/2/16
to kaldi-help, Prijazen Dom
I'm mentioning it because in that case we might expect similar issues even on linux -- most of the distributions are perhaps more  conservative than cygwin, so that might be the reason we didn't see reports yet?
y.

Daniel Povey

unread,
Jun 2, 2016, 3:09:05 PM6/2/16
to kaldi-help, Prijazen Dom
Maybe but I suspect it was removed from the Windows API and probably
won't be removed from Linux any time soon.. it's part of the POSIX
standard still, I think.
Dan

Jan Trmal

unread,
Jun 2, 2016, 3:13:09 PM6/2/16
to kaldi-help, Prijazen Dom
I see this on the man page:
The function rand_r() is from POSIX.1-2001. POSIX.1-2008 marks rand_r() as obsolete.

Not making any claims about if it's what's causing the troubles or not. 
y.

Jan Trmal

unread,
Jun 2, 2016, 3:14:05 PM6/2/16
to kaldi-help, Prijazen Dom
BTW, AFAIK, the msvc runtime should be ok with threaded access, i.e. rand() should indeed be reentrant.
y.

Daniel Povey

unread,
Jun 2, 2016, 3:16:21 PM6/2/16
to kaldi-help, Prijazen Dom
Yes but it doesn't name any version of POSIX where rand_r has actually
been removed. That would have come up in your search.

Prijazen Dom

unread,
Jun 3, 2016, 6:41:07 AM6/3/16
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
Hi,

thanks for all help. I guess I'll wait for your advice, what to do next...

Best regards,
Rob.

Jan Trmal

unread,
Jun 3, 2016, 6:44:08 AM6/3/16
to kaldi-help, Prijazen Dom, Dan Povey
Try what Dan was suggesting:

OK, let's try something else.
Whenever it queries _MSC_VER in kaldi-math.cc, change it to _WIN32.
That will mean that it calls rand() even on cygwin.. I believe rand()
is thread-safe in the Windows API, and cygwin uses that.

The code should look like this:

 45 int Rand(struct RandomState* state) {                                                                                                                                                                          

 46 #ifdef _WIN32                                                                                                                                                                                                

 47   // On Windows, just call Rand()                                                                                                                                                                              

 48   return rand();                                                                                                                                                                                               

 49 #else                                                                                                                                                                                                          

 50   if (state) {                                                                                                                                                                                                 

 51     return rand_r(&(state->seed));                                                                                                                                                                             

 52   } else {                                                                                                                                                                                                     

 53     int rs = pthread_mutex_lock(&_RandMutex);                                                                                                                                                                  

 54     KALDI_ASSERT(rs == 0);                                                                                                                                                                                     

 55     int val = rand();                                                                                                                                                                                          

 56     rs = pthread_mutex_unlock(&_RandMutex);                                                                                                                                                                    

 57     KALDI_ASSERT(rs == 0);                                                                                                                                                                                     

 58     return val;                                                                                                                                                                                                

 59   }                                                                                                                                                                                                            

 60 #endif                                                                                                                                                                                                         

 61 }   


Prijazen Dom

unread,
Jun 3, 2016, 7:06:48 AM6/3/16
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
Hello,

I did this  (_WIN32 was also not picked up):
#if defined (_MSC_VER)|| defined (__CYGWIN__)
//#ifdef _MSC_VER



and it compiled ok. Now, new errors are happening  (output below)...

thanks in advance,
regards,
Rob.

$ make
The version of configure script matches kaldi.mk version. Good.
test
-d  || mkdir
make
-C base
make
[1]: Entering directory '/cygdrive/i/Kaldi/kaldi-master/src/base'

make
[1]: Nothing to be done for 'all'.

make
[1]: Leaving directory '/cygdrive/i/Kaldi/kaldi-master/src/base'

make
-C matrix
make
[1]: Entering directory '/cygdrive/i/Kaldi/kaldi-master/src/matrix'
g
++ -msse -msse2 -Wall -I.. -DKALDI_DOUBLEPRECISION=0 -DHAVE_CLAPACK -I ../../tools/CLAPACK/ -Wno-sign-compare -Wno-unused-local-typedefs -Winit-self -I ../../tools/CLAPACK/ -I /cygdrive/i/Kaldi/kaldi-master/tools/openfst/include -DHAVE_OPENFST_GE_10400 -std=c++0x -g    -c -o kaldi-matrix.o kaldi-matrix.cc
In file included from ../base/kaldi-common.h:34:0,
                 
from ../matrix/matrix-common.h:26,
                 
from ../matrix/kaldi-matrix.h:25,
                 
from kaldi-matrix.cc:23:
kaldi
-matrix.cc: In member function void kaldi::MatrixBase<Real>::Invert(Real*, Real*, bool)’:
../base/kaldi-utils.h:55:43: error: there are no arguments to posix_memalign that depend on a template parameter, so a declaration of posix_memalign must be available [-fpermissive]
     
(!posix_memalign(pp_orig, align, size) ? *(pp_orig) : NULL)
                                           
^
kaldi
-matrix.cc:51:11: note: in expansion of macro KALDI_MEMALIGN
           KALDI_MEMALIGN
(16, sizeof(Real)*l_work, &temp))) == NULL)
           
^
../base/kaldi-utils.h:55:43: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
     
(!posix_memalign(pp_orig, align, size) ? *(pp_orig) : NULL)
                                           
^
kaldi
-matrix.cc:51:11: note: in expansion of macro KALDI_MEMALIGN
           KALDI_MEMALIGN
(16, sizeof(Real)*l_work, &temp))) == NULL)
           
^
kaldi
-matrix.cc: In member function void kaldi::MatrixBase<Real>::LapackGesvd(kaldi::VectorBase<Real>*, kaldi::MatrixBase<Real>*, kaldi::MatrixBase<Real>*)’:
../base/kaldi-utils.h:55:43: error: there are no arguments to posix_memalign that depend on a template parameter, so a declaration of posix_memalign must be available [-fpermissive]
     
(!posix_memalign(pp_orig, align, size) ? *(pp_orig) : NULL)
                                           
^
kaldi
-matrix.cc:566:11: note: in expansion of macro KALDI_MEMALIGN
           KALDI_MEMALIGN
(16, sizeof(Real)*l_work, &temp))) == NULL)
           
^
kaldi
-matrix.cc: In member function void kaldi::Matrix<Real>::Init(kaldi::MatrixIndexT, kaldi::MatrixIndexT, kaldi::MatrixStrideType)’:
../base/kaldi-utils.h:55:43: error: there are no arguments to posix_memalign that depend on a template parameter, so a declaration of posix_memalign must be available [-fpermissive]
     
(!posix_memalign(pp_orig, align, size) ? *(pp_orig) : NULL)
                                           
^
kaldi
-matrix.cc:658:23: note: in expansion of macro KALDI_MEMALIGN
   
if (NULL != (data = KALDI_MEMALIGN(16, size, &temp))) {
                       
^
kaldi
-matrix.cc: In member function void kaldi::Matrix<Real>::Read(std::istream&, bool, bool)’:
kaldi
-matrix.cc:1413:49: error: there are no arguments to strcasecmp that depend on a template parameter, so a declaration of strcasecmp must be available [-fpermissive]
         
if (!KALDI_STRCASECMP(str.c_str(), "inf") ||
                                                 
^
kaldi
-matrix.cc:1414:54: error: there are no arguments to strcasecmp that depend on a template parameter, so a declaration of strcasecmp must be available [-fpermissive]
             
!KALDI_STRCASECMP(str.c_str(), "infinity")) {
                                                     
^
kaldi
-matrix.cc:1417:56: error: there are no arguments to strcasecmp that depend on a template parameter, so a declaration of strcasecmp must be available [-fpermissive]
         
} else if (!KALDI_STRCASECMP(str.c_str(), "nan")) {
                                                       
^
kaldi
-matrix.cc: In instantiation of void kaldi::Matrix<Real>::Read(std::istream&, bool, bool) [with Real = float; std::istream = std::basic_istream<char>]’:
kaldi
-matrix.cc:2840:16:   required from here
kaldi
-matrix.cc:1413:30: error: strcasecmp was not declared in this scope
         
if (!KALDI_STRCASECMP(str.c_str(), "inf") ||
                             
^
kaldi
-matrix.cc:1414:30: error: strcasecmp was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
             
!KALDI_STRCASECMP(str.c_str(), "infinity")) {
                             
^
kaldi
-matrix.cc:1413:30: note: strcasecmp declared here, later in the translation unit
         
if (!KALDI_STRCASECMP(str.c_str(), "inf") ||
                             
^
kaldi
-matrix.cc:1417:37: error: strcasecmp was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
         
} else if (!KALDI_STRCASECMP(str.c_str(), "nan")) {
                                     
^
kaldi
-matrix.cc:1413:30: note: strcasecmp declared here, later in the translation unit
         
if (!KALDI_STRCASECMP(str.c_str(), "inf") ||
                             
^
In file included from ../base/kaldi-common.h:34:0,
                 
from ../matrix/matrix-common.h:26,
                 
from ../matrix/kaldi-matrix.h:25,
                 
from kaldi-matrix.cc:23:
kaldi
-matrix.cc: In instantiation of void kaldi::Matrix<Real>::Init(kaldi::MatrixIndexT, kaldi::MatrixIndexT, kaldi::MatrixStrideType) [with Real = float; kaldi::MatrixIndexT = int]’:
kaldi
-matrix.cc:2840:16:   required from here
../base/kaldi-utils.h:55:22: error: posix_memalign was not declared in this scope
     
(!posix_memalign(pp_orig, align, size) ? *(pp_orig) : NULL)
                     
^
kaldi
-matrix.cc:658:23: note: in expansion of macro KALDI_MEMALIGN
   
if (NULL != (data = KALDI_MEMALIGN(16, size, &temp))) {
                       
^
kaldi
-matrix.cc: In instantiation of void kaldi::Matrix<Real>::Read(std::istream&, bool, bool) [with Real = double; std::istream = std::basic_istream<char>]’:
kaldi
-matrix.cc:2841:16:   required from here
kaldi
-matrix.cc:1413:30: error: strcasecmp was not declared in this scope
         
if (!KALDI_STRCASECMP(str.c_str(), "inf") ||
                             
^
kaldi
-matrix.cc:1414:30: error: strcasecmp was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
             
!KALDI_STRCASECMP(str.c_str(), "infinity")) {
                             
^
kaldi
-matrix.cc:1413:30: note: strcasecmp declared here, later in the translation unit
         
if (!KALDI_STRCASECMP(str.c_str(), "inf") ||
                             
^
kaldi
-matrix.cc:1417:37: error: strcasecmp was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
         
} else if (!KALDI_STRCASECMP(str.c_str(), "nan")) {
                                     
^
kaldi
-matrix.cc:1413:30: note: strcasecmp declared here, later in the translation unit
         
if (!KALDI_STRCASECMP(str.c_str(), "inf") ||
                             
^
In file included from ../base/kaldi-common.h:34:0,
                 
from ../matrix/matrix-common.h:26,
                 
from ../matrix/kaldi-matrix.h:25,
                 
from kaldi-matrix.cc:23:
kaldi
-matrix.cc: In instantiation of void kaldi::Matrix<Real>::Init(kaldi::MatrixIndexT, kaldi::MatrixIndexT, kaldi::MatrixStrideType) [with Real = double; kaldi::MatrixIndexT = int]’:
kaldi
-matrix.cc:2841:16:   required from here
../base/kaldi-utils.h:55:22: error: posix_memalign was not declared in this scope
     
(!posix_memalign(pp_orig, align, size) ? *(pp_orig) : NULL)
                     
^
kaldi
-matrix.cc:658:23: note: in expansion of macro KALDI_MEMALIGN
   
if (NULL != (data = KALDI_MEMALIGN(16, size, &temp))) {
                       
^
kaldi
-matrix.cc: In instantiation of void kaldi::MatrixBase<Real>::Invert(Real*, Real*, bool) [with Real = float]’:
kaldi
-matrix.cc:2842:16:   required from here
../base/kaldi-utils.h:55:22: error: posix_memalign was not declared in this scope
     
(!posix_memalign(pp_orig, align, size) ? *(pp_orig) : NULL)
                     
^
kaldi
-matrix.cc:51:11: note: in expansion of macro KALDI_MEMALIGN
           KALDI_MEMALIGN
(16, sizeof(Real)*l_work, &temp))) == NULL)
           
^
kaldi
-matrix.cc: In instantiation of void kaldi::MatrixBase<Real>::LapackGesvd(kaldi::VectorBase<Real>*, kaldi::MatrixBase<Real>*, kaldi::MatrixBase<Real>*) [with Real = float]’:
kaldi
-matrix.cc:2842:16:   required from here
../base/kaldi-utils.h:55:22: error: posix_memalign was not declared in this scope
     
(!posix_memalign(pp_orig, align, size) ? *(pp_orig) : NULL)
                     
^
kaldi
-matrix.cc:566:11: note: in expansion of macro KALDI_MEMALIGN
           KALDI_MEMALIGN
(16, sizeof(Real)*l_work, &temp))) == NULL)
           
^
kaldi
-matrix.cc: In instantiation of void kaldi::MatrixBase<Real>::Invert(Real*, Real*, bool) [with Real = double]’:
kaldi
-matrix.cc:2843:16:   required from here
../base/kaldi-utils.h:55:22: error: posix_memalign was not declared in this scope
     
(!posix_memalign(pp_orig, align, size) ? *(pp_orig) : NULL)
                     
^
kaldi
-matrix.cc:51:11: note: in expansion of macro KALDI_MEMALIGN
           KALDI_MEMALIGN
(16, sizeof(Real)*l_work, &temp))) == NULL)
           
^
kaldi
-matrix.cc: In instantiation of void kaldi::MatrixBase<Real>::LapackGesvd(kaldi::VectorBase<Real>*, kaldi::MatrixBase<Real>*, kaldi::MatrixBase<Real>*) [with Real = double]’:
kaldi
-matrix.cc:2843:16:   required from here
../base/kaldi-utils.h:55:22: error: posix_memalign was not declared in this scope
     
(!posix_memalign(pp_orig, align, size) ? *(pp_orig) : NULL)
                     
^
kaldi
-matrix.cc:566:11: note: in expansion of macro KALDI_MEMALIGN
           KALDI_MEMALIGN
(16, sizeof(Real)*l_work, &temp))) == NULL)
           
^
<builtin>: recipe for target 'kaldi-matrix.o' failed
make
[1]: *** [kaldi-matrix.o] Error 1
make
[1]: Leaving directory '/cygdrive/i/Kaldi/kaldi-master/src/matrix'
Makefile:137: recipe for target 'matrix' failed
make
: *** [matrix] Error 2



Daniel Povey

unread,
Jun 3, 2016, 7:27:21 PM6/3/16
to Prijazen Dom, kaldi-help
OK, it looks like quite a lot of POSIX functions are not available,
which is odd because cygwin claims to be POSIX compliant. There may
be some command-line flag available or something we can define to fix
this, but before we get to that, I notice that it's defining the
-std=c++0x flag. That may have something to do with the removal of
these POSIX functions. I imagine that would be because you changed
the tools/Makefile to use the more recent version of OpenFst.

Try reverting the tools/ to use the older OpenFst, and rerun
configure, which will remove the -std=c++0x flag, and see if that
resolves your problems.


Dan

Prijazen Dom

unread,
Jun 28, 2016, 3:25:34 AM6/28/16
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
Hello,

sorry, I've been busy with other things... Your advice improves compilation a lot. I've used older version of openfst. Tools compile fine, the error comes in src directory (chain) :

ranlib kaldi-nnet2.a
make
[1]: Leaving directory '/cygdrive/i/Kaldi/kaldi-master/src/nnet2'
make
-C chain
make
[1]: Entering directory '/cygdrive/i/Kaldi/kaldi-master/src/chain'
g
++ -msse -msse2 -Wall -I.. -DKALDI_DOUBLEPRECISION=0 -DHAVE_CLAPACK -I ../../tools/CLAPACK/ -Wno-sign-compare -Wno-unused-local-typedefs -Winit-self -I ../../tools/CLAPACK/ -I /cygdrive/i/Kaldi/kaldi-master/tools/openfst/include  -g    -c -o chain-supervision.o chain-supervision.cc
In file included from /cygdrive/i/Kaldi/kaldi-master/tools/openfst/include/fst/fstlib.h:54:0,
                 
from ../fstext/fstext-lib.h:22,
                 
from ../lat/kaldi-lattice.h:24,
                 
from ../chain/chain-supervision.h:30,
                 
from chain-supervision.cc:20:
/cygdrive/i/Kaldi/kaldi-master/tools/openfst/include/fst/compact-fst.h: In instantiation of static bool fst::CompactFst<A, C, U>::WriteFst(const F&, const C&, std::ostream&, const fst::FstWriteOptions&) [with F = fst::VectorFst<fst::ArcTpl<fst::TropicalWeightTpl<float> > >; A = fst::ArcTpl<fst::TropicalWeightTpl<float> >; C = fst::AcceptorCompactor<fst::ArcTpl<fst::TropicalWeightTpl<float> > >; U = unsigned int; std::ostream = std::basic_ostream<char>]’:
chain
-supervision.cc:532:22:   required from here
/cygdrive/i/Kaldi/kaldi-master/tools/openfst/include/fst/compact-fst.h:937:42: warning: variable num_compacts set but not used [-Wunused-but-set-variable]
   size_t num_arcs
= -1, num_states = -1, num_compacts = -1;
                                         
^
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/../../../../x86_64-pc-cygwin/bin/as: chain-supervision.o: too many sections (34434)
/tmp/ccDw48Md.s: Assembler messages:
/tmp/ccDw48Md.s: Fatal error: can't write chain-supervision.o: File too big
/usr/lib/gcc/x86_64-pc-cygwin/5.3.0/../../../../x86_64-pc-cygwin/bin/as: chain-supervision.o: too many sections (34434)
/tmp/ccDw48Md.s: Fatal error: can'
t close chain-supervision.o: File too big
<builtin>: recipe for target 'chain-supervision.o' failed
make
[1]: *** [chain-supervision.o] Error 1
make
[1]: Leaving directory '/cygdrive/i/Kaldi/kaldi-master/src/chain'
Makefile:137: recipe for target 'chain' failed
make
: *** [chain] Error 2

Any advice what to try ?

Daniel Povey

unread,
Jun 28, 2016, 2:41:11 PM6/28/16
to Prijazen Dom, kaldi-help
OK thanks.
Try adding

-Wa,-mbig-obj

to the CXXFLAGS in src/kaldi.mk
and see if it helps.

Dan

Prijazen Dom

unread,
Aug 11, 2017, 6:54:44 AM8/11/17
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
Hi,

sorry for late reply, but your advice solved problem... I think something in this direction is already prepared in makefile for openfst :
        ifeq ($(OSTYPE),cygwin)
            cd openfst
-$(OPENFST_VERSION)/; ./configure --prefix=`pwd` --enable-static --enable-shared --enable-far --enable-ngram-fsts CXX=$(CXX) CXXFLAGS="$(CXXFLAGS) -O" LDFLAGS="$(LDFLAGS)" LIBS="-ldl"
       
else
            cd openfst
-$(OPENFST_VERSION)/; ./configure --prefix=`pwd` --enable-static --enable-shared --enable-far --enable-ngram-fsts CXX=$(CXX) CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="-ldl"
        endif

but somehow only

export OS_TYPE="cygwin"


doesnt' work. So I had to add that manually...

Jan Trmal

unread,
Aug 11, 2017, 10:09:34 AM8/11/17
to kaldi-help, Prijazen Dom, Dan Povey
you are exporting OS_TYPE but the test is for OSTYPE -- anyway I googled briefly and it seems the OSTYPE variable should be defined automatically, so I'm not sure where is the problem
y.

--
Go to http://kaldi-asr.org/forums.html find out how to join
---
You received this message because you are subscribed to the Google Groups "kaldi-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kaldi-help+unsubscribe@googlegroups.com.

Prijazen Dom

unread,
Aug 11, 2017, 10:38:30 AM8/11/17
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
Thanks, you're right...


OSTYPE is set correctly, so it should work - will probably try again on next installation...

Regards,
Rob.
To unsubscribe from this group and stop receiving emails from it, send an email to kaldi-help+...@googlegroups.com.

Daniel Povey

unread,
Aug 11, 2017, 2:16:00 PM8/11/17
to Prijazen Dom, kaldi-help
I seem to remember that for at least one recent version of Cygwin,
OSTYPE was no longer defined. That was about the time I started
tuning out Cygwin/Windows issues, feeling that the platform was so
unstable it was hardly worthwhile paying attention to.

Prijazen Dom

unread,
Aug 12, 2017, 6:17:24 PM8/12/17
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
I've checked and it is setup properly on my cygwi...

Prijazen Dom

unread,
Aug 12, 2017, 6:24:11 PM8/12/17
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
Hello,

I've succedded in compiling Kaldi on Cygwin and it seems to work. I've tried yesno example and now I'm working on timit.
I got some comparable results :
$ bash RESULTS test
%WER 32.8 | 192 7215 | 70.0 19.5 10.5 2.8 32.8 100.0 | -0.256 | exp/mono/decode_test/score_6/ctm_39phn.filt.sys
%WER 25.7 | 192 7215 | 78.0 16.5 5.5 3.7 25.7 100.0 | -0.132 | exp/tri1/decode_test/score_10/ctm_39phn.filt.sys
%WER 23.6 | 192 7215 | 80.0 15.0 5.0 3.6 23.6 100.0 | -0.366 | exp/tri2/decode_test/score_9/ctm_39phn.filt.sys
%WER 21.1 | 192 7215 | 82.5 13.1 4.4 3.6 21.1 99.5 | -0.902 | exp/tri3/decode_test/score_8/ctm_39phn.filt.sys
%WER 23.6 | 192 7215 | 79.7 15.0 5.3 3.3 23.6 99.5 | -0.339 | exp/tri3/decode_test.si/score_9/ctm_39phn.filt.sys
%WER 22.8 | 192 7215 | 80.7 13.5 5.7 3.6 22.8 100.0 | -0.891 | exp/tri4_nnet/decode_test/score_4/ctm_39phn.filt.sys
%WER 19.4 | 192 7215 | 83.2 12.1 4.6 2.6 19.4 99.5 | -0.192 | exp/sgmm2_4/decode_test/score_9/ctm_39phn.filt.sys
%WER 19.4 | 192 7215 | 83.6 12.1 4.3 2.9 19.4 99.5 | -0.282 | exp/sgmm2_4_mmi_b0.1/decode_test_it1/score_8/ctm_39phn.filt.sys
%WER 19.4 | 192 7215 | 83.6 12.1 4.3 3.0 19.4 99.5 | -0.271 | exp/sgmm2_4_mmi_b0.1/decode_test_it2/score_8/ctm_39phn.filt.sys
%WER 19.4 | 192 7215 | 83.5 12.1 4.3 3.0 19.4 99.5 | -0.274 | exp/sgmm2_4_mmi_b0.1/decode_test_it3/score_8/ctm_39phn.filt.sys
%WER 19.4 | 192 7215 | 83.6 12.1 4.3 3.0 19.4 99.5 | -0.271 | exp/sgmm2_4_mmi_b0.1/decode_test_it4/score_8/ctm_39phn.filt.sys
%WER 18.3 | 192 7215 | 84.7 11.9 3.5 2.9 18.3 99.0 | -0.287 | exp/combine_2/decode_test_it1/score_5/ctm_39phn.filt.sys
%WER 18.2 | 192 7215 | 84.7 11.9 3.5 2.9 18.2 99.0 | -0.287 | exp/combine_2/decode_test_it2/score_5/ctm_39phn.filt.sys
%WER 18.2 | 192 7215 | 84.7 11.9 3.5 2.9 18.2 99.0 | -0.289 | exp/combine_2/decode_test_it3/score_5/ctm_39phn.filt.sys
%WER 18.3 | 192 7215 | 84.6 11.9 3.5 2.9 18.3 99.0 | -0.286 | exp/combine_2/decode_test_it4/score_5/ctm_39phn.filt.sys

But it seems something is wrong in step :
============================================================================
               DNN
Hybrid Training & Decoding (Karel's recipe)
============================================================================
steps/nnet/make_fmllr_feats.sh --nj 10 --cmd run.pl --mem 2G --transform-dir exp/tri3/decode_test data-fmllr-tri3/test data/test expri3/test/log data-fmllr-tri3/test/data
steps/nnet/make_fmllr_feats.sh: feature type is lda_fmllr
utils/copy_data_dir.sh: copied data from data/test to data-fmllr-tri3/test
utils/validate_data_dir.sh: Successfully validated data-directory data-fmllr-tri3/test
run.pl: 4 / 10 failed, log is in data-fmllr-tri3/test/log/make_fmllr_feats.*.log

If I take a look at log files, there  seems to be an error, that I don't understand or don't know how to deal with it.... For example :
# copy-feats 'ark,s,cs:apply-cmvn  --utt2spk=ark:data/test/split10/4/utt2spk scp:data/test/split10/4/cmvn.scp scp:data/test/split10/4/feats.scp ark:- | splice-feats --left-context=3 --right-context=3 ark:- ark:- | transform-feats exp/tri3/final.mat ark:- ark:- | transform-feats --utt2spk=ark:data/test/split10/4/utt2spk "ark:cat exp/tri3/decode_test/trans.* |" ark:- ark:- |' ark,scp:/cygdrive/i/kaldi/kaldi-master/egs/timit/s5/data-fmllr-tri3/test/data/feats_fmllr_test.4.ark,/cygdrive/i/kaldi/kaldi-master/egs/timit/s5/data-fmllr-tri3/test/data/feats_fmllr_test.4.scp
# Started at Sat Aug 12 23:36:49     2017
#
copy
-feats 'ark,s,cs:apply-cmvn  --utt2spk=ark:data/test/split10/4/utt2spk scp:data/test/split10/4/cmvn.scp scp:data/test/split10/4/feats.scp ark:- | splice-feats --left-context=3 --right-context=3 ark:- ark:- | transform-feats exp/tri3/final.mat ark:- ark:- | transform-feats --utt2spk=ark:data/test/split10/4/utt2spk "ark:cat exp/tri3/decode_test/trans.* |" ark:- ark:- |' ark,scp:/cygdrive/i/kaldi/kaldi-master/egs/timit/s5/data-fmllr-tri3/test/data/feats_fmllr_test.4.ark,/cygdrive/i/kaldi/kaldi-master/egs/timit/s5/data-fmllr-tri3/test/data/feats_fmllr_test.4.scp
apply
-cmvn --utt2spk=ark:data/test/split10/4/utt2spk scp:data/test/split10/4/cmvn.scp scp:data/test/split10/4/feats.scp ark:-
transform
-feats exp/tri3/final.mat ark:- ark:-
splice
-feats --left-context=3 --right-context=3 ark:- ark:-
transform
-feats --utt2spk=ark:data/test/split10/4/utt2spk 'ark:cat exp/tri3/decode_test/trans.* |' ark:- ark:-
WARNING
(transform-feats:Next():util/kaldi-table-inl.h:574) Invalid archive file format: expected space after key ‡¸¶ż†| ŔW >ż©ƒ ż`śy?ˇÓäľ ňŕ>c&Á?{A0ż›Ę @KŚž>ÄŞ‚ż, got character [character 11], reading standard input
LOG (transform-feats:main():transform-feats.cc:158) Overall average logdet is 0.507242 over 195 frames.
LOG (transform-feats:main():transform-feats.cc:161) Applied transform to 1 utterances; 0 had errors.
LOG (apply-cmvn:main():apply-cmvn.cc:146) Applied cepstral mean normalization to 16 utterances, errors on 0
WARNING (transform-feats:Close():kaldi-io.cc:500) Pipe cat exp/tri3/decode_test/trans.* | had nonzero return status 13
ERROR (transform-feats:~SequentialTableReaderArchiveImpl():util/kaldi-table-inl.h:690) TableReader: error detected closing archive standard input


WARNING (copy-feats:Close():kaldi-io.cc:500) Pipe apply-cmvn  --utt2spk=ark:data/test/split10/4/utt2spk scp:data/test/split10/4/cmvn.scp scp:data/test/split10/4/feats.scp ark:- | splice-feats --left-context=3 --right-context=3 ark:- ark:- | transform-feats exp/tri3/final.mat ark:- ark:- | transform-feats --utt2spk=ark:data/test/split10/4/utt2spk "ark:cat exp/tri3/decode_test/trans.* |" ark:- ark:- | had nonzero return status 65280
ERROR (copy-feats:~SequentialTableReaderArchiveImpl():util/kaldi-table-inl.h:690) TableReader: error detected closing archive 'apply-cmvn  --utt2spk=ark:data/test/split10/4/utt2spk scp:data/test/split10/4/cmvn.scp scp:data/test/split10/4/feats.scp ark:- | splice-feats --left-context=3 --right-context=3 ark:- ark:- | transform-feats exp/tri3/final.mat ark:- ark:- | transform-feats --utt2spk=ark:data/test/split10/4/utt2spk "ark:cat exp/tri3/decode_test/trans.* |" ark:- ark:- |'


Any idea what might be wrong ?

Daniel Povey

unread,
Aug 12, 2017, 7:24:06 PM8/12/17
to Prijazen Dom, kaldi-help
Hm. It looks to me like it might be something to do with binary mode
on Windows, maybe something isn't interacting right with "cat". It
could be they changed something in recent cygwin versions. I'm afraid
you're mostly on your own there.
Dan

Jan Trmal

unread,
Aug 12, 2017, 8:14:14 PM8/12/17
to kaldi-help, Prijazen Dom
By any chance, are you running it from powershell? Powershell does weird things to binary data. 
Y. 

--
Go to http://kaldi-asr.org/forums.html find out how to join
---
You received this message because you are subscribed to the Google Groups "kaldi-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kaldi-help+unsubscribe@googlegroups.com.

Daniel Povey

unread,
Aug 12, 2017, 8:23:43 PM8/12/17
to kaldi-help, Prijazen Dom
I found some info here
http://www.jguillaumes.dyndns.org/cygwin-ug-net/using-textbinary.html
about binary vs. mode and how it interacts with "cat".
It seems that it depends whether the data is on a "text-mode partition".
You may be able to force binary mode by exporting the CYGWIN variable
as something including "binmode".
> email to kaldi-help+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Go to http://kaldi-asr.org/forums.html find out how to join
> ---
> You received this message because you are subscribed to the Google Groups
> "kaldi-help" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to kaldi-help+...@googlegroups.com.

Daniel Povey

unread,
Aug 12, 2017, 8:30:35 PM8/12/17
to kaldi-help, Prijazen Dom
Forget that: as per
https://cygwin.com/cygwin-ug-net/using-cygwinenv.html, "binmode" does
not exist in recent cygwin releases.

Prijazen Dom

unread,
Aug 13, 2017, 4:24:19 AM8/13/17
to kaldi-help, prijaz...@gmail.com, dpo...@gmail.com
Hi,

if I understand right, the problem is related to opening files in text or binary mode...

And it should open it in binary mode, right ?
Since I got so far, would really like to solve this one..

What actually happens in that step and why errors are reported only  in certain files ? Sometimes it says 4/10 or even 10/10...

Is there any more info(docs) about separate steps ?


Thanks in advance,
regards,
Rob.




Daniel Povey

unread,
Aug 13, 2017, 1:04:34 PM8/13/17
to Prijazen Dom, kaldi-help
You may be able to reprouce the problem more simply by doing

copy-feats "ark:cat exp/tri3/decode_test/trans.*|" /dev/null

and doing copy-feats for individual archives like

copy-feats ark:exp/tri3/decode_test/trans.1 /dev/null

to make sure they are individually OK.

Then you could try:
cat exp/tri3/decode_test/trans.* > foo
ls -l foo
and see if its byte count differs from the total byte-count of the
individual archives. Normally I'd suggest to measure these byte
counts via 'wc -c', but I'm not sure that I trust that with Windows
involved.

This won't necessarily lead to a solution though.
All this stuff used to work. They keep changing things.

Dan

Nartnarin Sumanungkul

unread,
Dec 7, 2017, 4:26:14 AM12/7/17
to kaldi-help
Hello Prijazen Dom ,I have a problem like you,Can you explain step for install kaldi in cygwin please. Thank you.
Reply all
Reply to author
Forward
0 new messages