Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > GD Library with Freetype2 installation issues

GD Library with Freetype2 installation issues
Thread Tools
jiveturkey
Fresh-Faced Recruit
Join Date: Nov 2011
Location: West of Chicago
Status: Offline
Reply With Quote
Nov 2, 2011, 10:27 PM
 
Hi All,

A little long winded but wanted want to have everything out there from the get go!

Trying to get the GD Library with Freetype2 set up to develop with PHP. Running Snow Leopard (10.6.8). As far as I know, I have the GD Library set up but am having a heck of a time getting Freetype2 installed/set up to work with GD. I have tried following a few different tutorials online in hopes of getting it working correctly, but always seem to get the "Call to Undefined Function" error when running script with the imagefttext function after trying to install Freetype2. when I run phpinfo(), under "GD", says GD support is enabled.
I have seen a manual that reads "Freetype Support" - Enabled
With "Freetype Linkage" - with freetype
and those are the two I am not seeing in phpinfo() under GD

https://discussions.apple.com/thread/3440796?tstart=0

Is the small thread I had started last week at the Apple Support Community trying to get this figured out.
I have tried to follow the first couple posts "BDAqua" has posted, then got down to the last post, and it was pretty much completely over my head.

I've been poking around in Terminal, trying to follow my install instructions for Freetype, I get to step 2 where am told to run sh autogen.sh file, and this is what I get.

ERROR: Your version of the `aclocal' tool is too old.
Minimum version 1.10.1 is required (yours is version 1.10).
Please upgrade or use the ACLOCAL variable to point to a more recent one.


I have tried upgrading Libtoolz/Automake and can't seem to get it figured out (those error out on me as well.

I have followed the how to here, but cant tell if Freetype has been setup correctly. I still get the call to undefied funtion error.

OS X SDL Development Command Line Setup | The No Quarter Arcade

here is the php code I am trying to run.

<?php
// Create a 300x100 image
$im = imagecreatetruecolor(300, 100);
$red = imagecolorallocate($im, 0xFF, 0x00, 0x00);
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);

// Make the background red
imagefilledrectangle($im, 0, 0, 299, 99, $red);

// Path to our ttf font file
$font_file = './arial.ttf';

// Draw the text 'PHP Manual' using font size 13
imagefttext($im, 13, 0, 105, 55, $black, $font_file, 'PHP Manual');

// Output image to the browser
header('Content-Type: image/png');

imagepng($im);
imagedestroy($im);
?>


Please! Any help would be appreciated greatly!

Thanks!
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 3, 2011, 12:50 AM
 
Are you trying to compile Freetype and automake by hand, or via Macports? What are the compile time errors you are getting that you are stuck on?
     
jiveturkey  (op)
Fresh-Faced Recruit
Join Date: Nov 2011
Location: West of Chicago
Status: Offline
Reply With Quote
Nov 3, 2011, 01:39 AM
 
this is just the lower portion of the errors, but am trying to compile from Terminal.


install: /usr/local/share/automake-1.10/Automake/XFile.pm: Permission denied
/usr/bin/install -c -m 644 'Wrap.pm' '/usr/local/share/automake-1.10/Automake/Wrap.pm'
install: /usr/local/share/automake-1.10/Automake/Wrap.pm: Permission denied
make[4]: *** [install-dist_perllibDATA] Error 71
make[3]: *** [install-am] Error 2
make[2]: *** [install-recursive] Error 1
make[1]: *** [install-recursive] Error 1
make: *** [install-recursive] Error 1


these are the instructions I am following in the Install file included with automake 1.10.1 download


1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.

Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.

2. Type `make' to compile the package.

3. Optionally, type `make check' to run any self-tests that come with
the package.

4. Type `make install' to install the programs and any data files and
documentation.

5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.

