On 29.02.2016 10:01 Svets wrote:
> I have built fltk on windows 7 64 bit and it built without error but I'm
> getting some issues when I set up lib and include files in my IDE
> (codeblocks) because I'm referencing both the internal libs included
> with fltk 1.3 like libpng and zlib and libjpeg and the external zlib,
> libjpeg, and libpng used for other libraries I'm using in my
> application. I think the fact that I have two zlibs and two libpng's
> and two libjpeg's is the reason I'm getting errors.
First important question: which compilers did you use to build FLTK? It
should be the same compiler you use in your IDE, otherwise the built
library might not be compatible with your IDE build.
> What I want to do is to build fltk using the external zlib, libpng, and
> libjpeg but I'm having a little trouble getting them seen when I use the
> ./configure script.
Okay, you build FLTK using configure. Again, which compiler and build
environment? MinGW?
> I've tried using --prefix=C:/zlib but I can only put on there.
--prefix is used for the target directory, i.e. where to install the
libs you build (FLTK).
> I've also tried using --includedir=C:/zlib but again I can only use one
> directory?
Hmm, no idea about this.
> How to I divert the configure script to use these external libraries. I
> can't tell if they are doing this or not as when I do try to divert them
> the output in my console says that
> zlib, libpng and libjpeg are BUILTIN?
If FLTK can't find the system libs, then it uses the "BUILTIN" libs,
i.e. the bundled libraries, for its own use. This can really be the
cause of trouble if you are using another version in your program.
> Any clues as to how I would do this.
>
> I also tried this.
>
> ./configure --includedir=C:/zlib --includedir=C:/libpng
> --includedir=C:/libjpeg .
>
> of course only C:/libjpeg is the only directory seen and again I'm not
> even sure it was used.
>
> Any clues?
You could try to build FLTK with CMake. In this case you can preset the
cache variables to use a particular zlib, png, and jpeg library:
$ cmake -LA | grep 'zlib\|png\|jpeg'
... shows ...
HAVE_LIBPNG_PNG_H:FILEPATH=/usr/include/libpng/png.h
HAVE_PNG_H:FILEPATH=/usr/include/png.h
JPEG_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libjpeg.so
LIB_jpeg:FILEPATH=/usr/lib/x86_64-linux-gnu/libjpeg.so
LIB_png:FILEPATH=/usr/lib/x86_64-linux-gnu/libpng.so
LIB_zlib:FILEPATH=/usr/lib/x86_64-linux-gnu/libz.so
PNG_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libpng.so
in my CMake build. You could try to preset these variables accordingly
(with cmake -D"...") or edit them manually with cmake-gui. You're
obviously using Windows, so cmake-gui might be the option to use. Just
install the Windows package from
cmake.org, then execute cmake-gui.exe
from within your MinGW shell or whatever so cmake will find your
compilers. Select "Unix Makefiles" or "MSYS Makefiles" as the generator,
edit the variables shown above appropriately, and give this a try (click
configure + generate), then run make after leaving the gui. This may
work. Hopefully.
OTOH, if you want to use configure + make, you can try to edit
'makeinclude' after you run configure, or you can try to set CFLAGS,
CXXFLAGS, and LDFLAGS before you invoke configure, like this:
$ export CFLAGS="-I/path/to/zlib -I/path/to/libjpeg ..."
$ export CXXFLAGS="-I/path/to/zlib -I/path/to/libjpeg ..."
$ export LDFLAGS="-L/path/to/zlib -L/path/to/libjpeg ..."
./configure --disable-localzlib --disable-localpng --disable-localjpeg
make
Please let us know if you found a solution and how it worked. TIA.