找不到以下ICU库:-i18n(必需)

时间:2018-09-26 05:26:26

标签: cmake homebrew

我必须构建miktex源代码。我从github安装源代码,他们给了我构建链接:https://miktex.org/howto/build-mac

我按照链接中给出的步骤进行操作。当我跑步时

cmake ../source

我遇到错误:

INFOfribidi libs: /usr/local/Cellar/fribidi/1.0.5/lib/libfribidi.dylib
INFOfribidi incs:
/usr/local/Cellar/fribidi/1.0.5/include/fribidi;/usr/local/Cellar/fribidi/1.0.5/include
-- The following ICU libraries were not found:
--   i18n (required)
--   uc (required)
CMake Error at /usr/local/Cellar/cmake/3.12.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
    Failed to find all ICU components (missing: ICU_INCLUDE_DIR ICU_LIBRARY _ICU_REQUIRED_LIBS_FOUND)
Call Stack (most recent call first):  
  /usr/local/Cellar/cmake/3.12.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)  
  /usr/local/Cellar/cmake/3.12.2/share/cmake/Modules/FindICU.cmake:317 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:1032 (find_package)
-- Configuring incomplete, errors occurred! See also "/Users/afnisaeed/Desktop/CMakeFiles/CMakeOutput.log".

其他信息

echo $CMAKE_PREFIX_PATH
/opt/icu4c:/opt/openssl:/opt/icu4c:/opt/qt:$ {brewprefix}/opt/icu4c:/opt/openssl:/opt/icu4c:/opt/qt:/usr/local/Cellar/qt5/5.7.0/

2 个答案:

答案 0 :(得分:1)

我对miktexfribidi一无所知,因此这可能毫无帮助,但是您的构建系统似乎很难找到与ICU相关的内容-不管是什么。

如果您运行:

brew info icu4c

它告诉您有关该软件包为“仅插入” 的全部信息,这意味着它提供的信息(标头和库)已安装,但没有其他软件包可以在哪里找到它。然后为您提供以下具体建议:

icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile

For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"

For pkg-config to find icu4c you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

因此,我怀疑您尚未完成最后两节,您需要执行以下操作:

export LDFLAGS="${LDFLAGS} -L/usr/local/opt/icu4c/lib"
export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/icu4c/include"
export PKG_CONFIG_PATH=/usr/local/opt/icu4c/lib/pkgconfig:"$PKG_CONFIG_PATH"

答案 1 :(得分:1)

我在 Mac 上尝试使用 find_package(ICU ...) 时遇到了同样的错误(通过 brew 安装了 ICU)。此错误似乎与 Mac 已经预装了 ICU(但并非所有组件)有关 - 这就是 CMake 抱怨缺少某些组件(ICU_INCLUDE_DIR、ICU_LIBRARY 等)的原因。 我的解决方案是在 CMakeLists.txt 中手动指定 ICU_ROOT 变量(将 CMake 定位到 brew 安装的 ICU 版本而不是 MacOS 预安装版本):

set (ICU_ROOT /usr/local/Cellar/icu4c/67.1)