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

如何在 macOS 中編譯 librime-charcode #386

Closed
markwu opened this issue Jul 14, 2020 · 8 comments
Closed

如何在 macOS 中編譯 librime-charcode #386

markwu opened this issue Jul 14, 2020 · 8 comments

Comments

@markwu
Copy link

markwu commented Jul 14, 2020

你好,請問如何在 macOS 中編譯 librime-charcode?看了 xcode.mk 內容,好像沒有定義。

@lotem
Copy link
Member

lotem commented Jul 14, 2020

參考 https://github.com/rime/librime/blob/master/README-mac.md
拆出這個插件主要是爲了避開在macOS上鏈接到本地ICU程序庫的問題。

@markwu
Copy link
Author

markwu commented Jul 15, 2020

我有看了,也都可以用 xcode/release-with-icu 編譯成功,並且編譯 squirrel 沒任何問題,但是就是不知道怎麼把 librime-charcode 加進來。

@lotem
Copy link
Member

lotem commented Jul 16, 2020

cd librime
git clone https://github.com/rime/librime-charcode.git plugins/charcode
make xcode/release-with-icu

@markwu
Copy link
Author

markwu commented Jul 16, 2020

好的,謝謝 @lotem,我馬上試試看。

@markwu
Copy link
Author

markwu commented Jul 16, 2020

出現錯誤訊息如下:

In file included from /Users/markwu/Temp/squirrel/librime/plugins/charcode/src/charcode_module.cc:6:
/Users/markwu/Temp/squirrel/librime/plugins/charcode/src/extended_charset_filter.h:21:44: error: only virtual member functions can be marked 'override'
  bool FilterCandidate(an<Candidate> cand) override;
                                           ^~~~~~~~

跟我之前用 ./install-plugin.sh rime/librime-charcode 後再 compile 的結果一樣。

PS. 我是用 homebrew 的 boost, version 1.72.0

@markwu
Copy link
Author

markwu commented Jul 16, 2020

我把

bool FilterCandidate(an<Candidate> cand) override;

改為

bool FilterCandidate(an<Candidate> cand);

也是不對。

Error messages 如下:

Ld build/lib/Release/librime.1.5.3.dylib normal x86_64
    cd /Users/markwu/Temp/squirrel/librime
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target x86_64-apple-macos10.14 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -L/Users/markwu/Temp/squirrel/librime/build/lib/Release -L/usr/local/lib/Release -L/usr/local/lib -L/Users/markwu/Temp/squirrel/librime/thirdparty/lib/Release -L/Users/markwu/Temp/squirrel/librime/thirdparty/lib -F/Users/markwu/Temp/squirrel/librime/build/lib/Release -filelist /Users/markwu/Temp/squirrel/librime/build/src/rime.build/Release/rime.build/Objects-normal/x86_64/rime.1.5.3.LinkFileList -install_name /librime.1.5.3.dylib -dynamiclib -Wl,-headerpad_max_install_names -install_name @rpath/librime.1.dylib /Users/markwu/Temp/squirrel/librime/build/plugins/charcode/rime.build/Release/rime-charcode-objs.build/Objects-normal/x86_64/charcode_module.o /Users/markwu/Temp/squirrel/librime/build/plugins/charcode/rime.build/Release/rime-charcode-objs.build/Objects-normal/x86_64/codepoint_translator.o /Users/markwu/Temp/squirrel/librime/build/plugins/charcode/rime.build/Release/rime-charcode-objs.build/Objects-normal/x86_64/extended_charset_filter.o /usr/local/lib/libboost_filesystem-mt.a /usr/local/lib/libboost_regex-mt.a /usr/local/lib/libboost_system-mt.a /usr/local/lib/libboost_locale-mt.a /Users/markwu/Temp/squirrel/librime/thirdparty/lib/libglog.a /Users/markwu/Temp/squirrel/librime/thirdparty/lib/libyaml-cpp.a /Users/markwu/Temp/squirrel/librime/thirdparty/lib/libleveldb.a /Users/markwu/Temp/squirrel/librime/thirdparty/lib/libmarisa.a /usr/lib/libiconv.dylib /usr/local/opt/icu4c/lib/libicuuc.dylib /Users/markwu/Temp/squirrel/librime/thirdparty/lib/libopencc.a /usr/local/lib/libboost_locale-mt.a /usr/local/lib/libboost_system-mt.a /usr/local/lib/libboost_chrono-mt.a /usr/local/lib/libboost_thread-mt.a /usr/lib/libiconv.dylib /usr/local/opt/icu4c/lib/libicuuc.dylib -compatibility_version 1.0.0 -current_version 1.5.3 -Xlinker -dependency_info -Xlinker /Users/markwu/Temp/squirrel/librime/build/src/rime.build/Release/rime.build/Objects-normal/x86_64/rime.1.5.3_dependency_info.dat -o /Users/markwu/Temp/squirrel/librime/build/lib/Release/librime.1.5.3.dylib
ld: warning: directory not found for option '-L/usr/local/lib/Release'
ld: warning: directory not found for option '-L/Users/markwu/Temp/squirrel/librime/thirdparty/lib/Release'
duplicate symbol 'rime::CodepointTranslator::Initialize()' in:
    /Users/markwu/Temp/squirrel/librime/build/src/rime.build/Release/rime.build/Objects-normal/x86_64/codepoint_translator.o
    /Users/markwu/Temp/squirrel/librime/build/plugins/charcode/rime.build/Release/rime-charcode-objs.build/Objects-normal/x86_64/codepoint_translator.o
duplicate symbol 'rime::CodepointTranslator::Query(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, rime::Segment const&)' in:
    /Users/markwu/Temp/squirrel/librime/build/src/rime.build/Release/rime.build/Objects-normal/x86_64/codepoint_translator.o
    /Users/markwu/Temp/squirrel/librime/build/plugins/charcode/rime.build/Release/rime-charcode-objs.build/Objects-normal/x86_64/codepoint_translator.o
duplicate symbol 'rime::CodepointTranslator::CodepointTranslator(rime::Ticket const&)' in:
    /Users/markwu/Temp/squirrel/librime/build/src/rime.build/Release/rime.build/Objects-normal/x86_64/codepoint_translator.o
    /Users/markwu/Temp/squirrel/librime/build/plugins/charcode/rime.build/Release/rime-charcode-objs.build/Objects-normal/x86_64/codepoint_translator.o
duplicate symbol 'rime::CodepointTranslator::CodepointTranslator(rime::Ticket const&)' in:
    /Users/markwu/Temp/squirrel/librime/build/src/rime.build/Release/rime.build/Objects-normal/x86_64/codepoint_translator.o
    /Users/markwu/Temp/squirrel/librime/build/plugins/charcode/rime.build/Release/rime-charcode-objs.build/Objects-normal/x86_64/codepoint_translator.o
duplicate symbol 'vtable for rime::CodepointTranslator' in:
    /Users/markwu/Temp/squirrel/librime/build/src/rime.build/Release/rime.build/Objects-normal/x86_64/codepoint_translator.o
    /Users/markwu/Temp/squirrel/librime/build/plugins/charcode/rime.build/Release/rime-charcode-objs.build/Objects-normal/x86_64/codepoint_translator.o
duplicate symbol 'typeinfo name for rime::CodepointTranslator' in:
    /Users/markwu/Temp/squirrel/librime/build/src/rime.build/Release/rime.build/Objects-normal/x86_64/codepoint_translator.o
    /Users/markwu/Temp/squirrel/librime/build/plugins/charcode/rime.build/Release/rime-charcode-objs.build/Objects-normal/x86_64/codepoint_translator.o
duplicate symbol 'typeinfo for rime::CodepointTranslator' in:
    /Users/markwu/Temp/squirrel/librime/build/src/rime.build/Release/rime.build/Objects-normal/x86_64/codepoint_translator.o
    /Users/markwu/Temp/squirrel/librime/build/plugins/charcode/rime.build/Release/rime-charcode-objs.build/Objects-normal/x86_64/codepoint_translator.o
ld: 7 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

** BUILD FAILED **

@markwu
Copy link
Author

markwu commented Jul 16, 2020

我發現問題了,因為我從 rime/squirrel checkout 下來,rime/librime 還在舊的分支,所以整個編譯步驟要做如下修改:

$ git clone --recurse-submodules https://github.com/rime/squirrel.git
$ cd squirrel/librime
$ git checkout master
$ git clone https://github.com/rime/librime-charcode.git plugins/charcode
$ make xcode/thirdparty
$ make xcode/release-with-icu
$ cd ..
$ make

這樣,就可以成功編譯出包含有 rime/librime-charcode 的 squirrel 了。

最後就可以用 $ make install 來安裝 squirrel 了。

@lotem
Copy link
Member

lotem commented Jul 17, 2020

注意只能在本機安裝使用。

@lotem lotem closed this as completed Jan 1, 2021
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

2 participants