compiling problem with external (static) library.

297 views
Skip to first unread message

euisun...@gmail.com

unread,
Nov 15, 2015, 5:56:06 PM11/15/15
to kaldi-help
Hello guys, I've been working on to compile things on Kaldi with a wavelet library (static) and I'm having some troubles because I'm quite new to this Linux environment. I would appreciate if you could tell me what I might be missing out on and some resources I could study more with or the direct cause of this problem.

What I want to compile is "compute-mfcc-feats.cc" located in "/kaldi-trunk/src/featbin".

The wavelet library is installed in "/kaldi-trunk/src/wavelib" with "libwavelet2s.a", "wavelet2s.h", "wavelet2s.o", and "wavelet2s.cpp" files located at "/kaldi-trunk/src/wavelib/src/static".  

Inside "compute-mfcc-feats.cc", there is a function call "mfcc.Compute(waveform, vtln_warp_local, &feature, NULL)". This function is defined in "feature-mfcc.cc". 

I made changes in "feature-mfcc.cc". The compilation of "feature-mfcc.cc" was successful with the following command.
"g++ -msse -msse2 -Wall -I.. -pthread -DKALDI_DOUBLEPRECISION=0 -DHAVE_POSIX_MEMALIGN -Wno-sign-compare -Wno-unused-local-typedefs -Winit-self -DHAVE_EXECINFO_H=1 -rdynamic -DHAVE_CXXABI_H -DHAVE_ATLAS -I/home/mario/src/kaldi/kaldi-trunk/tools/ATLAS/include -I/home/mario/src/kaldi/kaldi-trunk/src/wavelib/src/static -I/home/mario/src/kaldi/kaldi-trunk/tools/openfst/include -g -DKALDI_NO_EXPF -c -o feature-mfcc.o feature-mfcc.cc"

After the compilation above, the problem shows up with the compilation of "compute-mfcc-feats.cc". The command used is following.
"g++ -msse -msse2 -Wall -I.. -pthread -DKALDI_DOUBLEPRECISION=0 -DHAVE_POSIX_MEMALIGN -Wno-sign-compare -Wno-unused-local-typedefs -Winit-self -DHAVE_EXECINFO_H=1 -rdynamic -DHAVE_CXXABI_H -DHAVE_ATLAS -I/home/mario/src/kaldi/kaldi-trunk/tools/ATLAS/include -I/home/mario/src/kaldi/kaldi-trunk/src/wavelib/src/static -I/home/mario/src/kaldi/kaldi-trunk/tools/openfst/include -Wno-sign-compare -g  -DKALDI_NO_EXPF  -rdynamic -Wl,-rpath=/home/mario/src/kaldi/kaldi-trunk/tools/openfst/lib  compute-mfcc-feats.cc ../wavelib/src/static/libwavelet2s.a ../feat/kaldi-feat.a ../transform/kaldi-transform.a ../gmm/kaldi-gmm.a ../thread/kaldi-thread.a ../tree/kaldi-tree.a ../matrix/kaldi-matrix.a ../util/kaldi-util.a ../base/kaldi-base.a   -L/home/mario/src/kaldi/kaldi-trunk/tools/openfst/lib -lfst /usr/lib/libatlas.so.3 /usr/lib/libf77blas.so.3 /usr/lib/libcblas.so.3 /usr/lib/liblapack_atlas.so.3 -lm -lpthread -ldl -L/home/mario/src/kaldi/kaldi-trunk/src/wavelib/src/static -I/home/mario/src/kaldi/kaldi-turnk/src/wavelib/src/static -lwavelet2s -lfftw3 -o compute-mfcc-feats"

The error message tagged along is "../wavelib/src/static/libwavelet2s.a: error adding symbols: Archive has no index; run ranlib to add one".

Is this because I'm trying to compile libraries both dynamically and statically? I don't know I'm kind of stuck... If you have any additional info or questions, please let me know. I would really appreciate your help. 

Daniel Povey

unread,
Nov 15, 2015, 6:02:21 PM11/15/15
to kaldi-help
I am having trouble understanding the sentence

 "The error message tagged along is "../wavelib/src/static/libwavelet2s.a: error adding symbols: Archive has no index; run ranlib to add one"."
