CMake doesn't find PGPlot on a MacBook
Tools to analyse output from the stellar-evolution code ev/STARS/TWIN
Status: Beta
Brought to you by:
marcvdsluys
I'm attempting to install evtools ver. 0.4.1 on a MacBook Pro running Mac OS X ver.10.11 (El Capitan). I'm using gfortran ver. 4.9.2 and running CMake ver. 3.4.2. The problem I'm having is that cmake's makefile is not picking up the location given for pgplot. The cmake application says it can find pgplot, but the command line command cmake can't find it.
Any suggestions?
Anonymous
Could you post the command-line output from the cmake and make commands? Also, where on your filesystem are your libpgplot.so and cpgplot.h located? Please add an attachment for long output.
Last edit: AstroFloyd 2015-10-10
I have libpgplot.a and cpgplot.h installed in /Users/user/pgplot531_gfortran. I went into ccmake and ater a few tries finally got cmake to recognize my pgplot library and include file locations (see the attached file). The problem is getting the linker to resolve what it believes to be are missing object files that I suspect are from X11. It seems I can't get cmake to point to my X11 libraries at /opt/X11.
Any thoughts?
Last edit: astro-boy 2015-10-10
I think this is an issue in your PGPlot installation - the library (libpgplot.a) doesn't seem to be linked against X11. I once found a similar issue with PGPlot in Arch Linux. The solution there was to add the "-lX11" flag to the make command:
(or edit the PGPlot Makefile and add it). Have you installed PGPlot manually or using e.g. Darwin Ports (it can be a pain)? Have you used it (succesfully) elsewhere?
Also, you mention libpgplot.a (the static library) - you should have a libpgplot.dylib (the dynamic or shared library - forget about the .so; my mistake), i.e. in the same dir to make life easier. I remember (from notes) that after the make step above, I had to do:
If this doesn't work, edit the makefile and add the -fPIC flags to the appropriate lines. The target "shared" may actually be called something like "pgplot.so".
Last edit: AstroFloyd 2015-10-11
I'm having trouble with linking X11 with evtools.
First, I found a procedure to build PGPlot in MacOS X that seems to work
well:
http://mingus.as.arizona.edu/~bjw/software/pgplot_fix.html
http://mingus.as.arizona.edu/%7Ebjw/software/pgplot_fix.html
Second, pointing cmake to /usr/local/lib/pgplot, I get the following
messages in building evtools:
users-MacBook-Pro:build user$ cmake ..
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler supports OSX deployment target flag
-- Checking whether Fortran compiler supports OSX deployment target flag
- yes
-- Looking for PGPLOT...
-- Found components for PGPLOT:
-- * PGPLOT_INCLUDES = /usr/local/lib/pgplot
-- * PGPLOT_LIBRARIES = /usr/local/lib/pgplot/libpgplot.a
--
-- Looking for LibSUFR...
-- Found components for LibSUFR:
-- * LibSUFR_INCLUDES = /usr/local/include/libSUFR
-- * LibSUFR_LIBRARIES = /usr/local/lib/libSUFR.dylib
--
-- Using Fortran compiler: gfortran 4.9.2 (/usr/local/bin/gfortran)
-- Compiling with run-time checks: -fcheck=all -ffpe-trap=zero,invalid
-fsignaling-nans -fbacktrace
-- Compiling with warnings: -Wall -Wextra
-- Compiler flags used: -std=f2008 -fall-intrinsics -pedantic
-fwhole-file -pipe -funroll-all-loops -O0 -fcheck=all
-ffpe-trap=zero,invalid -fsignaling-nans -fbacktrace -Wall -Wextra
-I/usr/local/include/libSUFR
--
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/user/evtools-0.4.1/build
users-MacBook-Pro:build user$ make
[ 2%] Building Fortran object CMakeFiles/ET.dir/src/functions.f90.o
[ 4%] Building Fortran object CMakeFiles/ET.dir/src/mdl_functions.f90.o
[ 7%] Building Fortran object CMakeFiles/ET.dir/src/plt_functions.f90.o
[ 9%] Building Fortran object CMakeFiles/ET.dir/src/code_version.f90.o
[ 11%] Building Fortran object CMakeFiles/ET.dir/src/plotfunctions.f90.o
[ 14%] Linking Fortran static library libET.a
[ 14%] Built target ET
[ 16%] Building Fortran object
CMakeFiles/ev_convert_initdat.dir/src/convert_initdat.f90.o
[ 19%] Linking Fortran executable ev_convert_initdat
[ 19%] Built target ev_convert_initdat
[ 21%] Building Fortran object CMakeFiles/ev_dat2plt.dir/src/dat2plt.f90.o
[ 23%] Linking Fortran executable ev_dat2plt
[ 23%] Built target ev_dat2plt
[ 26%] Building Fortran object CMakeFiles/ev_findplt.dir/src/findplt.f90.o
[ 28%] Linking Fortran executable ev_findplt
[ 28%] Built target ev_findplt
[ 30%] Building Fortran object CMakeFiles/ev_getgrid.dir/src/getgrid.f90.o
[ 33%] Linking Fortran executable ev_getgrid
[ 33%] Built target ev_getgrid
[ 35%] Building Fortran object CMakeFiles/ev_grid.dir/src/grid.f90.o
[ 38%] Linking Fortran executable ev_grid
[ 38%] Built target ev_grid
[ 40%] Building Fortran object CMakeFiles/ev_listmdl.dir/src/listmdl.f90.o
[ 42%] Linking Fortran executable ev_listmdl
[ 42%] Built target ev_listmdl
[ 45%] Building Fortran object CMakeFiles/ev_listmod.dir/src/listmod.f90.o
[ 47%] Linking Fortran executable ev_listmod
[ 47%] Built target ev_listmod
[ 50%] Building Fortran object CMakeFiles/ev_listplt.dir/src/listplt.f90.o
[ 52%] Linking Fortran executable ev_listplt
[ 52%] Built target ev_listplt
[ 54%] Building Fortran object CMakeFiles/ev_makerun.dir/src/makerun.f90.o
[ 57%] Linking Fortran executable ev_makerun
[ 57%] Built target ev_makerun
[ 59%] Building Fortran object CMakeFiles/ev_mergeplt.dir/src/mergeplt.f90.o
[ 61%] Linking Fortran executable ev_mergeplt
[ 61%] Built target ev_mergeplt
[ 64%] Building Fortran object CMakeFiles/ev_plotmdl.dir/src/plotmdl.f90.o
[ 66%] Linking Fortran executable ev_plotmdl
Undefined symbols for architecture x86_64:
"XAllocColor", referenced from:
_xw_update_colors in libpgplot.a(xwdriv.o)
"_XChangeGC", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
xw_end_cursor in libpgplot.a(xwdriv.o)
"_XCheckWindowEvent", referenced from:
_xw_check_window_event in libpgplot.a(xwdriv.o)
"_XClearWindow", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XCloseDisplay", referenced from:
_del_XWdev in libpgplot.a(xwdriv.o)
"_XCopyArea", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
xw_flush in libpgplot.a(xwdriv.o)
_xw_cursor_line in libpgplot.a(xwdriv.o)
"_XCreateGC", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XCreateImage", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XCreateSimpleWindow", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XDefineCursor", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
xw_end_cursor in libpgplot.a(xwdriv.o)
"_XDeleteProperty", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XDisplayName", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XDrawLine", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
xw_draw_cursor in libpgplot.a(xwdriv.o)
"_XDrawPoint", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XDrawRectangle", referenced from:
_xw_draw_cursor in libpgplot.a(xwdriv.o)
"_XFillArc", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XFillPolygon", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XFillRectangle", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XFlush", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
xw_flush in libpgplot.a(xwdriv.o)
_xw_query_server in libpgplot.a(xwdriv.o)
_xw_end_cursor in libpgplot.a(xwdriv.o)
_xw_draw_cursor in libpgplot.a(xwdriv.o)
"_XFree", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
del_XWdev in libpgplot.a(xwdriv.o)
"_XFreeColors", referenced from:
_xw_update_colors in libpgplot.a(xwdriv.o)
"_XFreeGC", referenced from:
_del_XWdev in libpgplot.a(xwdriv.o)
"_XGetErrorText", referenced from:
_xw_error in libpgplot.a(xwdriv.o)
"_XGetSelectionOwner", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XGetVisualInfo", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XGetWindowAttributes", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
xw_locate_cursor in libpgplot.a(xwdriv.o)
"_XGetWindowProperty", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XInternAtom", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
xw_new_geom in libpgplot.a(xwdriv.o)
"_XLookupString", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XMapRaised", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XNextEvent", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
xw_query_server in libpgplot.a(xwdriv.o)
"_XOpenDisplay", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XPutImage", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XQueryPointer", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
xw_locate_cursor in libpgplot.a(xwdriv.o)
"_XResizeWindow", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XSelectInput", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
del_XWdev in libpgplot.a(xwdriv.o)
_xw_add_events in libpgplot.a(xwdriv.o)
_xw_end_cursor in libpgplot.a(xwdriv.o)
"_XSendEvent", referenced from:
_xw_query_server in libpgplot.a(xwdriv.o)
"_XSetErrorHandler", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XSetForeground", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
xw_init_colors in libpgplot.a(xwdriv.o)
"_XSetWindowBackground", referenced from:
_xw_update_colors in libpgplot.a(xwdriv.o)
"_XStoreColors", referenced from:
_xw_update_colors in libpgplot.a(xwdriv.o)
"_XSync", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
xw_add_events in libpgplot.a(xwdriv.o)
_xw_end_cursor in libpgplot.a(xwdriv.o)
_xw_locate_cursor in libpgplot.a(xwdriv.o)
"_XVisualIDFromVisual", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
"XWarpPointer", referenced from:
_xwdriv in libpgplot.a(xwdriv.o)
_xw_locate_cursor in libpgplot.a(xwdriv.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [ev_plotmdl] Error 1
make[1]: *** [CMakeFiles/ev_plotmdl.dir/all] Error 2
make: *** [all] Error 2
users-MacBook-Pro:build user$
I'm still not able to build a shared PGPlot library.
Any suggestions?
Sam Dupree.
On 10/11/15 05:38:53, AstroFloyd wrote:
Related
Tickets: #2
I checked my notes on installing PGPlot and posted them on my blog.
The instructions you mention to build PGPlot also contain a method to create the shared library:
Doing that, and commenting out the other occurences of these two variables, allowed me to generate a shared library using the macos config file using "make shared". The command "ldd libpgplot.so" also shows that the library is linked against libX11.
If you insist on linking statically, the build tools provided with evtools are not going to help, and you'll have to write your own Makefile. The MacOS instructions give some idea how to do this - translated to gfortran and multiple source files:
My experience is that a .a file should be processed like a .o file, and that the order is important(!)
I've be able to rebuild PGPLOT with both shared and static libpgplot
files. I'm now able to successfully build evtools on my MacBook Pro. The
remaining question I have is locating documentation for evtools. I found
a link for ev documentation at
https://www.ualberta.ca/~ivanova1/astro465_2012.html
https://www.ualberta.ca/%7Eivanova1/astro465_2012.html. I can't get to
the documentation at this link, so is there an alternate URL you can
refer me to, or would you send me the documentation as an email attachment?
Thanks for all your help.
Sam Dupree
On 10/12/15 08:42:15, AstroFloyd wrote:
--
mail-signature
<iya-2009.jpg>
<mmb_emblem-2.gif> Samuel H. Dupree, Jr.sdupree@speakeasy.net
10501 Rising Ridge Road
Apartment 201 http://users.speakeasy.net/~sdupree/
Fredericksburg, VA 22407, USA</mmb_emblem-2.gif></iya-2009.jpg>
/ "The Greatest Show on Earth" is not on Earth. It's in Space!/
Related
Tickets: #2