Skip to content

Instantly share code, notes, and snippets.

@chezou
Last active November 22, 2018 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chezou/65a92c0a56691997917e01eb4d503e11 to your computer and use it in GitHub Desktop.
Save chezou/65a92c0a56691997917e01eb4d503e11 to your computer and use it in GitHub Desktop.
mecab windows 64 bit build failure
C:\Users\chezo\source\mecab\mecab\src>nmake -f Makefile.msvc
Microsoft(R) Program Maintenance Utility Version 14.16.27023.1
Copyright (C) Microsoft Corporation. All rights reserved.
cl.exe /EHsc /O2 /GL /GA /Ob2 /nologo /W3 /MT /Zi /wd4800 /wd4305 /wd4244 -I. -I.. -D_CRT_SECURE_NO_DEPRECATE -DMECAB_USE_THREAD -DDLL_EXPORT -DHAVE_GETENV -DHAVE_WINDOWS_H -DDIC_VERSION=@DIC_VERSION@ -DVERSION="\"@VERSION@\"" -DPACKAGE="\"mecab\"" -DUNICODE -D_UNICODE -DMECAB_DEFAULT_RC="\"c:\\Program Files\\mecab\\etc\\mecabrc\"" -c feature_index.cpp
feature_index.cpp
feature_index.cpp(80): error C3861: 'WPATH_FORCE': 識別子が見つかりませんでした
feature_index.cpp(356): error C2593: 'operator <<' があいまいです。
c:\users\chezo\source\mecab\mecab\src\string_buffer.h(55): note: 'MeCab::StringBuffer &MeCab::StringBuffer::operator <<(unsigned char)' の可能性があります
c:\users\chezo\source\mecab\mecab\src\string_buffer.h(51): note: または 'MeCab::StringBuffer &MeCab::StringBuffer::operator <<(char)'
c:\users\chezo\source\mecab\mecab\src\string_buffer.h(46): note: または 'MeCab::StringBuffer &MeCab::StringBuffer::operator <<(unsigned long)'
c:\users\chezo\source\mecab\mecab\src\string_buffer.h(45): note: または 'MeCab::StringBuffer &MeCab::StringBuffer::operator <<(unsigned int)'
c:\users\chezo\source\mecab\mecab\src\string_buffer.h(44): note: または 'MeCab::StringBuffer &MeCab::StringBuffer::operator <<(unsigned short)'
c:\users\chezo\source\mecab\mecab\src\string_buffer.h(43): note: または 'MeCab::StringBuffer &MeCab::StringBuffer::operator <<(long)'
c:\users\chezo\source\mecab\mecab\src\string_buffer.h(42): note: または 'MeCab::StringBuffer &MeCab::StringBuffer::operator <<(int)'
c:\users\chezo\source\mecab\mecab\src\string_buffer.h(41): note: または 'MeCab::StringBuffer &MeCab::StringBuffer::operator <<(short)'
c:\users\chezo\source\mecab\mecab\src\string_buffer.h(40): note: または 'MeCab::StringBuffer &MeCab::StringBuffer::operator <<(double)'
feature_index.cpp(356): note: 引数リスト '(MeCab::StringBuffer, size_t)' を一致させようとしているとき
feature_index.cpp(454): warning C4267: 'return': 'size_t' から 'int' に変換しました。データが失われているかもしれません。
feature_index.cpp(532): error C3861: 'WPATH_FORCE': 識別子が見つかりませんでした
feature_index.cpp(540): error C3861: 'WPATH_FORCE': 識別子が見つかりませんでした
feature_index.cpp(621): error C3861: 'WPATH_FORCE': 識別子が見つかりませんでした
feature_index.cpp(672): error C3861: 'WPATH_FORCE': 識別子が見つかりませんでした
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.exe"' : リターン コード '0x2'
Stop.
diff --git a/mecab/src/Makefile.msvc.in b/mecab/src/Makefile.msvc.in
index 7d10a5e..8ba6383 100644
--- a/mecab/src/Makefile.msvc.in
+++ b/mecab/src/Makefile.msvc.in
@@ -3,7 +3,7 @@ CXXC = cl.exe
LINK=link.exe
CFLAGS = /EHsc /O2 /GL /GA /Ob2 /nologo /W3 /MT /Zi /wd4800 /wd4305 /wd4244
-LDFLAGS = /nologo /OPT:REF /OPT:ICF /LTCG /NXCOMPAT /DYNAMICBASE /MACHINE:X86 ADVAPI32.LIB
+LDFLAGS = /nologo /OPT:REF /OPT:ICF /LTCG /NXCOMPAT /DYNAMICBASE /MACHINE:X64 ADVAPI32.LIB
DEFS = -D_CRT_SECURE_NO_DEPRECATE -DMECAB_USE_THREAD \
- -DDLL_EXPORT -DHAVE_GETENV -DHAVE_WINDOWS_H -DDIC_VERSION=@DIC_VERSION@ \
- -DVERSION="\"@VERSION@\"" -DPACKAGE="\"mecab\"" \
+ -DDLL_EXPORT -DHAVE_GETENV -DHAVE_WINDOWS_H -DDIC_VERSION=102 \
+ -DVERSION="\"0.996\"" -DPACKAGE="\"mecab\"" \
diff --git a/mecab/src/common.h b/mecab/src/common.h
index d1fc459..201f73c 100644
--- a/mecab/src/common.h
+++ b/mecab/src/common.h
@@ -26,6 +26,7 @@
#if defined(_MSC_VER) || defined(__CYGWIN__)
#define NOMINMAX
#define snprintf _snprintf
+#include <iterator>
#endif
#define COPYRIGHT "MeCab: Yet Another Part-of-Speech and Morphological Analyzer\n\
@@ -86,7 +87,12 @@
#define WPATH_FORCE(path) (MeCab::Utf8ToWide(path).c_str())
#define WPATH(path) (path)
#else
+#ifdef __MINGW32__
#define WPATH(path) WPATH_FORCE(path)
+#else
+#define WPATH_FORCE(path) (MeCab::Utf8ToWide(path).c_str())
+#define WPATH(path) (path)
+#endif
#endif
#else
#define WPATH_FORCE(path) (path)
diff --git a/mecab/src/feature_index.cpp b/mecab/src/feature_index.cpp
index 051bdf8..623da17 100644
--- a/mecab/src/feature_index.cpp
+++ b/mecab/src/feature_index.cpp
@@ -353,7 +353,7 @@ bool FeatureIndex::buildUnigramFeature(LearnerPath *path,
if (!r) goto NEXT;
os_ << r;
} break;
- case 't': os_ << (size_t)path->rnode->char_type; break;
+ case 't': os_ << (unsigned int)path->rnode->char_type; break;
case 'u': os_ << ufeature; break;
case 'w':
if (path->rnode->stat == MECAB_NOR_NODE) {
diff --git a/mecab/src/writer.cpp b/mecab/src/writer.cpp
index 0ef6975..9adf020 100644
--- a/mecab/src/writer.cpp
+++ b/mecab/src/writer.cpp
@@ -257,7 +257,7 @@ bool Writer::writeNode(Lattice *lattice,
// input sentence
case 'S': os->write(lattice->sentence(), lattice->size()); break;
// sentence length
- case 'L': *os << lattice->size(); break;
+ case 'L': *os << (unsigned int)lattice->size(); break;
// morph
case 'm': os->write(node->surface, node->length); break;
case 'M': os->write(reinterpret_cast<const char *>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment