GD library via MacPorts on OS X

Compiler issues (Intel compiler, mpicc, etc.), data libraries and everything needed to get Serpent running is discussed here
Post Reply
Andrei Fokau
Posts: 77
Joined: Thu Mar 25, 2010 12:25 am
Security question 2: 0
Location: KTH, Stockholm, Sweden
Contact:

GD library via MacPorts on OS X

Post by Andrei Fokau » Wed Jul 21, 2010 4:30 pm

First of all, there is a need for Troubleshooting section of this forum! :)
--

In order to compile Serpent with GD2 library installed via MacPorts, one needs to add the following lines to Makefile so that GCC can find gd.h file etc.

Code: Select all

CFLAGS  += -I/opt/local/include
LDFLAGS += -L/opt/local/lib
Otherwise, one will see the following errors:

Code: Select all

plotgeometry.c:5:16: error: gd.h: No such file or directory
plotgeometry.c: In function 'PlotGeometry':
plotgeometry.c:28: error: 'gdImagePtr' undeclared (first use in this function)
plotgeometry.c:28: error: (Each undeclared identifier is reported only once
plotgeometry.c:28: error: for each function it appears in.)
plotgeometry.c:28: error: expected ';' before 'im'
plotgeometry.c:29: warning: ISO C90 forbids mixed declarations and code
plotgeometry.c:748: error: 'im' undeclared (first use in this function)
plotgeometry.c:748: warning: implicit declaration of function 'gdImageCreate'
plotgeometry.c:752: warning: implicit declaration of function 'gdImageColorAllocate'
plotgeometry.c:780: warning: implicit declaration of function 'gdImageSetPixel'
plotgeometry.c:801: warning: implicit declaration of function 'gdImagePng'
plotgeometry.c:809: warning: implicit declaration of function 'gdImageDestroy'

Code: Select all

ld: library not found for -lgd
collect2: ld returned 1 exit status
make: *** [sss] Error 1
KTH Reactor Physics (Stockholm, Sweden) neutron.kth.se

User avatar
Jaakko Leppänen
Site Admin
Posts: 2381
Joined: Thu Mar 18, 2010 10:43 pm
Security question 2: 0
Location: Espoo, Finland
Contact:

Re: GD library via MacPorts on OS X

Post by Jaakko Leppänen » Wed Jul 21, 2010 7:34 pm

Thank's for the tip. I'll add the options in the Makefile for the next update.

I think the main problem is that the compiler doesn't know where to look for the libraries and include files, and options -I and -L define the paths manually. Basically the paths should be defined by two environment variables, LIBRARY_PATH and C_INCLUDE_PATH, but for some reason these variables are not properly set in some platforms.
- Jaakko

Post Reply