NetBSD Problem Report #56004

From www@netbsd.org  Sun Feb 21 23:11:48 2021
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 1F76B1A921F
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 21 Feb 2021 23:11:48 +0000 (UTC)
Message-Id: <20210221231146.A00991A923A@mollari.NetBSD.org>
Date: Sun, 21 Feb 2021 23:11:46 +0000 (UTC)
From: bapabooiee@gmail.com
Reply-To: bapabooiee@gmail.com
To: gnats-bugs@NetBSD.org
Subject: print/poppler: [macOS Big Sur] fails to build due to not being able to locate freetype2 headers/libs in .buildlink dir
X-Send-Pr-Version: www-1.0

>Number:         56004
>Category:       pkg
>Synopsis:       print/poppler: [macOS Big Sur] fails to build due to not being able to locate freetype2 headers/libs in .buildlink dir
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 21 23:15:01 +0000 2021
>Closed-Date:    Sun Jun 27 19:39:15 +0000 2021
>Last-Modified:  Sun Jun 27 19:39:15 +0000 2021
>Originator:     Dean Matzkov
>Release:        pkgsrc-2020Q4
>Organization:
>Environment:
Darwin MBP.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
>Description:
When attempting to build graphics/poppler on macOS Big Sur, the build fails due to not being able to locate ft2build.h:

---SNIP---
[ 76%] Building CXX object CMakeFiles/poppler.dir/splash/SplashFontEngine.cc.o
/Volumes/Devel/pkgscrc_stuff/work/2020Q4/print/poppler/work.x86_64/poppler-20.11.0/splash/SplashFTFont.cc:30:10: fatal error: 'ft2build.h' file not found
#include <ft2build.h>
         ^~~~~~~~~~~~
1 error generated.
---/SNIP---


I don't know much about how the BuildLink framework works, so I can only speculate, but this seems to be because the pkgsrc build system elected to use the macOS-supplied headers and *.dylib files (commonly found in /opt/X11) but for some reason did not place symlinks for them in $WORK/.buidlink/{include,lib}.

Manually creating symlinks of the relevant files in /opt/X11/include/freetype/ and /opt/X11/lib/libfreetype.dylib and placing them into $WORK/.buildlink/{include,lib} fixed the build for me and allowed poppler to install successfully, with libpoppler.dylib indeed being linked against /opt/X11/lib/libfreetype.6.dylib.



Here are some snippets from the CMake configure phase and .configure_makevars.mk:


CMake configure:
---SNIP---
- Found Freetype: /opt/pkg/lib/libfreetype.dylib (found version "2.10.4")
-- Checking for module 'fontconfig'
--   Package 'freetype2', required by 'fontconfig', not found
-- Found Fontconfig: /Volumes/Devel/pkgscrc_stuff/work/2020Q4/print/poppler/work.x86_64/.buildlink/lib/libfontconfig.dylib
-- Found JPEG: /Volumes/Devel/pkgscrc_stuff/work/2020Q4/print/poppler/work.x86_64/.buildlink/lib/libjpeg.dylib (found version "80")
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Found PNG: /Volumes/Devel/pkgscrc_stuff/work/2020Q4/print/poppler/work.x86_64/.buildlink/lib/libpng16.dylib (found version "1.4.12")
-- Found TIFF: /Volumes/Devel/pkgscrc_stuff/work/2020Q4/print/poppler/work.x86_64/.buildlink/lib/libtiff.dylib (found version "4.0.8")
-- Checking for module 'nss>=3.19'
--   Found nss, version 3.60.0
-- Found NSS3: nss3;smime3;ssl3;softokn3;nssutil3;plds4;plc4;nspr4;pthread
-- Package Qt6Core or Qt6Gui or Qt6Widgets or Qt6Test not found
-- Checking for module 'cairo>=1.10.0'
--   Found cairo, version 1.16.0
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
Package 'freetype2', required by 'fontconfig', not found
Package 'freetype2', required by 'cairo', not found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
Package 'freetype2', required by 'fontconfig', not found
Package 'freetype2', required by 'cairo', not found
---/SNIP---



.configure_makevars.mk:
---SNIP---
_MAKEVARS_MK=	defined

BUILDLINK_PREFIX.freetype2=	/opt/X11
BUILTIN_PKG.freetype2=	freetype2-2.10.4
H_FREETYPE2=	/opt/X11/include/freetype2/freetype/freetype.h
IS_BUILTIN.freetype2=	yes
PKG_BUILD_OPTIONS.freetype2=	
USE_BUILTIN.freetype2=	yes
---/SNIP---


I hope the information here is useful. Thanks. 
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: "Dean M." <bapabooiee@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/56004
Date: Mon, 22 Feb 2021 00:54:39 -0700

 Update: So I think this may have been a problem with the latest
 release of XQuartz (XQuartz is an X11 Server and accompanying
 files/libs/headers for non-native macOS apps, which usually sits in
 /opt/X11) which came out recently - namely XQuartz 2.8.0_beta4.

 I've downgraded to XQuartz 2.7.11 and now all my FreeType2-related
 build errors in all my packages have disappeared. I am not sure why
 this may have happened, though, since all the libraries/headers and
 pkgconfig files seemed to have worked correctly when experimenting
 with FreeType2 outside of pkgsrc.

 I do believe it may be advisable to close this PR due to the latest
 release I had installed being a beta. I may report back with an update
 once a stable version of XQuartz 2.8.x is released.

 Thanks.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 27 Jun 2021 19:39:15 +0000
State-Changed-Why:
Withdrawn by submitter (in February)

At a guess: did you remember to rebuild x11-links after updating XQuartz?
If not, that would almost certainly explain it...


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.