Apps :: More questions regarding compiling extensions



One more thing about the redundancy:
Quote
When I compile my libraries I have to tell them where the library is.

i.e ./configure --prefix=/opt/gnuplot --libdir=/opt/gnuplot

If that's what you're using for your libs (and not gnuplot), you're building a Makefile to install the lib in the parent prefix directory (e.g., /opt/gnuplot) rather than in lib directory (e.g., /opt/gnuplot/lib). There's really no practical reason to do that because you'll still have to link it (see below).

If you used that line to configure the Makefile for gnuplot, you're not telling it to LINK to existing libs in /opt/gnuplot, you're telling it to INSTALL gnuplot's libs (if it has any) there. That's what the libdir, mandir, bindir, etc., commands are for: to tell where to put those things.

If libgd is already in the system, it should be detected when you run configure. If it's there but not detected, modify the --with option below to suit your needs. If it's not already there, compile it first with the same prefix you'll use for your app. Leave the libdir option alone because libs should already install to /yourprefix/lib. Then when you compile gnuplot, link that --with-libgd=/prefix/lib (or however libgd is referenced -- there should be something in an INSTALL, README, or run ./configure --help | less).

Hello Lucky13, I am glad you spoke up, I need all the help and advise I can get. Thanks for taking the time to do the research you did.

Yes, in principal I  realized that the --libdir was duplicating the --prefix option but I was trying everything I could do to force gnuplot to find the library I was compiling.

Basically compiling gnuplot out-of-the-box does not require this library. However, if I want to save a graph in jpeg, gif or png format I have to install the the "libgd" library and it's associated libraries that it uses.

i.e gnuplot-> libgd -> libpng, zlib, jpeg, freetype


DSL has the libpng, zlib, jpeg and freetype libraries built in, so I just need to compile the libgd library.

So I can compile the libgd with the standard ./configure --prefix=/opt/gnuplot/ and this will compile the libraries into /opt/gnuplot/lib without error

Then, I can compile gnuplot to /opt/gnuplot with ./configure --prefix=/opt/gnuplot --with-gd=/opt/gnu and it will recognize the switch and find the libraries and compile gnuplot into /opt/gnuplot/bin etc etc without error.

However, when I run the program it finds all standard libraries except the libgd one I just compiled. The --libdir stuff was just trying to find ways to get it recognize the library in /opt/gnuplot/lib.

The only two things that work are 1) adding /opt/gnuplot/lib to the library path via a script or 2) moving the libraries in /opt/gnuplot/lib to /opt/gnuplot.

So, I do have a solution that works but it is a compomise and accepting the compromise is hard to take.

Regards Phil

Another possible solution is offered in gnuplot faq #3.6: you can exclude libgd and save output as encapsulated postscript and convert separately (they suggest ghostscript, but imagemagick also converts ps to whatever image format you want).
http://www.gnuplot.info/faq/faq.html#SECTION00056000000000000000

It's not really a compromise to write a wrapper script -- many of the things used in a system are launched from another process.

I wonder why #2 works though...

For some configuration of apps, I've used `./configure --with-libs-from=<insert path(s)> ...` to hardcode the lib search path in the executable.  I'm not sure if this is similar to other flags?  It can be hard to understand so many options.  Essentially this will pass something like -Wl,"-R :<insert path(s)>:/usr/local/lib" to gcc.

edit: here's a snippet that might be helpful...
Quote
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use `-LLIBDIR'
flag during linking and do at least one of the following:
  - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
    during execution
  - add LIBDIR to the `LD_RUN_PATH' environment variable
    during linking
  - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
  - have your system administrator add LIBDIR to `/etc/ld.so.conf'

Quote
  - add LIBDIR to the `LD_RUN_PATH' environment variable during linking
 - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
hey now...that looks like a handy piece of info. I'm definitely going to need to try that next time I compile a uci

Next Page...
original here.