6. Often, you can also type `make uninstall' to remove the installed
files again.

when I run the 'make install' in number 4 is when I get the permission denied errores, many of them, and other errors shown.

Compile through Terminal was what you were talking about? Not sure about the MACPorts either.

sorry, not real familiar with a bunch of this.
Any help would be great.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 3, 2011, 02:13 AM
 
I would suggest installing Macports which will make life much easier for you in automating these installs for you. With Macports installed simply entering:

sudo port -v install php5-gd

would install the GD PHP extension and all necessary prerequisites including appropriate versions and GD itself. You can use Macports to install entire PHP installs, actually. There is another more simpler package manager called "Homebrew", but it doesn't look like it has the PHP GD extension available. I'm surprised the version of PHP Apple ships does not come with the GD extension, perhaps it is just disabled?


If you insist on installing things without a package manager, did you do a "make install" or "sudo make install"? The latter is required and would prevent you from getting those permission errors you are getting.

If this is over your head install Macports.
     
OreoCookie
Moderator
Join Date: May 2001
Location: Hilbert space
Status: Offline
Reply With Quote
Nov 3, 2011, 05:45 AM
 
You should definitely use MacPorts and not try to compile everything yourself.
I don't suffer from insanity, I enjoy every minute of it.
     
jiveturkey  (op)
Fresh-Faced Recruit
Join Date: Nov 2011
Location: West of Chicago
Status: Offline
Reply With Quote
Nov 3, 2011, 11:06 AM
 
Cool, I will try Macports.

I can take a look at my phpinfo() and see the GD is up a running.
I have run a few image functions that seem to work fine.
The big problem I have left (as far as I know), is trying to enable/install/configure Freetype2 to work with the GD Library. Am wanting to experiment with the imagefttext function and I keep getting the "Call to undefined Function" error in reference to that function (I believe it is to that function).
I have a manual that is a few years old that shows php info for a system with everything set up correctly.
in that screenshot of phpinfo, under GD I can see

Freetype Support - Enabled
Freetype Linkage - with freetype

It also shows the version of Freetype.

I will monkey with MACPorts and hopefully that will solve my GD/Freetype issues.

Off the top of your head, do you know if Freetype is bundled with MACPorts?

Your help is greatly appreciated!
     
King Bob On The Cob
Mac Elite
Join Date: Apr 2002
Location: Illinois
Status: Offline
Reply With Quote
Nov 3, 2011, 06:37 PM
 
Originally Posted by jiveturkey View Post
Cool, I will try Macports.

I can take a look at my phpinfo() and see the GD is up a running.
I have run a few image functions that seem to work fine.
The big problem I have left (as far as I know), is trying to enable/install/configure Freetype2 to work with the GD Library. Am wanting to experiment with the imagefttext function and I keep getting the "Call to undefined Function" error in reference to that function (I believe it is to that function).
I have a manual that is a few years old that shows php info for a system with everything set up correctly.
in that screenshot of phpinfo, under GD I can see

Freetype Support - Enabled
Freetype Linkage - with freetype

It also shows the version of Freetype.

I will monkey with MACPorts and hopefully that will solve my GD/Freetype issues.

Off the top of your head, do you know if Freetype is bundled with MACPorts?

Your help is greatly appreciated!
Nothing is bundled with MacPorts. MacPorts is a program that keeps track of patches required to build a program and automates the build process so that you don't need to know why you get a permission denied.
     
jiveturkey  (op)
Fresh-Faced Recruit
Join Date: Nov 2011
Location: West of Chicago
Status: Offline
Reply With Quote
Nov 3, 2011, 06:52 PM
 
Gotcha. So any know how on the Freetype2? That is my only issue as I have GD functioning. Can't get it to communicate with GD.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 3, 2011, 07:00 PM
 
I'm unclear as to whether you are reporting what the manual's sample phpinfo() showed, or what yours is showing. What happens when you do the following"

echo "<?php echo phpinfo(); ?>" > phpinfo.php

and run phpinfo.php in your browser? Is it showing that GD is enabled w. Freetype support?
     
jiveturkey  (op)
Fresh-Faced Recruit
Join Date: Nov 2011
Location: West of Chicago
Status: Offline
Reply With Quote
Nov 3, 2011, 07:36 PM
 
When I run phpinfo() - Under the gd info a little ways down, I can see "gd" enabled, the versioning, and all the different image types supported. What I don't see is Freetype supported.
This is an example of what I should/want to see.

phpinfo()

On my machine, I do not see

FreeType Support enabled
FreeType Linkage with freetype
T1Lib Support enabled

under the versioning.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 3, 2011, 08:03 PM
 
So what Macports have you installed? What do you get when you do a:

port installed

Or, did you compile things by hand? If so, what compile flags did you use? What did you do, exactly? What commands were run?


Need more info.
     
jiveturkey  (op)
Fresh-Faced Recruit
Join Date: Nov 2011
Location: West of Chicago
Status: Offline
Reply With Quote
Nov 3, 2011, 08:58 PM
 
sorry, haven't been home and had the opp to install the macports yet. last night I had went here
for GD,

Marc Liyanage - Software - Mac OS X Packages - PHP

downloaded

Entropy PHP 5.3.0-3.pkg

unpacked and installed

1. Download the appropriate installation package from the list above.
2. Double-click the installer package and follow the directions of the installer application.



for Freetype2 went here,

Index of /releases/freetype

downloaded and unpacked

freetype-2.4.7.tar.gz

in Terminal I change directory to my freetype-2.4.7 (the unpacked folder, can't remember the exact name right now, but it was the freetype unpacked folder)

then I ran commands
./configure
make
sudo make install

as far as I can tell, it installed correctly with no errors.

after that I restarted apache and ran the phpinfo() and produced the results listed (gd enabled, with version, all image types supported, no reference to freetype)


when I go home later and try Macports install, I am not sure what you are referring to "flags" you mention earlier. I imagine there are instructions available to download/install on the macport site?

thanks again for all your help!
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 3, 2011, 09:19 PM
 
That won't work. PHP has to be compiled against GD, you can't just install GD/Freetype separately and expect things to work, the extension has to a) be built and installed, b) have support for Freetype which is not possible without Freetype being installed to compile against.

When you install some random package you find such as the one from the Entrophy site, you often don't know what features have been enabled unless these have been documented. Additionally, you can run into problems installing multiple versions of things in random locations and having your machine littered with packages in various locations. When it comes to updating these packages you'll have to hope that your provider is still maintaining these packages so that there are up-to-date versions, and versions that don't cause incompatibilities.

This is why Macports and the like is very useful.

I wouldn't worry about uninstalling the stuff you've already installed unless you are anti-litter, these pieces will just remain dormant once you've replaced them with Macports ports.
     
jiveturkey  (op)
Fresh-Faced Recruit
Join Date: Nov 2011
Location: West of Chicago
Status: Offline
Reply With Quote
Nov 4, 2011, 12:13 AM
 
alright, have install macports.

ran the command you had mentioned earlier.

sudo port -v install php5-gd

this was the output in Terminal

usage: sudo [-n] -h | -K | -k | -L | -V | -v
usage: sudo -l[l] [-AnS] [-g groupname|#gid] [-U username] [-u username|#uid]
[-g groupname|#gid] [command]
usage: sudo [-AbEHnPS] [-C fd] [-g groupname|#gid] [-p prompt] [-u
username|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AnS] [-C fd] [-g groupname|#gid] [-p prompt] [-u
username|#uid] file ...

I am going back and reading your last post as well, did I need to run the "sudo port -v install " for the dependencies first or does running the install for the php5_gd port take care of those as well?
And I need to turn off LoadModule PHP5 in my httpd.conf file before I run the php5_gd install before I do all this.
I did run phpinfo again after restarting apache and looks like nothing changed. so I imagine I did something wrong...

thanks for your patience!
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 4, 2011, 12:52 AM
 
installing php5-gd will install all dependencies for php5-gd, including ones that have already been installed by Apple. Macports builds a complete sandbox in /opt, so that none of its bits will interfere with Apple's and vice versa.

I believe at the end of a successful build it will either provide you with a new LoadModule line to replace the old one, or else add it for you.

Keep in mind that MacPorts will build a whole new environment for you to replace Apple's. If you just want to cherry pick the PHP-GD extension out of what is installed though, you can simply by transferring the gd.so PHP extension from the Macports to the Apple direcetory. If you are content with just using the Macports environment though, that's what I'd do. It will include a launchd script for starting Apache at boot, but you'll have to give up on starting/stopping your web server via System Preferences - that won't work anymore. Your web server files will live in /opt/local/apache2/htdocs. You can create a symlink to this path in your home directory for easy access.

As far as the error message you posted above, are you absolutely sure you are entering the command right with no extra characters or anything different than exactly what I provided?
     
jiveturkey  (op)
Fresh-Faced Recruit
Join Date: Nov 2011
Location: West of Chicago
Status: Offline
Reply With Quote
Nov 4, 2011, 02:43 AM
 
you're right... I typed in the command incorrectly. I am an idiot! But I "believe" it installed correctly.

Sorry, all these questions, am sure I am showing I am nothing less than an idiot... "It will include a launchd script for starting Apache at boot" does this mean when I restart my machine, apache will start automatically?, or do I need to do something to start apache (go into terminal and do something rather, or open a file in textwrangler and uncomment code)? I have followed tutorials before when working with apache/php so not exactly sure all I need to be doing to get this to work correctly. I did look at the httpd.conf file in the conf folder, I did not see the "LoadModule php5_module" that I have had to uncomment in my original conf file from apple's build to enable php to work. I imagine I need to uncomment something in a file to get php to work? Also, one other quick question, before, to test files, am I storing files I am testing in the location you specified before - webserver location (/opt/local/apache2/htdocs)?, and I imagine I will need to type in a different address than I was using before to test my files (before I would type in localhost/info.php or something like that)?

thank you for all your help!
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 4, 2011, 02:50 AM
 
Originally Posted by jiveturkey View Post
you're right... I typed in the command incorrectly. I am an idiot! But I "believe" it installed correctly.

Sorry, all these questions, am sure I am showing I am nothing less than an idiot... "It will include a launchd script for starting Apache at boot" does this mean when I restart my machine, apache will start automatically?, or do I need to do something to start apache (go into terminal and do something rather, or open a file in textwrangler and uncomment code)?
I think it installs the launchd script, but doesn't enable it by default. To enable it, do a:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

This will get Apache starting at boot and will also start Apache right then and there. You can restart Apache manually at any time:

sudo /opt/local/apache2/bin/apachectl graceful or
sudo /opt/local/apache2/bin/apachectl restart


I have followed tutorials before when working with apache/php so not exactly sure all I need to be doing to get this to work correctly. I did look at the httpd.conf file in the conf folder, I did not see the "LoadModule php5_module" that I have had to uncomment in my original conf file from apple's build to enable php to work. I imagine I need to uncomment something in a file to get php to work? Also, one other quick question, before, to test files, am I storing files I am testing in the location you specified before - webserver location (/opt/local/apache2/htdocs)?, and I imagine I will need to type in a different address than I was using before to test my files (before I would type in localhost/info.php or something like that)?

thank you for all your help!
The configuration for the Macports version of Apache is in /opt/local/apache2/conf/httpd.conf . It will have all the same stuff the config file you were working with before will have, although it if doesn't have the LoadModule command you'll need to add it (unless you want to use PHP via CGI). The Apache DocumentRoot is indeed in /opt/local/apache2/htdocs.
     
jiveturkey  (op)
Fresh-Faced Recruit
Join Date: Nov 2011
Location: West of Chicago
Status: Offline
Reply With Quote
Nov 4, 2011, 10:17 AM
 
Thank you for your help and knowledge way over my head!

I won't be able to tinker with it until Sunday, but I will definitely let you know one way or the other how it goes!

thanks again!
     
jiveturkey  (op)
Fresh-Faced Recruit
Join Date: Nov 2011
Location: West of Chicago
Status: Offline
Reply With Quote
Nov 7, 2011, 01:42 PM
 
I try to navigate to my info page so I can see phpinfo(), and I get an error, a you do not have permission, or a permission denied error. So I think I am just about there.
     
besson3c
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Nov 7, 2011, 06:44 PM
 
Possibly, hard to say
     
jiveturkey  (op)
Fresh-Faced Recruit
Join Date: Nov 2011
Location: West of Chicago
Status: Offline
Reply With Quote
Nov 8, 2011, 10:07 AM
 
these are the ports that were installed with the php5-gd install instructions I followed of yours.

apache2 @2.2.21_2+preforkmpm (active)
apr @1.4.5_3 (active)
apr-util @1.3.12_0 (active)
autoconf @2.68_2 (active)
autoconf213 @2.13_1 (active)
automake @1.11.1_0 (active)
bzip2 @1.0.6_0 (active)
db46 @4.6.21_6+java (active)
expat @2.0.1_1 (active)
freetype @2.4.7_0 (active)
gawk @4.0.0_0 (active)
gdbm @1.9.1_0 (active)
gettext @0.18.1.1_2 (active)
glib2 @2.28.8_0 (active)
gperf @3.0.4_2 (active)
gsed @4.2.1_2 (active)
help2man @1.40.4_1 (active)
jpeg @8c_0 (active)
libedit @20110802-3.0_0 (active)
libiconv @1.14_0 (active)
libpng @1.4.8_0 (active)
libtool @2.4.2_0 (active)
libxml2 @2.7.8_0 (active)
m4 @1.4.16_0 (active)
mhash @0.9.9.9_0 (active)
nawk @20110810_1 (active)
ncurses @5.9_1 (active)
ncursesw @5.8_0 (active)
openssl @1.0.0e_1 (active)
p5.12-locale-gettext @1.50.0_6 (active)
pcre @8.12_1 (active)
perl5 @5.12.3_1+perl5_12 (active)
perl5.12 @5.12.3_2 (active)
php5 @5.3.8_1+apache2 (active)
php5-gd @5.3.8_0 (active)
pkgconfig @0.26_0 (active)
readline @6.2.000_0 (active)
sqlite3 @3.7.9_0 (active)
zlib @1.2.5_0 (active)

I try to type in http://localhost/index.html

and browser says cannot connect to localhost.

also, I tried to restart browser before, using the command
sudo /opt/local/apache2/bin/apachectl graceful
and I get the following.

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
httpd not running, trying to start

also,
I had went here

How to install apache, php, mysql with macport in Mac OS X - Techie Corner

to look for help in macports as far as what to install in my conf file for php, a little way down I saw this

LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php

thanks for you help!
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 11:34 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,