If you could just show the complete stderr output of gcc it would be helpful.
Bear in mind that the order of providing libraries on the command line matters, and the wavelet library needs to be listed after kaldi-feat.a, otherwise it won't pick up the symbols it needs.

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.

euisun...@gmail.com

unread,
Nov 18, 2015, 3:09:46 PM11/18/15
to kaldi-help, dpo...@gmail.com
Thank you sir. The compiling "compute-mfcc-feats.cc" was successful with the following command "g++ -msse -msse2 -Wall -I.. -pthread -DKALDI_DOUBLEPRECISION=0 -DHAVE_POSIX_MEMALIGN -Wno-sign-compare -Wno-unused-local-typedefs -Winit-self -DHAVE_EXECINFO_H=1 -rdynamic -DHAVE_CXXABI_H -DHAVE_ATLAS -I/home/mario/src/kaldi/kaldi-trunk/tools/ATLAS/include -I/home/mario/src/kaldi/kaldi-trunk/src/wavelib/src/static -I/home/mario/src/kaldi/kaldi-trunk/tools/openfst/include -Wno-sign-compare -g  -DKALDI_NO_EXPF  -rdynamic -Wl,-rpath=/home/mario/src/kaldi/kaldi-trunk/tools/openfst/lib  compute-mfcc-feats.cc ../feat/kaldi-feat.a ../wavelib/src/static/libwavelet2s.a ../transform/kaldi-transform.a ../gmm/kaldi-gmm.a ../thread/kaldi-thread.a ../tree/kaldi-tree.a ../matrix/kaldi-matrix.a ../util/kaldi-util.a ../base/kaldi-base.a   -L/home/mario/src/kaldi/kaldi-trunk/tools/openfst/lib -lfst /usr/lib/libatlas.so.3 /usr/lib/libf77blas.so.3 /usr/lib/libcblas.so.3 /usr/lib/liblapack_atlas.so.3 -lm -lpthread -ldl -L/home/mario/src/kaldi/kaldi-trunk/src/wavelib/src/static -lwavelet2s -lfftw3 -o compute-mfcc-feats".

But it seems like the changes I made in "feature-mfcc.cc" didn't get taken into account. I thought during the compilation of "compute-mfcc-feats.cc", it loads up "feature-mfcc.o" file. Or is it possible that the compilation of "feature-mfcc.cc" didn't actually work? In order to compile "feature-mfcc.cc" file, the following command was used at "/kaldi/src/feat", "g++ -msse -msse2 -Wall -I.. -pthread -DKALDI_DOUBLEPRECISION=0 -DHAVE_POSIX_MEMALIGN -Wno-sign-compare -Wno-unused-local-typedefs -Winit-self -DHAVE_EXECINFO_H=1 -rdynamic -DHAVE_CXXABI_H -DHAVE_ATLAS -I/home/mario/src/kaldi/kaldi-trunk/tools/ATLAS/include -I/home/mario/src/kaldi/kaldi-trunk/src/wavelib/src/static -I/home/mario/src/kaldi/kaldi-trunk/tools/openfst/include -g -DKALDI_NO_EXPF -c -o feature-mfcc.o feature-mfcc.cc". Is there any execution file associated with "feature-mfcc.cc" I need to additionally compile?

If you have any questions, please let me know. I'd appreciate your help.

Thanks.

Daniel Povey

unread,
Nov 18, 2015, 3:10:24 PM11/18/15
to euisun...@gmail.com, kaldi-help
You have to compile in the feat/ directory first.  (type 'make' there)
Dan

euisun...@gmail.com

unread,
Nov 18, 2015, 3:15:20 PM11/18/15
to kaldi-help, euisun...@gmail.com, dpo...@gmail.com
I actually did 'make' in "/kaldi/src/feat" to make "feature-mfcc.o", then compiled "compute-mfcc-feats.cc" to make "compute-mfcc-feats.o" and its execution file. It seems like the changes I made in "feature-mfcc.cc" still didn't affect anything.

Am I missing something? I appreciate your time.

-Euisung

Daniel Povey

unread,
Nov 18, 2015, 3:19:36 PM11/18/15
to euisun...@gmail.com, kaldi-help
It's not enough to make the .o file, you have to make the .a file using the 'ranlib' command.  It automatically happens if you use the provided Makefile.
Dan

Reply all
Reply to author
Forward
0 new messages