From: Dan L. <dle...@ip...> - 2000-11-16 21:16:25
|
Greta plplot installation (with optional png and gif) and linking to greta "One way that works"-ldl 11-16-2000 ------------------------------------------------------------------------- (1) (PNG only) Need libpng.a(so) and libz.a(so). If don't have in /usr/lib, These usually come together and are closely synced in versions. One place to get is: http://www.libpng.org/pub/png/libpng.html and get source libpng-1.0.8.tar.gz http://www.info-zip.org/pub/infozip/zlib/ and get source zlib-1.1.3.tar.gz If you have recent versions of zlib and libpng, you could skip to plplot install. Only problem is libpng needs to be patched for png to not core dump on a png file write. zlib actually is probabably fine at /usr/lib/libz.so and need not be installed. (2) (PNG only) in home directory, gzip -cd libpng-1.0.8.tar.gz | tar -xvf - and gzip -cd zlib-1.1.3.tar.gz | tar -xvf - (3) (PNG only) png only. mv libpng-1.0.8 libpng, and zlib-1.1.3 to zlib (4) (PNG ONLY) To avoid core dumps with png, I also must change in libpng, file pngwio.c, function png_default_write_data, line 51: check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr)); change to: if (png_ptr->io_ptr) check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr)); This change is done is conjucntion with 18 below. (5) (PNG only) make these libraries. They are easy, just do ./configure; make and you should now have a libpng.a, libpng.so, libz.so, and libz.a (6) mv $HOME/libpng /usr/lib and mv $HOME/zlib /usr/lib in order to clean things up a bit. (7) Because of problem with default libpng, need to put it in LD_LIBRARY_PATH path, otherwise it finds the one in /usr/lib/libpng.so -------------------End of libpng and libz (if needed----------------------- ------------------Start of plplot------------------------------------------ I can't mess with changing the /usr area yet. Also, modifications to plplot need to be made to add the png and gif drivers. (1) Obtain the latest version of plplot-990122.gz (os at least the one which has code for drivers. I got it through ftp.msfc.nasa.gov via Michael <Mic...@ms...>. I don't see file plplotlib.tar.Z anymore. (2) from home directory, gzip -cd plplotlib.tar.Z | tar -xvf - (3) cd plplot-990122, ./configure (would be ./configure --prefix=/usr/lib/plplot if done for good install) ( as root, mkdir /usr/lib/plplot with rw-rw-rw- on plplot -- again, would be for a true install, which I am not yet able to do ) (4) plplot has a typedef PLFLT which can be a DOULBE or FLOAT. The greta makefile has CFLAGS= -DDOUBLE ..., meaning it has defined PLFLT to be a DOUBLE. Left alone, PLFLT will be a float. Thus, let's be sure its a DOUBLE in all plplot libs: edit line 196 of tmp/plplot.h, adding "#define DOUBLE 1". This will insure that the following macro #if defined(PL_DOUBLE) || defined(DOUBLE) typedef double PLFLT; #else typedef float PLFLT; #endif will always evaluate to typedef double PLFLT;, so no greta/plplot lib conflicts arise. (5) tmp/plDevs.h has many drivers that are not needed. Most can be commented out except #define PLD_null 1 (might not need) #define PLD_xterm 1 (might not need) #define PLD_ps 1 #define PLD_psc 1 #define PLD_lj_hpgl 1 #define PLD_xwin 1 #define PLD_tk 1 (this is very much needed I believe) #define PLD_gif (add for gif only) #define PLD_png (add for png only) note png and gif need to be added. (6) (GIF and PNG only) cd tmp; cp ../Cver2/gd* . This picks up gdgif.{c,h} and gdpng.{c,h} This with bring in gdgif.c and gdpng.c and headers and backups (7) (GIF and PNG only) edit tmp/Makefile, add to the "DRIVERS_C" macro gdgif.c \ gdpng.c (8) (GIF and PNG only) edit tmp/Makefile, add to the "DRIVERS_OBJ" macro gdgif$O \ gdpng$O (9) (GIF and PNG only). Make sure you have libgd.so in /usr/lib or /lib (10) (GIF and PNG only) edit tmp/Makefile, copy the line xwin$O: xwin.c plDevs.h plplotP.h plConfig.h plplot.h plstrm.h pdf.h pldebug.h \ plxwd.h drivers.h plevent.h paste it twice below, then edit xwin twice in each line to be gdgif$0: gdgif.c .. and gdpng$O: gdpng.c (11) (GIF and PNG only) edit tmp/Makefile again, find the macro LDC_LIBS and edit until it looks like: LDC_LIBS=-litk3.0 -ltk8.0 -litcl3.0 -litcl8.0 -L/usr/X11R6/lib -lX11 \ -lgd -lpng -lz -ldl -lm It seems that -litk3.0 -litcl3.0 are not needed, not even installed on some systems -- might try leaving off. (12) png has a tendency to core dump, as do gifs. Only solution I found to date in is in tmp/gdpng.c check for to see if File handle ?->Outfile is not null before closing it. This is done in conjunction with 13 above. It is unfortunate that I have to change libpng. Because of this, I also have to put it in LD_LIBRARY_PATH path, otherwise it finds the one in /usr/lib/libpng.so (13) Now we are ready to make all plplot libs. cd $HOME/plplot-990122; make should not get any warnings. (14) Finally we would want to install, with a "make install". This would populate /usr/lib/plplot/ with lib, include, examples, doc directories. But I currently use /home/dleonard/plplot-990122/tmp as the include and lib directory. --------------------------End of plplot compile/install-------------------------------- --------------------------Start of application compile/install------------------------- Now in our application, linking and compile statements are not aimed at /usr/lib/plplot yet but at /home/dleonard/plplot-990122/tmp: (1) greta COMPILE Flags: OSCFLAGS=-I/home/dleonard/plplot-990122/tmp -DINTEL -DLINUX CFLAGS= -DDOUBLE $(OSCFLAGS) -I$(AXAFPROG)/include -I../ututils with .c.o: cc $(CFLAGS) -c $< (2) greta LINKING: OSLFLAGS=-ldl -L/usr/X11R6/lib -lX11 -ltk -ltcl -lncurses \ -L/home/dleonard/plplot-990122/tmp -lplplotftk -lMatrix -lgd -lpng -lz LFLAGS= $(OSLFLAGS) -L$(AXAFPROG)/lib/$(OSTYPE) -lut -lgzip -lm and type is cc -o decom98 decom98.o plargs.o libgreta.so $(LFLAGS) also have ld -o libgreta.so decom98.o decrelay.o (other deleted) -shared (3) (GIF and PNG) zlib and gzip have two terrible namespace conflicts: they both use "inflate" and "deflate". Best solution I came up with was to rename in gzip.h inflate to inflate_gzip and deflate to deflate_gzip. Then also in src/libgzip-2.4/inflate.c rename function inflate to inflate_gzip, and finally src/libgzip-2.4/deflate.c rename function deflate to deflate_gzip. (4) We must also change in greta src/AX/axtlm.c and axtlm.h functions inflate and deflate to inflate_gzip and deflate_gzip to insure that they link to the gzip library and not libz (5) now we can make greta, cd src/AX; rm *.o; make; make install (6) we are now actually through with plplot-990122, we can hide it with mv plplot-990122 plplot-990122.hide I notice that if I do this libMatrix.so is actually found at /usr/lib/libMatrix.so. libplplotftk I believe is statically linked. (7) (GIF and PNG ) decgui needs to be able to command the new drivers. add lines: $beDevice->insert( 3, "gif" ); $beDevice->insert( 4, "png" ); and change $outfile = $vPSFile.$decname.".ps"; to $outfile = $vPSFile.$decname.".$vDest"; After thoughts: Worst thing here is the need to modify libpng and not be able to use just the default version in /usr/lib Modifying plplot has to be done in this version, would be nice if could handle from here. |