Opened 4 years ago

Closed 4 years ago

#62187 closed defect (invalid)

freetype @2.10.4: fatal error: 'ft2build.h' file not found

Reported by: nsklaus (nsklaus) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: Cc:
Port: freetype

Description (last modified by nsklaus (nsklaus))

i'm trying to compile two projects: wine and dwm both suffer from the same problem, they have trouble locating freetype files.

here trying to compile dwm:

-> dwm $ sudo port install freetype
Password:
--->  Computing dependencies for freetype
--->  Cleaning freetype
--->  Scanning binaries for linking errors
--->  No broken files found.
--->  No broken ports found.
-> dwm $
-> dwm $ pwd
/Users/klaus/Sources/dwm
-> dwm $ make
dwm build options:
CFLAGS   = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/X11R6/include -I/usr/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION="6.2" -DXINERAMA
LDFLAGS  = -L/usr/X11R6/lib -lX11 -lXinerama -lfontconfig -lXft -lX11-xcb -lxcb -lxcb-res
CC       = cc
cc -c -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os -I/usr/X11R6/include -I/usr/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"6.2\" -DXINERAMA drw.c
In file included from drw.c:6:
/usr/X11R6/include/X11/Xft/Xft.h:40:10: fatal error: 'ft2build.h' file not found
#include <ft2build.h>
         ^~~~~~~~~~~~
1 error generated.
make: *** [drw.o] Error 1
?2 dwm $ l /opt/local/include/freetype2/
/opt/local/include/freetype2/
[1.5K]  freetype
[ 990]  ft2build.h

1 directory, 1 file
-> dwm $

as for wine, i con configure and make it. no errors. freetype support is found during the ./configure. in the end when wine is built, i try to run it with: ./wine64 winecfg and there it complains it cannot find freetype support.. here's the output:

-> wine-6.1 $ ./wine64 notepad
Wine cannot find the FreeType font library.  To enable Wine to
use TrueType fonts please install a version of FreeType greater than
or equal to 2.0.5.
http://www.freetype.org

i'm on macos 11.2 rc, arm64 arch, but i run everything through rosetta2 (start term with rosetta2) so it's all x86_64 env.

Change History (4)

comment:1 Changed 4 years ago by nsklaus (nsklaus)

Description: modified (diff)

comment:2 Changed 4 years ago by jmroot (Joshua Root)

Keywords: freetype removed
Owner: set to ryandesign
Port: freetype added
Status: newassigned

comment:3 Changed 4 years ago by nsklaus (nsklaus)

maybe i submitted this ticket too quickly. dwm is a thrid party app, and it has no knowledge of macport, it just expected to find includes files where they are supposed to be on a linux system. i was able to build dwm by modifying config.mk to change the include path:

FREETYPEINC = /opt/local/include/freetype2

instead of originaly:

FREETYPEINC = /usr/include/freetype2

i have no idea about wine yet though.

comment:4 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: invalid
Status: assignedclosed

wine is available in MacPorts and builds fine. It is out of date but I will update it eventually. dwm is not but you could submit a portfile for it if you like.

Anytime you build software outside of MacPorts using MacPorts libraries and headers, you'll need to tell it how to find the MacPorts files. You'll have to consult the documentation of each project to find out how to do that. (And of course the whole point of MacPorts is to offer easy-to-install packages where someone has already figured those details out for you.) Some build systems use pkg-config to find dependencies, in which case they should be able to find MacPorts files automatically; this may be the case for wine. If they don't, often adding -I/opt/local/include to CPPFLAGS and -L/opt/local/lib to LDFLAGS is enough (i.e. CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" ./configure). In the case of dwm, which I'm guessing doesn't have a configure script, it sounds like they've made the provision for you to specify FREETYPEINC on the command line to locate the headers (i.e. make FREETYPEINC=/opt/local/include/freetype2). You may need to do something similar to locate the library. Or if they do have a configure script, look at the output of ./configure --help to discover if they offer any options for specifying the location of dependencies' files.

Note: See TracTickets for help on using tickets.