Skip to content

Instantly share code, notes, and snippets.

@wareya
Last active April 16, 2018 22:45
Show Gist options
  • Select an option

  • Save wareya/0ee7baa1fd6f4bbe7a2567850676296a to your computer and use it in GitHub Desktop.

Select an option

Save wareya/0ee7baa1fd6f4bbe7a2567850676296a to your computer and use it in GitHub Desktop.
compile mecab without autotools making everything unreasonably elaborate
#!sh
# On mingw, YOU NEED TO EDIT mecab.h to change DLL_EXPORT to MECAB_DLL_EXPORT or similar. on other platforms, you need to edit the first g++ line below to use DDLL_EXPORT instead (remove mconsole while you're at it)
cd src
MECAB_DEFAULT_RC="\"C:/Program Files/mecab/etc/mecabrc\""
DIC_VERSION="102"
g++ -O3 -m64 -mconsole -I.. -DDIC_VERSION=$DIC_VERSION -DMECAB_DEFAULT_RC="$MECAB_DEFAULT_RC" -DHAVE_CONFIG_H -Wfatal-errors -DMECAB_DLL_EXPORT learner.cpp tagger.cpp viterbi.cpp char_property.cpp dictionary_compiler.cpp feature_index.cpp learner_tagger.cpp nbest_generator.cpp tokenizer.cpp connector.cpp dictionary_generator.cpp iconv_utils.cpp param.cpp utils.cpp context_id.cpp dictionary_rewriter.cpp lbfgs.cpp string_buffer.cpp dictionary.cpp eval.cpp writer.cpp libmecab.cpp -shared -static -static-libgcc -static-libstdc++ -lpthread -liconv -o libmecab.dll
g++ -Os -fdata-sections -ffunction-sections -fwhole-program -Wl,--gc-sections -Wl,--strip-all -m64 -mconsole -I.. -DDIC_VERSION=$DIC_VERSION -DMECAB_DEFAULT_RC="$MECAB_DEFAULT_RC" -DHAVE_CONFIG_H -Wfatal-errors mecab.cpp libmecab.dll -o mecab.exe -static -static-libgcc -static-libstdc++
g++ -Os -fdata-sections -ffunction-sections -fwhole-program -Wl,--gc-sections -Wl,--strip-all -m64 -mconsole -I.. -DDIC_VERSION=$DIC_VERSION -DMECAB_DEFAULT_RC="$MECAB_DEFAULT_RC" -DHAVE_CONFIG_H -Wfatal-errors mecab-test-gen.cpp libmecab.dll -o mecab-test-gen.exe -static -static-libgcc -static-libstdc++
g++ -Os -fdata-sections -ffunction-sections -fwhole-program -Wl,--gc-sections -Wl,--strip-all -m64 -mconsole -I.. -DDIC_VERSION=$DIC_VERSION -DMECAB_DEFAULT_RC="$MECAB_DEFAULT_RC" -DHAVE_CONFIG_H -Wfatal-errors mecab-system-eval.cpp libmecab.dll -o mecab-system-eval.exe -static -static-libgcc -static-libstdc++
g++ -Os -fdata-sections -ffunction-sections -fwhole-program -Wl,--gc-sections -Wl,--strip-all -m64 -mconsole -I.. -DDIC_VERSION=$DIC_VERSION -DMECAB_DEFAULT_RC="$MECAB_DEFAULT_RC" -DHAVE_CONFIG_H -Wfatal-errors mecab-dict-index.cpp libmecab.dll -o mecab-dict-index.exe -static -static-libgcc -static-libstdc++
g++ -Os -fdata-sections -ffunction-sections -fwhole-program -Wl,--gc-sections -Wl,--strip-all -m64 -mconsole -I.. -DDIC_VERSION=$DIC_VERSION -DMECAB_DEFAULT_RC="$MECAB_DEFAULT_RC" -DHAVE_CONFIG_H -Wfatal-errors mecab-dict-gen.cpp libmecab.dll -o mecab-dict-gen.exe -static -static-libgcc -static-libstdc++
g++ -Os -fdata-sections -ffunction-sections -fwhole-program -Wl,--gc-sections -Wl,--strip-all -m64 -mconsole -I.. -DDIC_VERSION=$DIC_VERSION -DMECAB_DEFAULT_RC="$MECAB_DEFAULT_RC" -DHAVE_CONFIG_H -Wfatal-errors mecab-cost-train.cpp libmecab.dll -o mecab-cost-train.exe -static -static-libgcc -static-libstdc++
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment