I downloaded and compiled plplot 5.9.1 on Windows using cmake and mingw. It all seemed to go well. I then built some of the examples and that seemed to go fine. However when I run the program for any of the examples, it just quits with no error messages. I've no idea why.
I'll be doing most of the developing on Mac OS and I successfully did all of that on my Mac just a few minutes prior. I need to distribute the project for Mac, Windows and Linux and I'm just making sure I compile the examples on all OS's before pushing ahead with the project.
The only 'strange' thing I had to do was put absolute locations in the makefile and the header files to the plplot includes and the plplot libraries, i.e. C:\Program files\plplot\include and \lib\*.a. It wouldn't compile without this. Messy way of doing it I know, but for me it was the quickest fix. Everything else was according to the documentation.
Sorry I haven't given much information. I don't know what else I can tell you.
Any help is greatly appreciated,
regarding the examples, which quit without messages:
* what is your exact call to cmake, how to you configure the build? It would also be helpful if you could post the output of cmake
* where do you run the examples? In the build tree or in the install tree? How do you run them?
regarding cross platfrom: I regularily compile and run plplot on Mac OS X, Linux and Windows, so no problem here, I also use it for a project which runs on all three platforms.
regarding absolute paths: where do you put them? In the examples or in your code?
Thanks for your prompt reply. I try to answer each of your questions below:
- Exact calls to cmake
I tried both of these (from http://www.miscdebris.net/plplot_wiki/index.php?title=Configure_PLplot_for_MinGW/CLI\):
cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=install ..
cmake -G "MinGW Makefiles" -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=install ..
I thought I'd also try a static build in case it wasn't finding and loading the libraries. It made no difference.
- Output from cmake
C:\plplot-5.9.1\plplot-build>cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=i
-- WARNING: bash shell not found, ctest will not work properly
-- Checking whether system has ANSI C header files
-- ANSI C header files - found
-- SWIG was not found. Please specify Swig executable location
-- Could NOT find Perl (missing: PERL_EXECUTABLE)
-- Looking for pkg-config - not found
-- WARNING: Install-tree build will be disabled.
-- X11_FOUND =
-- X11_INCLUDE_DIR =
-- X11_COMPILE_FLAGS =
-- X11_LIBRARIES =
-- ENABLE_tcl is OFF so disabling everything else that is Tcl/Tk related
-- WARNING: pango not found because pkg-config not available.
-- Looking for gdi32 header and library
-- Looking for gdi32 header and library - found
Summary of CMake build system results for PLplot
Install location variables which can be set by the user:
Derived install location variables:
Other important CMake variables:
MSVC: (MSVC_VERSION: )
CMAKE_C_COMPILER CMAKE_C_FLAGS: C:/MinGW/bin/gcc.exe
CMAKE_CXX_COMPILER CMAKE_CXX_FLAGS: C:/MinGW/bin/g++.exe
BUILD_SHARED_LIBS: OFF PL_DOUBLE: ON
HAVE_QHULL: OFF WITH_CSA: ON
ENABLE_f77: OFF ENABLE_f95: OFF
ENABLE_cxx: ON ENABLE_java: OFF
ENABLE_python: OFF ENABLE_octave: OFF
ENABLE_tcl: OFF ENABLE_itcl: OFF
ENABLE_tk: OFF ENABLE_itk: OFF
ENABLE_pdl: OFF ENABLE_wxwidgets: OFF
ENABLE_gnome2: OFF ENABLE_pygcw: OFF
ENABLE_ada: OFF ENABLE_d:
-- Configuring done
-- Generating done
-- Build files have been written to: C:/plplot-5.9.1/plplot-build
I was running the examples from the build tree. I also just compiled and ran a simple program which just calls plinit() in main(), i.e. the most basic case I could think of. On the mac, the gives me a choice of output devices. On Windows, it just quits immediately.
I ran them from the command line (i.e. cmd) and I tried just a double-click on the exe in explorer as well.
- Absolute paths
I haven't done any of my own coding with PLplot yet (this is icing on the cake hopefully squeezed into the project just a couple of days before an interim submission to my uni tutor). The absolute paths were added to the example codes.
i.e. in x01.cc it has:
#include "plevent.h" which I changed to #include "C:/Program Files/plplot/include/plplot/plevent.h"
and in plc++demos.h it has:
#include "plstream.h" which I changed to #include "C:/Program Files/plplot/include/plplot/plstream.h"
Making the changes allowed it to compile.
When linking it, this doesn't work:
g++ x01.o -lplplotd -lplplotcxx -o x01.exe
I therefore did:
g++ x01.o "C:\PROGRA~1\plplot\lib\libplplotcxxd.dll.a" "C:\PROGRA~1\plplot\lib\libplplotd.dll.a" -o x01.exe
It then links fine but won't run.
I know I need to set up my MinGW environment to find the PLplot includes and libraries, but I don't know how to do that (I'll google it later). Surley the fact it compiles and links indicates it's probably not absolute paths causing the problem? It don't know though, which is why I'm here.
Thanks very much,
this seems all to be ok, apart from the way how you compile the examples. As in Mac OS X and Linux you tell gcc where the header files can be found with "-IC:/Program Files/plplot/include/plplot" and where the libraries are found with "-LC:\PROGRA~1\plplot\lib -lplplotcxxd.dll". The libraries may also be linked in as you did.
CMake can be configured so that all examples are build automatically and this is what you should try first. The corresponding option is
(see http://www.miscdebris.net/plplot_wiki/index.php?title=CMake_options_for_PLplot\). The examples are then in build_tree/examples/c. cd into this directory and run the examples. If you have a shared library you must first set the path in the cli so that the dlls can be found:
It seems that the examples don't run, since the dlls can't be found, and if you alway linked to "C:\PROGRA~1\plplot\lib\libplplotd.dll.a" also the static build won't work. If this works ok, then you should have a look how the examples are build. First clean the build tree
and then run make again with the VERBOSE=1 option
This time the make process is verbose about what it is doing and you can see in the CLI then what options are used to build the examples. Copy them more or less in you Makefile/Batch file/whatever and you should be ok.
Thanks very much for your help. It all works now.
I ran the build cmake with -DBUILD=ON and all the examples compiled.
Running mingw32-make VERBOSE=1 was the most helpful - I could see exactly what I need to put in my makefile. I must remember this tool!
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.