presto icon indicating copy to clipboard operation
presto copied to clipboard

PGPLOT_DIR must be set or mystery failures

Open aarchiba opened this issue 5 years ago • 0 comments

If PGPLOT_DIR is not set, a bare -I eats -DUSEFFTW and you get a silent miscompilation of fastffts.c and a mystery failure on linking search_bin (missing symbol read_wisdom). On a system with pgplot actually installed, PGPLOT_DIR can be set to anything.

I suggest a change in the Makefile so that if PGPLOT_DIR isn't set the -I and -L don't get added to the command line. Patch follows and appears to work.

diff --git a/src/Makefile b/src/Makefile
index 277c2b0..78b0b4a 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -23,10 +23,15 @@ endif
 X11LINK := $(shell pkg-config --libs x11)
 PNGLINK := $(shell pkg-config --libs libpng)
 
-# Include and link information for PGPLOT v5.X (including shared libs!)
-# Typically you need to have your PGPLOT_DIR environment variable set
-PGPLOTINC = -I$(PGPLOT_DIR)
-PGPLOTLINK = -L$(PGPLOT_DIR) -lcpgplot -lpgplot $(X11LINK) $(PNGLINK)
+ifdef PGPLOT_DIR
+       # Include and link information for PGPLOT v5.X (including shared libs!)
+       # Typically you need to have your PGPLOT_DIR environment variable set
+       PGPLOTINC = -I$(PGPLOT_DIR)
+       PGPLOTLINK = -L$(PGPLOT_DIR) -lcpgplot -lpgplot $(X11LINK) $(PNGLINK)
+else
+       PGPLOTINC = 
+       PGPLOTLINK = -lcpgplot -lpgplot $(X11LINK) $(PNGLINK)
+endif
 
 # Include and link information for the FFTW 3.X single-precision library
 FFTINC := $(shell pkg-config --cflags fftw3f)

aarchiba avatar May 30 '19 10:05 aarchiba