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

Windows下msys编译失败的2个错误 #873

Open
lindeer opened this issue Jun 26, 2024 · 0 comments
Open

Windows下msys编译失败的2个错误 #873

lindeer opened this issue Jun 26, 2024 · 0 comments

Comments

@lindeer
Copy link
Contributor

lindeer commented Jun 26, 2024

msys: msys2-base-x86_64-20240507
gcc: 13.2.0
cmake: 3.30.0-rc4

$ cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release ..
$ cmake --build build --config Release --target Dictionaries
[ 57%] Linking CXX shared library msys-opencc-1.1.dll
[ 57%] Built target libopencc
[ 59%] Building CXX object src/tools/CMakeFiles/opencc_dict.dir/DictConverter.cpp.o
[ 61%] Linking CXX executable opencc_dict.exe
[ 61%] Built target opencc_dict
[ 62%] Building STCharacters.ocd2
D:/workspace/opencc-dart/src/build/src/tools/opencc_dict.exe: error while loading shared libraries: msys-opencc-1.1.dll: cannot open shared object file: No such file or directory
                                      make[3]: *** [data/CMakeFiles/Dictionaries.dir/build.make:124: data/STCharacters.ocd2] Error 127
make[2]: *** [CMakeFiles/Makefile2:1081: data/CMakeFiles/Dictionaries.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1088: data/CMakeFiles/Dictionaries.dir/rule] Error 2
make: *** [Makefile:628: Dictionaries] Error 2

在生成STCharacters.ocd2文件时失败了,但.dll文件已经生成,似乎是加载.dll文件时路径存在错误?

如果将target从Dictionaries改为opencc时,则报:

[ 30%] Built target marisa
[ 93%] Built target libopencc
[ 96%] Building CXX object src/tools/CMakeFiles/opencc.dir/CommandLine.cpp.o
/d/workspace/opencc-dart/src/src/tools/CommandLine.cpp: In function ‘void Convert(std::string)’:
/d/workspace/opencc-dart/src/src/tools/CommandLine.cpp:108:14: error: ‘mkstemp’ was not declared in this scope; did you mean ‘mkdtemp’?
  108 |     int fd = mkstemp(const_cast<char*>(tempFileName.c_str()));
      |              ^~~~~~~
      |              mkdtemp
make[3]: *** [src/tools/CMakeFiles/opencc.dir/build.make:76: src/tools/CMakeFiles/opencc.dir/CommandLine.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:1001: src/tools/CMakeFiles/opencc.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1008: src/tools/CMakeFiles/opencc.dir/rule] Error 2
make: *** [Makefile:589: opencc] Error 2

编译环境似乎被识别成Linux了,出现了linux上的mkstemp

@lindeer lindeer changed the title msys下编译失败的2个错误提示 Windows下msys编译失败的2个错误提示 Jun 27, 2024
@lindeer lindeer changed the title Windows下msys编译失败的2个错误提示 Windows下msys编译失败的2个错误 Jun 27, 2024
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

1 participant