Cannot find -lgd

Compiler issues (Intel compiler, mpicc, etc.), data libraries and everything needed to get Serpent running is discussed here
Post Reply
Posts: 4
Joined: Wed Apr 10, 2013 6:57 pm
Security question 1: No
Security question 2: 92

Cannot find -lgd

Post by ngeorge3 » Fri Nov 29, 2019 6:58 am

After installing LibGD and leaving "LDFLAGS += -lgd" ON in the Makefile, I'm getting the following error while compiling serpent:

header.h:22:16: fatal error: gd.h: No such file or directory

As I'm working out of my own private directory (since I'm not the cluster administrator), I was able to fix this error by replacing #include in the SERPENT src files: header.h, meshplotter.c, and geometryplotter.c:

#include <gd.h> --> #include </home/mydirectory/include/gd.h>

Afterwards, the plotting src files are able to locate gd.h; however, I'm now getting the following error at the end of the compilation:

/usr/bin/ld: cannot find -lgd
collect2: error: ld returned 1 exit status
make: *** [sss2] Error 1

Has anyone encountered this problem as well?

To note, I'm able to successfully compile serpent when commenting out LDFLAGS (without the graphics library).

Riku Tuominen
Posts: 63
Joined: Tue Feb 27, 2018 10:52 am
Security question 1: No
Security question 2: 93

Re: Cannot find -lgd

Post by Riku Tuominen » Fri Nov 29, 2019 10:31 am

Have a look at this link.

Posts: 5
Joined: Mon Jul 17, 2017 2:05 am
Security question 1: No
Security question 2: 43

Re: Cannot find -lgd

Post by nmg5041 » Fri Nov 29, 2019 7:57 pm

After following the suggested fixes 1-3 from that link, I changed the paths below:

export CPATH=".../include"
export LIBRARY_PATH=".../lib"
export LD_LIBRARY_PATH=".../lib"

And the code was able to compile! I successfully ran an input and have pretty plots now!

Thank you!!!

Posts: 2
Joined: Tue Aug 11, 2020 6:30 pm
Security question 1: No
Security question 2: 7

Re: Cannot find -lgd

Post by froberto » Tue Aug 11, 2020 6:36 pm

I am working on Ubuntu 20.04 and installing libgd worked for me:
sudo apt-get install libgd-dev

Post Reply