This project is read-only.

Namespace Error when Compiling KaldiReader


I am trying to recompile CNTK on a machine running CentOS 6.6 with gcc version 4.8.2.

After pulling down the latest version of the code, make returns the following error. I am also attaching a text file with the complete output from running make (which includes some other errors printed after the one below, but I wanted to address the namespace issue first).
creating .build/DataReader/KaldiReader/DataReader.o for with build type release
mpic++ -c DataReader/KaldiReader/DataReader.cpp -o .build/DataReader/KaldiReader/DataReader.o -D_POSIX_SOURCE -D_XOPEN_SOURCE=600 -D__USE_XOPEN2K -DCPUONLY -DUSE_MKL -DKALDI_DOUBLEPRECISION=0 -DHAVE_POSIX_MEMALIGN -DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_ATLAS -DHAVE_OPENFST_GE_10400 -DNDEBUG -msse3 -std=c++0x -std=c++11 -fopenmp -fpermissive -fPIC -Werror -fcheck-new -Wno-error=literal-suffix -O4 -ICommon/Include -IMath/Math -IMachineLearning/CNTK -IMachineLearning/CNTKActionsLib -IMachineLearning/CNTKComputationNetworkLib -IMachineLearning/CNTKSGDLib -IMachineLearning/CNTKSequenceTrainingLib -IBrainScript -I/opt/intel/mkl/include -I/usr/local/kaldi-trunk/src -I/usr/local/kaldi-trunk/tools/ATLAS/include -I/usr/local/kaldi-trunk/tools/openfst/include -MD -MP -MF .build/DataReader/KaldiReader/DataReader.d
In file included from DataReader/KaldiReader/htkfeatio.h:10:0,
                 from DataReader/KaldiReader/DataReader.cpp:15:
DataReader/KaldiReader/basetypes.h:240:12: error: declaration of ‘class std::vector<_Tp, _Alloc>’ in namespace ‘msra::basetypes’ which does not enclose ‘std’
 class std::vector : public std::vector<_ElemType>

file attachments


yzhang87 wrote Dec 7, 2015 at 11:32 PM


Please comment out in Makefile

This is an old reader. Please use Kaldi2Reader.


tcpowers wrote Dec 8, 2015 at 9:55 PM

Thank you for responding. I did as you suggested, and made it past the Kadli2Reader compilation after modifying some of the header files in Common/Include/ due to redefinition errors for functions, classes, and structs in DataReader/Kaldi2Reader/basetypes.h.

Now I have the following issue when compiling DataReader/Kaldi2Reader/HTKMLFReader:
creating .build/DataReader/Kaldi2Reader/HTKMLFReader.o for with build type release
mpic++ -c DataReader/Kaldi2Reader/HTKMLFReader.cpp -o .build/DataReader/Kaldi2Reader/HTKMLFReader.o -D_POSIX_SOURCE -D_XOPEN_SOURCE=600 -D__USE_XOPEN2K -DCPUONLY -DUSE_MKL -DKALDI_DOUBLEPRECISION=0 -DHAVE_POSIX_MEMALIGN -DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_ATLAS -DHAVE_OPENFST_GE_10400 -DNDEBUG -msse3 -std=c++0x -std=c++11 -fopenmp -fpermissive -fPIC -Werror -fcheck-new -Wno-error=literal-suffix -O4 -ICommon/Include -IMath/Math -IMachineLearning/CNTK -IMachineLearning/CNTKActionsLib -IMachineLearning/CNTKComputationNetworkLib -IMachineLearning/CNTKSGDLib -IMachineLearning/CNTKSequenceTrainingLib -IBrainScript -I/opt/intel/mkl/include -I/usr/local/kaldi-trunk/src -I/usr/local/kaldi-trunk/tools/ATLAS/include -I/usr/local/kaldi-trunk/tools/openfst/include -MD -MP -MF .build/DataReader/Kaldi2Reader/HTKMLFReader.d
DataReader/Kaldi2Reader/HTKMLFReader.cpp: In instantiation of ‘void Microsoft::MSR::CNTK::HTKMLFReader<ElemType>::InitFromConfig(const ConfigRecordType&) [with ConfigRecordType = Microsoft::MSR::ScriptableObjects::IConfigRecord; ElemType = float]’:
DataReader/Kaldi2Reader/HTKMLFReader.h:166:104:   required from ‘void Microsoft::MSR::CNTK::HTKMLFReader<ElemType>::Init(const Microsoft::MSR::ScriptableObjects::IConfigRecord&) [with ElemType = float]’
DataReader/Kaldi2Reader/HTKMLFReader.cpp:2111:20:   required from here
DataReader/Kaldi2Reader/HTKMLFReader.cpp:68:30: error: cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘size_t {aka long unsigned int}’ in assignment
         m_maxUtteranceLength = readerConfig(L"maxUtteranceLength", "10000");
DataReader/Kaldi2Reader/HTKMLFReader.cpp:76:21: error: cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘bool’ in assignment
         m_truncated = readerConfig(L"Truncated", "false");
DataReader/Kaldi2Reader/HTKMLFReader.cpp:77:36: error: cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘size_t {aka long unsigned int}’ in assignment
         m_numberOfuttsPerMinibatch = readerConfig(L"nbruttsineachrecurrentiter", "1");
DataReader/Kaldi2Reader/HTKMLFReader.cpp:96:33: error: call of overloaded ‘basic_string(const Microsoft::MSR::ScriptableObjects::ConfigValuePtr&)’ is ambiguous
             m_seqTrainCriterion = wstring(readerConfig(L"seqTrainCriterion"));
I have also included the full output from running make.

yzhang87 wrote Dec 13, 2015 at 6:51 PM

Sorry, I just noticed your message today. Will look into it.


yzhang87 wrote Dec 15, 2015 at 4:25 AM


I just checked in a fix. Please let me know if there is any problems. The error is due to a recent interface change.


tcpowers wrote Jan 7, 2016 at 1:15 AM

Hi Yu,

I ended up reverting back to the last version that compiled for us. I have some new issues, but I will post them in a new thread.