Snowman
Snowman

Reputation: 32061

Problem with Makefile

I'm trying to compile a small program I've written for class. They have given us a Makefile to use, but it was created with Linux in mind, and I have Mac OS. Now when I run make testFills, I get this error:

ld: warning: directory '/lib' following -L not found
ld: library not found for -ltiff

Here is the important code of the actual Makefile

EXENAME=testFills
OBJS=testFills.o animation.o EasyBMP.o solidColorPicker.o gridColorPicker.o gradientColorPicker.o rainbowColorPicker.o
BMPDIR=../mp4_lib/include/EasyBMP
IMGMAGICKCONFIG=-I../mp4_lib/include/ImageMagick -g -O2 -Wall -W -pthread
IMGMAGICKLINKOPTS=-L../mp4_lib/lib -lMagick++ -lMagickWand -lMagickCore -ltiff -lfreetype -ljpeg -lpng -lfontconfig -lXext -lXt -lSM -lICE -lX11 -lbz2 -L/lib -lrsvg-2 -lgdk_pixbuf-2.0 -lm  -ldl -lxml2 -lz -lm -lgomp -lpthread

I have in my parent directory this mp4_lib folder, so I dont know why its saying it cant find it. Actually it cant find anyything past -ltiff in the above list. I'm new to command-line programming, so I'm not sure what this could mean or how I can fix it. Any ideas?

Upvotes: 0

Views: 4019

Answers (5)

djondal
djondal

Reputation: 2541

You probably just need to indicate the library "libtiff.a" path using -L option. For example if "libtiff.a" is located in the lib directory in the parent folder of the makefile:

-L../lib/ -ltiff 

will do.

For more information, see -L explanation here : http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/Directory-Options.html

and -l explanation here http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

Upvotes: 1

Sagar
Sagar

Reputation: 9503

According to here, the shared library folder for MacOS is at /Library.

Since your Linux Makefile said -L/lib, I think you need to change it to -L/Library, since the /lib is the shared library folder for Linux, as /Library is to Mac OS.

Upvotes: 0

JoeSlav
JoeSlav

Reputation: 4795

I don't think you will manage to build your program if you do not have all those libraries installed (i.e. all lLibrary without the l), so look for them, and if they aren't available, install them.

Also (and I hope not to sound too obvious), if you were given some libraries for Linux (so it seems from your question), they must be built for Mac OS X in order for you to link them.

You could try to use /usr/lib instead of /lib.

Good luck!

Upvotes: 0

Diego Sevilla
Diego Sevilla

Reputation: 29021

Seems like a configuration problem of your compiler (gcc?) installation. I've seen similar errors in faulty installations of gcc. Please, try that you can actually compile a small application.

Upvotes: 0

Twig
Twig

Reputation: 611

Its on the 5th line

-lbz2 -L/lib -lrsvg-2

you probably dont have a /lib directory, it should probably be just -Llib.

/lib means that it is the root directory of your computer, rather than in the folder the makefile is in.

Upvotes: 1

Related Questions