Skip to content

macOS build error - fontconfig.h file not found #135

@joewiz

Description

@joewiz

After performing the build steps described in the README, I encountered the following error with the make command:

joe@choskimac-iii workspace % git clone https://github.com/kermitt2/pdfalto.git && cd pdfalto
Cloning into 'pdfalto'...
remote: Enumerating objects: 2905, done.
remote: Counting objects: 100% (572/572), done.
remote: Compressing objects: 100% (327/327), done.
remote: Total 2905 (delta 346), reused 451 (delta 239), pack-reused 2333
Receiving objects: 100% (2905/2905), 62.02 MiB | 10.84 MiB/s, done.
Resolving deltas: 100% (1347/1347), done.

joe@choskimac-iii pdfalto % git submodule update --init --recursive
Submodule 'xpdf-4.03' (git@github.com:kermitt2/xpdf-4.03.git) registered for path 'xpdf-4.03'
Cloning into '/Users/joe/workspace/pdfalto/xpdf-4.03'...
Submodule path 'xpdf-4.03': checked out 'd1d1fe28e267911a8e5a8b51b9ebde250a7d70e7'

joe@choskimac-iii pdfalto % cmake .
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found fontconfig
Using macos settings.
++ 64 bit architecture
CMake Deprecation Warning at xpdf-4.03/CMakeLists.txt:11 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Looking for mkstemp
-- Looking for mkstemp - found
-- Looking for mkstemps
-- Looking for mkstemps - found
-- Looking for popen
-- Looking for popen - found
-- Performing Test HAVE_STD_SORT
-- Performing Test HAVE_STD_SORT - Success
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for fseek64
-- Looking for fseek64 - not found
-- Looking for _fseeki64
-- Looking for _fseeki64 - not found
-- Found FreeType (old-style includes): /Users/joe/workspace/pdfalto/libs/freetype/mac/64/libfreetype.a
-- Found fontconfig
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/joe/workspace/pdfalto

joe@choskimac-iii pdfalto % make
[  1%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/AcroForm.cc.o
[  2%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/Annot.cc.o
[  2%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/Array.cc.o
[  3%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/BuiltinFont.cc.o
[  4%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/BuiltinFontTables.cc.o
[  5%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/Catalog.cc.o
[  5%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/CharCodeToUnicode.cc.o
[  6%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/CMap.cc.o
[  7%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/Decrypt.cc.o
[  8%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/Dict.cc.o
[  8%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/DisplayState.cc.o
[  9%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/Error.cc.o
[ 10%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/FontEncodingTables.cc.o
[ 11%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/Function.cc.o
[ 11%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/Gfx.cc.o
[ 12%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/GfxFont.cc.o
[ 13%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/GfxState.cc.o
[ 14%] Building CXX object xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/GlobalParams.cc.o
/Users/joe/workspace/pdfalto/xpdf-4.03/xpdf/GlobalParams.cc:27:12: fatal error: 'fontconfig/fontconfig.h' file not found
#  include <fontconfig/fontconfig.h>
           ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/GlobalParams.cc.o] Error 1
make[1]: *** [xpdf-4.03/xpdf/CMakeFiles/xpdf.dir/all] Error 2
make: *** [all] Error 2

Could anyone suggest a workaround for this issue?

I'm running macOS 12 on an Intel-based iMac, with the following versions of the required dependencies:

joe@choskimac-iii pdfalto % clang -v
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

joe@choskimac-iii pdfalto % gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

joe@choskimac-iii pdfalto % cmake --version
cmake version 3.22.0

CMake suite maintained and supported by Kitware (kitware.com/cmake).

joe@choskimac-iii pdfalto % wget -V
GNU Wget 1.21.2 built on darwin20.4.0.

I'd be happy to provide any other needed information.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions