Hello,
I am new to programming and building from source code.
How do I tell the compiler during the ./configure process where to find libraries or file dependencies during the build process?
If I only have a “Makefile”, how do I do the same thing as above?
If anyone can help me with this, that would be awesome. If you know of a good website that explains it, that’s great too!
Best,
Aaron
I’m not sure about the configure question.
For compiling from the command line, you have to specify two things for libraries.
- Indicate you are using a particular library
-lmyExample (for library libmyExample)
- Indicate what paths should be searched
-L/home/user/examplePath
For example:
g++ -o test test.cpp -lmyExample -L/home/user/examplePath
Anything you put in the Makefile needs to resolve to something like this.
Ok. So, if in this particular example I need to indicate the path to the TIFF library, and here’s my Makefile:
Varkon libraries
LIBS = IG/lib/IGlib.a
PM/lib/PMlib.a
EX/lib/EXlib.a
DB/lib/DBlib.a
WP/lib/WPlib.a
GE/lib/GElib.a
X11 libraries
XLIBS = -L/usr/X11R6/lib -lX11 -lXext -lXpm
OpenGL libraries. You may have to change this line
to reflect the location of your OpenGL libs.
GLIBS = -lGL -lGLU
The TIFF library
ifeq ($(DV3TIFF),TRUE)
TIFFLIBS = -ltiff
endif
ODBC libraries. You may have to change this line
to reflect the location of your ODBC libs.
ifeq ($(DV3ODBC),TRUE)
SQLLIBS = -L/usr/lib/unixODBC -lmyodbc3
endif
The actual executable, xvarkon.
XVARKON = …/bin/xvarkon
Targets
$(XVARKON): $(LIBS)
cc $(LIBS) $(SQLLIBS) $(XLIBS) $(GLIBS) $(TIFFLIBS) -lm -o $(XVARKON)
Would I change the line TIFFLIBS= -ltiff
or add a new line like:
TIFFLIBS= -L/path/to/my/library
or is it something else entirely?
Thanks.
TIFFLIBS= -L/path/to/my/library -ltiff
You still need the -l. The -L is not a replacement for -l but tells the linker what other directories to search for libtiff.