Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling Error: "./src/include/./util.h:44:9: error: ‘unordered_map’ does not name a type" #57

Open
nparslow opened this issue Apr 26, 2020 · 7 comments

Comments

@nparslow
Copy link

nparslow commented Apr 26, 2020

g++ -DPACKAGE_NAME="phonetisaurus" -DPACKAGE_TARNAME="phonetisaurus" -DPACKAGE_VERSION="0.8.1" -DPACKAGE_STRING="phonetisaurus\ 0.8.1" -DPACKAGE_BUGREPORT="[email protected]" -DPACKAGE_URL="" -DPACKAGE="phonetisaurus" -DVERSION="0.8.1" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=".libs/" -DHAVE_CXX11=1 -DHAVE_GETGID=1 -DHAVE_LIBDL=1 -DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DHAVE_STDDEF_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_PTRDIFF_T=1 -DHAVE_MEMMOVE=1 -DHAVE_STRCHR=1 -DHAVE_STRRCHR=1 -DHAVE_STRSPN=1 -DHAVE_FST_FST_H=1 -DHAVE_OPENMP=1 -I. -I./src -DGIT_REVISION="kaldi-17-g1a7306-dirty" -std=c++0x -Wall -Wno-sign-compare -Wno-unused-local-typedefs -I ./src/3rdparty/utfcpp -g -O2 -MT src/bin/phonetisaurus_align-phonetisaurus-align.o -MD -MP -MF src/bin/.deps/phonetisaurus_align-phonetisaurus-align.Tpo -c -o src/bin/phonetisaurus_align-phonetisaurus-align.o test -f 'src/bin/phonetisaurus-align.cc' || echo './'src/bin/phonetisaurus-align.cc
In file included from ./src/include/M2MFstAligner.h:39:0,
from src/bin/phonetisaurus-align.cc:32:
./src/include/./util.h:44:9: error: ‘unordered_map’ does not name a type
typedef unordered_map<LogArc::Label, LabelDatum> LabelData;
^~~~~~~~~~~~~
./src/include/./util.h:46:1: error: ‘string’ does not name a type; did you mean ‘stdin’?
string vec2str (vector vec, string sep);
^~~~~~
stdin
./src/include/./util.h:48:1: error: ‘string’ does not name a type; did you mean ‘stdin’?
string itoas (int i);
^~~~~~
stdin
./src/include/./util.h:50:1: error: ‘vector’ does not name a type; did you mean ‘perror’?
vector tokenize_utf8_string (string* utf8_string, string* delimiter);
^~~~~~
perror
./src/include/./util.h:52:1: error: ‘vector’ does not name a type; did you mean ‘perror’?
vector tokenize_entry (string* testword, string* sep,
^~~~~~
perror
./src/include/./util.h:55:1: error: ‘vector’ does not name a type; did you mean ‘perror’?
vector tokenize2ints (string* word, string* sep, const SymbolTable* syms);
^~~~~~
perror
In file included from src/bin/phonetisaurus-align.cc:32:0:
./src/include/M2MFstAligner.h:94:3: error: ‘LabelData’ does not name a type; did you mean ‘LabelDatum’?
LabelData penalties;
^~~~~~~~~
LabelDatum
In file included from src/bin/phonetisaurus-align.cc:33:0:
./src/include/LatticePruner.h:52:3: error: ‘LabelData’ does not name a type; did you mean ‘LabelDatum’?
LabelData penalties;
^~~~~~~~~
LabelDatum
./src/include/LatticePruner.h:61:28: error: expected ‘)’ before ‘_penalties’
LatticePruner (LabelData _penalties, TropicalWeight _beam, int _nbest,
^~~~~~~~~~
src/bin/phonetisaurus-align.cc: In function ‘int load_input_file(fst::M2MFstAligner*, std::__cxx11::string, std::__cxx11::string, std::__cxx11::string, std::__cxx11::string, bool)’:
src/bin/phonetisaurus-align.cc:52:31: error: ‘tokenize_utf8_string’ was not declared in this scope
vector tokens = tokenize_utf8_string (&line, &delim);
^~~~~~~~~~~~~~~~~~~~
src/bin/phonetisaurus-align.cc: In function ‘void write_alignments(fst::M2MFstAligner*, std::__cxx11::string, fst::ArcTpl<fst::TropicalWeightTpl >::Weight, int, bool, bool)’:
src/bin/phonetisaurus-align.cc:91:34: error: ‘class fst::M2MFstAligner’ has no member named ‘penalties’; did you mean ‘penalize’?
LatticePruner pruner (aligner->penalties, threshold, nbest, fb, penalize);
^~~~~~~~~
penalize
src/bin/phonetisaurus-align.cc: In function ‘void compileNBestFarArchive(fst::M2MFstAligner*, std::vector<fst::VectorFst<fst::ArcTpl<fst::LogWeightTpl > > >*, std::__cxx11::string, fst::ArcTpl<fst::TropicalWeightTpl >::Weight, int, bool, bool)’:
src/bin/phonetisaurus-align.cc:168:34: error: ‘class fst::M2MFstAligner’ has no member named ‘penalties’; did you mean ‘penalize’?
LatticePruner pruner (aligner->penalties, threshold, nbest, fb, penalize);
^~~~~~~~~
penalize
Makefile:862: recipe for target 'src/bin/phonetisaurus_align-phonetisaurus-align.o' failed
make: *** [src/bin/phonetisaurus_align-phonetisaurus-align.o] Error 1

any ideas on how to get it to work?

edit : i'm on linux mint 19.3, ran configure then make

@jpetso
Copy link

jpetso commented Apr 27, 2020

Not having looked at the actual code, the error message suggests that there may be an #include <unordered_map> missing somewhere around this util.h file, possibly with additional missing includes of <string> and <vector> files.

@nparslow
Copy link
Author

yeah I thought the same, but the src/include/util.h has the following section:
`#include <fst/fstlib.h>
#include <utf8.h>
#include <unordered_map>
#include
#include
#ifdef MACH
#include <mach/clock.h>
#include <mach/mach.h>
#endif
using namespace fst;

typedef struct LabelDatum {int max, tot, lhs, rhs; bool lhsE, rhsE;} LabelDatum;
typedef unordered_map<LogArc::Label, LabelDatum> LabelData;`

so I'm a bit unsure how to debug it atm.

@AdolfVonKleist
Copy link
Owner

Sorry for the delayed reply. I am pretty sure this is an issue with either a newer version of g++ or openfst. If you are still looking at this can you share the OpenFst and compiler plus version you are using?

@nparslow
Copy link
Author

yup sure, I've got:
openfst-1.7.6
and
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

is there a version of either I should try rolling back to?

@AdolfVonKleist
Copy link
Owner

AdolfVonKleist commented May 14, 2020 via email

@petronny
Copy link

petronny commented May 18, 2020

I manually added

using namespace std;

in src/include/util.h.

It seems that all errors are fixed except this one:

In file included from src/bin/phonetisaurus-g2prnn.cc:4:
./src/include/LegacyRnnLMReader.h:53:31: error:cannot convert ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} to ‘int&’
   53 |       h.MapToken (h.vocab_[i].word);
      |                   ~~~~~~~~~~~~^~~~
      |                               |
      |                               std::string {aka std::__cxx11::basic_string<char>}

@petronny
Copy link

petronny commented Nov 3, 2020

I futher changed

void MapToken(string&

to

void MapToken(std::string&

in ./src/include/LegacyRnnLMReader.h and fixed the last error.

Somehow the last error disappeares with only adding using namespace std; in src/include/util.h.

I think this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants