Skip to content

make it compile in clang#1

Open
kmike wants to merge 8 commits into
mpsilfve:masterfrom
kmike:osx
Open

make it compile in clang#1
kmike wants to merge 8 commits into
mpsilfve:masterfrom
kmike:osx

Conversation

@kmike
Copy link
Copy Markdown

@kmike kmike commented May 16, 2015

Hey @mpsilfve,

I'm not a C++ expert, but here are some changes to make tests compile on OS X.
They were required to make cd src/tagger; make tests compile.
Some tests still don't compile for me, e.g.

make TEST_Trellis
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o io.o io.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o Word.o Word.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o LemmaExtractor.o LemmaExtractor.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o LabelExtractor.o LabelExtractor.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o Sentence.o Sentence.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o ParamTable.o ParamTable.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o Data.o Data.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o TrellisColumn.o TrellisColumn.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o Trellis.o Trellis.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o Trainer.o Trainer.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o PerceptronTrainer.o PerceptronTrainer.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o SGDTrainer.o SGDTrainer.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o TrellisCell.o TrellisCell.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o Tagger.o Tagger.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o TaggerOptions.o TaggerOptions.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x   -c -o SuffixLabelMap.o SuffixLabelMap.cc
clang++ -Wall -Wextra -g -O3 -Wfatal-errors -Werror -std=c++0x -DTEST_Trellis_cc -o TEST_Trellis io.o Word.o LemmaExtractor.o LabelExtractor.o Sentence.o ParamTable.o Data.o TrellisColumn.o Trellis.o Trainer.o PerceptronTrainer.o SGDTrainer.o TrellisCell.o Tagger.o TaggerOptions.o SuffixLabelMap.o Trellis.cc
duplicate symbol __Z8float_eqff in:
    TaggerOptions.o
    /var/folders/_5/cbsg50991szfp1r9nwxpx8580000gn/T/Trellis-9878f7.o
ld: 1 duplicate symbol for architecture x86_64
clang: fatal error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [TEST_Trellis] Error 1

Some tests pass (TEST_Word, TEST_io, TEST_LabelExtractor, TEST_Sentence, TEST_ParamTable, TEST_Data).

Some segfault:

> ./TEST_LemmaExtractor
Assertion failed: (lemma_extractor.get_lemma_candidate("hogs", "NN") == "hog"), function main, file LemmaExtractor.cc, line 666.
Abort trap: 6
> ./TEST_TrellisColumn
libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: vector
Abort trap: 6

kmike added 8 commits May 16, 2015 19:01
std::pair is defined with int argument first, float argument second.

Error message:
fatal error: implicit conversion from 'double' to 'int' changes value from 5.1 to 5
Error message:

Word.cc:144:8: fatal error: 'SillyLabelExtractor::set_label_candidates' hides overloaded virtual function [-Woverloaded-virtual]
  void set_label_candidates(const std::string &word_form,
       ^
./LabelExtractor.hh:42:16: note: hidden overloaded virtual function 'LabelExtractor::set_label_candidates' declared here: type mismatch at 3rd
      parameter ('float' vs 'unsigned int')
  virtual void set_label_candidates(const std::string &word_form,
               ^
Error:

ParamTable.cc:459:26: fatal error: too few arguments to function call, expected 2, have 1
I haven't checked that it works.
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

Successfully merging this pull request may close these issues.

1 participant