Thank you Alan and Arjen -pthread works just fine in the link. I don't think it is needed in the compile stage as cmake must automatically entail it. Unless there is a way of configuring cmake to not do this? BTW on my first run of cmake, -DBUILD_SHARED_LIBS was absent so shared libraries were generated instead of static ones. Then, the compilation and linking of PlPlotTest.c went all the way without error. But the executable would not run and produced an error message about not being able to use the shared libraries - I'm afraid I don't have a copy of the exact message. I then re-ran cmake to produce static libraries. Best Wishes Peter
On Thu, 23 Jul 2020 at 08:59, Alan W. Irwin <alan.w.irwin1...@gmail.com> wrote: > On 2020-07-22 20:38+0100 Peter Williams wrote: > > > Hello Plplot > > I am at present migrating some PlPlot programs from Windows 10 to linux > > (mint 64 bit), > > To facilitate this I have downloaded cmake and Plplot-5.15.0.tar.gz from > > your website. > > Following the instructions from your wiki I built an installation > > consisting of static > > libraries. In order to test the installation I wrote a very simple > program > > PlPlotTest.c: > > > > #include <stdio.h> > > #include "plplot.h" > > int main() > > { > > printf("Plotting example\n"); > > plsdev("ps"); plsfnam("TestPlplot.ps");plinit(); > > plenv(-1.0 , 1.0 ,-1.0,1.0,1,2); > > pljoin(-0.5,-0.5,0.5,0.5); > > plend(); > > printf("Plot finished\n"); > > return 1; > > } > > and attempted to compile it with > > > > gcc -c -I /home/peter/plplot/install_directory/include/plplot > PlPlotTest.c > > gcc -o PlPlotTest.exe PlPlotTest.o -L > > /home/peter/plplot/install_directory/lib -lplplot -lcsirocsa -lqsastime > > -lm -lX11 > > > > An object file PlPlotTest.o was generated with no errors, but the linking > > failed with [undefined pthread library references]. > > > I am very new to linux. Can you tell me what the linking should be? > > Hi Peter: > > If you execute "man gcc" and look for the -pthread option it says > > "-pthread > Define additional macros required for using the POSIX threads library. > You should use this option > consistently for both compilation and linking." > > Therefore, I suggest you add the -pthread option to *both* the compile > (gcc -c ....) and link (gcc -o ....) steps above to see if those > changes solve solve the pthread library linking issues you have > encountered. > > Alan > > __________________________ > Alan W. Irwin > > Research affiliation with the Department of Physics and Astronomy, > University of Victoria, Victoria, BC, Canada. > > Programming affiliations with the FreeEOS equation-of-state > implementation for stellar interiors (freeeos.sf.net); the Time > Ephemerides project (timeephem.sf.net); PLplot scientific plotting > software package (plplot.org); the libLASi project > (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); > and the Linux Brochure Project (lbproject.sf.net). > __________________________ > > Linux-powered Science > __________________________ > -- Peter Williams petesweet2...@gmail.com 27 Ramsbury Road, St. Albans, AL1 1SN, UK
_______________________________________________ Plplot-general mailing list Plplot-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-general