9

I have to build miktex source code. I install source code from github they give me link to build it: https://miktex.org/howto/build-mac.

I follow the steps given in the link. When I run

cmake ../source

I got error:

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".

Extra information:

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/
Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
Afni Saeed
  • 113
  • 1
  • 1
  • 4
  • Have you set `CMAKE_PREFIX_PATH` variable as the guide suggests? What output of `echo $CMAKE_PREFIX_PATH`? – Tsyvarev Sep 26 '18 at 10:39
  • Please click `edit` under your question and add the information @Tsyvarev asked for. Thank you. – Mark Setchell Sep 26 '18 at 15:07
  • You seem to have lost most of the question. Do you want me to put it back how it was until 10 minutes ago? – Mark Setchell Sep 26 '18 at 15:27
  • Salmans-MBP:Desktop afnisaeed$ 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/ – Afni Saeed Sep 26 '18 at 15:30
  • i answered what @Tsyvarev asked so now what should i do...i am stuck from last 3 days on this line please help me what to do – Afni Saeed Sep 26 '18 at 15:32
  • yes put all the question back @MarkSetchell – Afni Saeed Sep 26 '18 at 15:33
  • 1
    You seem to have set the CMAKE_PREFIX_PATH incorrectly. It should look like `/usr/local/opt/icu4c:/usr/local/opt/openssl:/usr/local/opt/qt:/usr/local/Cellar/qt5/5.7.0` – Mark Setchell Sep 26 '18 at 15:38
  • so can you tell me how to set CMAKE_PREFIX_PATH because i followed all the step 3 times – Afni Saeed Sep 26 '18 at 16:22
  • What is output of `brew --prefix` on your machine? You need to perform `export CMAKE_PREFIX_PATH="${brewprefix}/opt/icu4c:${brewprefix}/opt/openssl:${brewprefix}/opt/icu4c:${brewprefix}/opt/qt:/usr/local/Cellar/qt5/5.7.0/"` with `${brewprefix}` replaced on that output. – Tsyvarev Sep 26 '18 at 16:46
  • Salmans-MBP:Desktop afnisaeed$ brew --prefix /usr/local – Afni Saeed Sep 26 '18 at 16:47
  • So you need to perform `export CMAKE_PREFIX_PATH="/usr/local/opt/icu4c:/usr/local/opt/openssl:/usr/local/opt/icu4c:${brewprefix}/opt/qt:/usr/local/Cellar/qt5/5.7.0/"`. – Tsyvarev Sep 26 '18 at 16:54
  • 1
    thank you soo much i done it ..... – Afni Saeed Sep 26 '18 at 17:47

3 Answers3

10

I know nothing at all about miktex or fribidi so this may not be of any assistance at all, however your build system seems to be having difficulty finding something to do with ICU - whatever that is.

If you run:

brew info icu4c

it tells you a whole load of stuff about the package being "keg-only" which means the stuff it provides (headers and libraries) is installed, but not where any other package will find it. Then it gives you the following specific advice:

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"

So, I suspect you have not done the last 2 sections, and you need to do something like:

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"
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • None of these variables will help `FindICU.cmake` script to locate ICU package (`PATH` affects only on executables, LDFLAGS affects only on the linker, PKG_CONFIG_PATH helps for pkg-config, but the "Find" script doesn't use it). The guide https://miktex.org/howto/build-mac followed by the asker notes about setting `CMAKE_PREFIX_PATH` variable, and this setting would actually help. – Tsyvarev Sep 26 '18 at 10:23
  • @Tsyvarev Ok, cool. Like I said, I know nothing about ICU, just a little about **homebrew** and was hoping that someone who does know about it would see something and realise what is going on. Sometimes you only know half the story, but if you *"put it out there"* someone else can add the other half. So, if you want to put what you are saying as an answer, I will happily upvote it! Thank you for sharing your knowledge. – Mark Setchell Sep 26 '18 at 10:31
  • Unfortunately, I know only "CMake part" of the story :) MacOS, homebrew, etc. are not things I familar with. – Tsyvarev Sep 26 '18 at 10:38
  • 1
    i have done these steps but still i am getting the error – Afni Saeed Sep 26 '18 at 14:40
5

I had the same error while trying to use find_package(ICU ...) on my Mac (installed ICU via brew). This error seems to be related to the fact the Mac already has ICU preinstalled (however not all of it's components) - that's why CMake complaints that some components are missing (ICU_INCLUDE_DIR, ICU_LIBRARY, ...). The solution for me was to manually specify the ICU_ROOT variable in CMakeLists.txt (which targets CMake to the brew-installed ICU version instead of MacOS preinstalled version):

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

victorm1710
  • 1,263
  • 14
  • 11
1

I solved this issue by installing the missing Debian package libicu-dev via:

apt-get install libicu-dev

Please note that this might also work for Ubuntu and its derivates.

Hagbard
  • 3,430
  • 5
  • 28
  • 64