[GNC-dev] Various failures while building MacOS/Quartz from source
john
jralls at ceridwen.us
Sun Nov 6 10:15:35 EST 2022
> On Nov 5, 2022, at 2:21 AM, Jim DeLaHunt <list+gnucash at jdlh.com> wrote:
>
> On 2022-11-04 13:44, john wrote:
>
>> On Nov 4, 2022, at 12:27 AM, Jim DeLaHunt <list+gnucash at jdlh.com> wrote:
>>> % pkg-config --print-errors --exists freetype2
>>> Package libbrotlidec was not found in the pkg-config search path.
>>> Perhaps you should add the directory containing `libbrotlidec.pc'
>>> to the PKG_CONFIG_PATH environment variable
>>> Package 'libbrotlidec', required by 'freetype2', not found
>>>
>> Aha! Another gtk-osx user experienced that failure a couple of weeks ago [1]. You have libbrotli installed somewhere outside of /Users/gtkdeveloper/gnucash that Cmake can find it and pkg-config can't. That makes meson decide that it can't use that freetype to build harfbuzz so it ignores it and builds harfbuzz without freetype.
>>
>> Add
>> module_cmakeargs['freetype']="-DFT_DISABLE_BROTLI=YES"
>> module_cmakeargs['freetype-no-harfbuzz']="-DFT_DISABLE_BROTLI=YES"
>>
>> to /Users/gtkdeveloper/.config/jhbuildrc-custom and run
>> jhbuild buildone -fc freetype-no-harfbuzz
>> jhbuild build
>>
>> I just pushed a commit to gtk-osx to make Harfbuzz fail immediately if it's unhappy with Freetype for some reason. That should make troubleshooting this kind of problem a little quicker.
>
> Thank you. That got me a step further.
>
> freetype-no-harfbuzz now compiles happily, but harfbuzz-no-cairo seems to be unhappy about freetype's lack of libbrotlidec in the same way:
>
> =====
>
> *** Configuring harfbuzz-no-cairo *** [2/2]
> The Meson build system
> Version: 0.63.3
> Source dir: /Users/gtkdeveloper/gnucash/src/harfbuzz-4.1.0
> Build dir: /Users/gtkdeveloper/gnucash/build/harfbuzz-4.1.0
> Build type: native build
> Project name: harfbuzz
> Project version: 4.1.0
> C compiler for the host machine: /Library/Developer/CommandLineTools/usr/bin/gcc (clang 14.0.0 "Apple clang version 14.0.0 (clang-1400.0.29.202)")
> C linker for the host machine: /Library/Developer/CommandLineTools/usr/bin/gcc ld64 820.1
> C++ compiler for the host machine: /Library/Developer/CommandLineTools/usr/bin/g++ (clang 14.0.0 "Apple clang version 14.0.0 (clang-1400.0.29.202)")
> C++ linker for the host machine: /Library/Developer/CommandLineTools/usr/bin/g++ ld64 820.1
> Host machine cpu family: aarch64
> Host machine cpu: arm64
> Compiler for C++ supports link arguments -Bsymbolic-functions: YES
> Compiler for C++ supports arguments -fno-exceptions: YES
> Compiler for C++ supports arguments -fno-rtti: YES
> Compiler for C++ supports arguments -fno-threadsafe-statics: YES
> Compiler for C++ supports arguments -fvisibility-inlines-hidden: YES
> Library m found: YES
> Found pkg-config: /Users/gtkdeveloper/gnucash/inst/bin/pkg-config (0.29.2)
> Found CMake: /Users/gtkdeveloper/gnucash/inst/bin/cmake (3.20.0)
> Run-time dependency freetype2 found: NO (tried pkgconfig, framework and cmake)
> Not looking for a fallback subproject for the dependency freetype2 because:
> Use of fallback dependencies is disabled.
>
> ../../src/harfbuzz-4.1.0/meson.build:87:0: ERROR: Dependency 'freetype2' is required but not found.
>
> A full log can be found at /Users/gtkdeveloper/gnucash/build/harfbuzz-4.1.0/meson-logs/meson-log.txt
> meson --prefix /Users/gtkdeveloper/gnucash/inst --libdir lib -Dcoretext=enabled -Dfreetype=enabled -Ddocs=disabled -Dbenchmark=disabled -Dintrospection=disabled --wrap-mode=nofallback /Users/gtkdeveloper/gnucash/src/harfbuzz-4.1.0
> *** Error during phase configure of harfbuzz-no-cairo: ########## Error running meson --prefix /Users/gtkdeveloper/gnucash/inst --libdir lib -Dcoretext=enabled -Dfreetype=enabled -Ddocs=disabled -Dbenchmark=disabled -Dintrospection=disabled --wrap-mode=nofallback /Users/gtkdeveloper/gnucash/src/harfbuzz-4.1.0 *** [2/2]
>
> =====
>
> The relevant part of meson-log.txt seems to say:
>
> =====
>
> Pkg-config binary for 1 is not cached.
> Pkg-config binary missing from cross or native file, or env var undefined.
> Trying a default Pkg-config fallback at pkg-config
> Found pkg-config: /Users/gtkdeveloper/gnucash/inst/bin/pkg-config (0.29.2)
> Determining dependency 'freetype2' with pkg-config executable '/Users/gtkdeveloper/gnucash/inst/bin/pkg-config'
> env[PKG_CONFIG_PATH]: /Users/gtkdeveloper/gnucash/inst/lib/pkgconfig:/Users/gtkdeveloper/gnucash/inst/share/pkgconfig:/usr/lib/pkgconfig
> Called `/Users/gtkdeveloper/gnucash/inst/bin/pkg-config --modversion freetype2` -> 0
> 24.1.18
> env[PKG_CONFIG_PATH]: /Users/gtkdeveloper/gnucash/inst/lib/pkgconfig:/Users/gtkdeveloper/gnucash/inst/share/pkgconfig:/usr/lib/pkgconfig
> Called `/Users/gtkdeveloper/gnucash/inst/bin/pkg-config --cflags freetype2` -> 1
>
> pkg-config error with 'freetype2': Could not generate cargs for freetype2:
> Package libbrotlidec was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libbrotlidec.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'libbrotlidec', required by 'freetype2', not found
>
> Finding framework path by running: /Library/Developer/CommandLineTools/usr/bin/g++ -v -E - -arch arm64 -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=12 -I/Users/gtkdeveloper/gnucash/inst/include -arch arm64 -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
>
> Looking for framework freetype2 in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks
> CMake binary for 1 is not cached
> CMake binary missing from cross or native file, or env var undefined.
> Trying a default CMake fallback at cmake
> Found CMake: /Users/gtkdeveloper/gnucash/inst/bin/cmake (3.20.0)
> Extracting basic cmake information
> CMake Toolchain: Calling CMake once to generate the compiler state
> Calling CMake (['/Users/gtkdeveloper/gnucash/inst/bin/cmake']) in /Users/gtkdeveloper/gnucash/build/harfbuzz-4.1.0/meson-private/__CMake_compiler_info__ with:
> - "--trace-expand"
> - "--trace-format=json-v1"
> - "--no-warn-unused-cli"
> - "--trace-redirect=cmake_trace.txt"
> - "-G"
> - "Ninja"
> - "-DCMAKE_TOOLCHAIN_FILE=/Users/gtkdeveloper/gnucash/build/harfbuzz-4.1.0/meson-private/__CMake_compiler_info__/CMakeMesonTempToolchainFile.cmake"
> - "."
> - "-DCMAKE_PREFIX_PATH=/Users/gtkdeveloper/gnucash/inst;/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr"
> Try CMake generator: auto
> Calling CMake (['/Users/gtkdeveloper/gnucash/inst/bin/cmake']) in /Users/gtkdeveloper/gnucash/build/harfbuzz-4.1.0/meson-private/cmake_freetype2 with:
> - "--trace-expand"
> - "--trace-format=json-v1"
> - "--no-warn-unused-cli"
> - "--trace-redirect=cmake_trace.txt"
> - "-DCMAKE_TOOLCHAIN_FILE=/Users/gtkdeveloper/gnucash/build/harfbuzz-4.1.0/meson-private/cmake_freetype2/CMakeMesonToolchainFile.cmake"
> - "."
> - "-DCMAKE_PREFIX_PATH=/Users/gtkdeveloper/gnucash/inst;/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr"
> -- Module search paths: ['/', '/Applications', '/Library/Developer/CommandLineTools/Library/Frameworks', '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks', '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr', '/Library/Frameworks', '/System/Library/Frameworks', '/Users/gtkdeveloper/gnucash/inst', '/opt', '/opt/local', '/usr', '/usr/local']
> -- CMake root: /Users/gtkdeveloper/gnucash/inst/share/cmake-3.20
> -- CMake architectures: []
> -- CMake lib search paths: ['lib', 'lib32', 'lib64', 'libx32', 'share']
> Preliminary CMake check failed. Aborting.
> Run-time dependency freetype2 found: NO (tried pkgconfig, framework and cmake)
> Not looking for a fallback subproject for the dependency freetype2 because:
> Use of fallback dependencies is disabled.
>
> ../../src/harfbuzz-4.1.0/meson.build:87:0: ERROR: Dependency 'freetype2' is required but not found.
>
> =====
>
> Like a good script kiddie, I tried adding to jhbuildrc-custom a line:
> module_cmakeargs['harfbuzz-no-cairo']="-DFT_DISABLE_BROTLI=YES"
>
> ... and cleaning and remaking harfbuzz-no-cairo, but it had no effect.
>
> By the way, in the CMake part of the meson-log above, I see a mention of the path /opt/local . It turns out that I do have an /opt/local/lib/libbrotlidec*.dylib and /opt/local/lib/pkgconfig/libbrotlidec.pc, installed there by MacPorts port "brotli". If Cmake looks for libraries in /opt/local, maybe it found that.
>
> Thank you for your help, John. If I may continue to impose, and ideas for a next step?
Well, to begin with I told you to
>>
>> Add
>> module_cmakeargs['freetype']="-DFT_DISABLE_BROTLI=YES"
>> module_cmakeargs['freetype-no-harfbuzz']="-DFT_DISABLE_BROTLI=YES"
and rebuild freetype-no-harfbuzz. Rebuilding Harfbuzz isn't going to get rid of Freetype's dependency on brotli. Harfbuz doesn't know anything about broil.
BTW, you may need to delete CMakeCache.txt from the freetype build directory to get cmake to recognize the new option.
On the other hand, you're likely to have other, more subtle problems with MacPorts libraries contaminating your build. That's why https://wiki.gnome.org/Projects/GTK/OSX/Building#Prerequisites says, in bold italic Mixing HomeBrew, MacPorts, or Fink and GTK-OSX will fail. If you have created a separate user for jhbuild and it's still finding MacPorts stuff tell me and I'll remove the sentence just before that about creating a separate user; it means that MacPorts metastasizes more deeply than I thought.
One more thing: WebKit doesn't work when built on M1 with macOS 12, it sets the wrong path to its plugins and can't find them. That means that your GnuCash build won't be able to display reports. You can work around that by exporting the report to a file and opening it with your browser of choice.
Regards,
John Ralls
More information about the gnucash-devel
mailing list