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 下 build 时出错 #24

Open
iCasture opened this issue Dec 27, 2024 · 0 comments
Open

macOS 下 build 时出错 #24

iCasture opened this issue Dec 27, 2024 · 0 comments

Comments

@iCasture
Copy link

Hi,

目前的版本在 macOS 下,无论是仅安装 pypinyin 还是同时安装 pypinyin & cpp-pinyin,在 build 时都会报错:

pinyin.cc:33:10: fatal error: 'cpp-pinyin/G2pglobal.h' file not found
   33 | #include <cpp-pinyin/G2pglobal.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [pinyin..o] Error 1
make[2]: *** [modules] Error 1
make[1]: *** [modules] Error 2
make: *** [all] Error 2

cpp-pinyin 是通过 vcpkg 安装的:

$ vcpkg install cpp-pinyin

Computing installation plan...
The following packages are already installed:
    cpp-pinyin:[email protected]
cpp-pinyin:arm64-osx is already installed
Total install time: 5.12 us
cpp-pinyin provides CMake targets:

  find_package(cpp-pinyin CONFIG REQUIRED)
  target_link_libraries(main PRIVATE cpp-pinyin::cpp-pinyin)

To use the library, you need to copy the dictionary files to the binary directory.

  add_custom_command(TARGET main POST_BUILD
      COMMAND "${CMAKE_COMMAND}" -E copy_directory
        "${cpp-pinyin_DIR}/dict"
        "$<TARGET_FILE_DIR:main>/dict"
  )

请问如何解决?

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