I've been for about five hours trying to compile a program which uses plplot. Any program. I tried with the ones listed on the examples category on the wiki page. Nevertheless, I have not been able to compile a single thing. I'm using gfortran. Could any one please post an example of the compiling instruction?
I've looked through all the wiki and SF page and cannot find an example of the compiling command for fortran, and the makefile of the examples does not tell me anything. I know a little C, but have never created makefiles so I can't read them well.
I think I should had explained myself better...
I'm using -just for practice- the example x08f.f90, a 3D plot demo located at the wiki page. I cut the code and paste it in the file prueba.f90 (test.f90 in english).
To make things easyier I copied the *.mod files located in ../plplot-5.9.1/lib/fortran/modules/plplot in the same directory as the fortran code.
When I type:
gfortran prueba.f90 -o prueba
I get the following errors:
/tmp/ccpyxRnm.o: In function `MAIN__':
prueba.f90:(.text+0x26): undefined reference to `plparseopts_'
prueba.f90:(.text+0x44b): undefined reference to `plinit_'
prueba.f90:(.text+0x45f): undefined reference to `pllightsource_'
prueba.f90:(.text+0x48b): undefined reference to `pladv_'
prueba.f90:(.text+0x4a4): undefined reference to `plvpor_'
prueba.f90:(.text+0x4bd): undefined reference to `plwind_'
prueba.f90:(.text+0x4c7): undefined reference to `plcol0_'
prueba.f90:(.text+0x50d): undefined reference to `__plplotp_MOD_plmtex'
prueba.f90:(.text+0x517): undefined reference to `plcol0_'
prueba.f90:(.text+0x58d): undefined reference to `plw3d_'
prueba.f90:(.text+0x5ff): undefined reference to `plw3d_'
prueba.f90:(.text+0x689): undefined reference to `__plplotp_MOD_plbox3'
prueba.f90:(.text+0x693): undefined reference to `plcol0_'
prueba.f90:(.text+0x7ff): undefined reference to `__plplot_MOD_plsurf3d'
prueba.f90:(.text+0x970): undefined reference to `__plplot_MOD_plsurf3d'
prueba.f90:(.text+0xae1): undefined reference to `__plplot_MOD_plsurf3d'
prueba.f90:(.text+0xc4e): undefined reference to `__plplot_MOD_plsurf3d'
prueba.f90:(.text+0xc95): undefined reference to `plend_'
/tmp/ccpyxRnm.o: In function `cmap1_init_':
prueba.f90:(.text+0xd71): undefined reference to `plscmap1n_'
prueba.f90:(.text+0xe87): undefined reference to `__plplot_MOD_plscmap1l2'
I'm sorry if this is a too stupid question, but well, I can't find the error!
thanks in advance...
You learn the most if you configure plplot with -DBUILD_TEST=ON option, e.g.
cmake -DBUILD_TEST=ON path_to_src
and then compile plplot with
The BUILD_TEST=ON option will take care that all examples will be build together with the plplot library in the build tree (also the Fortran examples) and VERBOSE=1 takes care, that you'll see on the terminal how make invokes to the compiler to build and link the examples.
Basically I think you also need to specify to link against the plplot library, e.g.
gfortran prueba.f90 -o prueba -lpath_to_import_libraries/libplplot.a
I re-installed, just to check out the make process. Finally I found a file which contained the libraries I needed to link too. Now, I'm not sure all of them are requiered, but I'll put the command just in case someone has the same problem I did. When I handle everything better I could post a better explanation.
The file was at ../plplot-5.9.1/examples/f95/CMakeFiles/x01f95.dir, link.txt.
The command I used to finally compiled a program was:
gfortran -fPIC $input -o $out -rdynamic /home/cemvicc/plplot/plplot-5.9.1/bindings/f95/libplplotf95d.so.9.1.1 /home/cemvicc/plplot/plplot-5.9.1/bindings/f95/libplplotf95cd.so.9.1.1 /home/cemvicc/plplot/plplot-5.9.1/src/libplplotd.so.9.6.0 /usr/lib64/libSM.so /usr/lib64/libICE.so /usr/lib64/libX11.so /usr/lib64/libXext.so /home/cemvicc/plplot/plplot-5.9.1/lib/csa/libcsirocsa.so.0.0.1 /usr/lib64/libm.so -Wl,-rpath,/home/cemvicc/plplot/plplot-5.9.1/bindings/f95:/home/cemvicc/plplot/plplot-5.9.1/src:/home/cemvicc/plplot/plplot-5.9.1/lib/csa
Looks pretty weird (kind of long!) ... but it worked!
maybe you can use pkg-config as described here
but I don't know if pkg-config also provides the flags for fortran.
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.