On 2010-01-15 17:38+0100 Joachim Geiger wrote:
> Joachim Geiger wrote:
>> I have troubles building the fortran examples on my linux system
>> (openSUSE 11.2, x86_64, gcc (SUSE Linux) 4.4.2 [gcc-4_4-branch revision
>> for plplot version 5.9.5. Everything works fine with building the examples
>> up to the point where x01f should be linked. There I get:
>> Linking CXX executable x01f
>> cd /home/geiger/build_dir/plplot-5.9.5_gfortran/examples/f77&&
>> /usr/bin/cmake -E cmake_link_script CMakeFiles/x01f.dir/link.txt --verbose=1
>> /usr/bin/c++ CMakeFiles/x01f.dir/x01f.f.o -o x01f -rdynamic
>> ../../bindings/f77/libplplotf77d.a ../../bindings/f77/libplplotf77cd.a
>> ../../src/libplplotd.a -lpangocairo-1.0 -lpango-1.0 -lcairo
>> -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lSM -lICE -lX11 -lXext -lSM
>> -lICE -lX11 -lXext -lpthread -pthread -lwx_baseu-2.8 -lwx_gtk2u_core-2.8
>> ../../lib/csa/libcsirocsa.a ../../lib/qsastime/libqsastime.a -lm
>> /usr/lib64/gcc/x86_64-suse-linux/4.4/../../../../lib64/crt1.o: In
>> function `_start':
>> undefined reference to `main'
>> CMakeFiles/x01f.dir/x01f.f.o: In function `MAIN__':
>> x01f.f:(.text+0x16): undefined reference to `_gfortran_set_options'
>> x01f.f:(.text+0x88): undefined reference to `_gfortran_st_write'
>> The obvious point I noted is that the linking is done with c++ and not
>> with gfortran. Entering the folder CMakefiles/x01f.dir and executing
>> the link-command with gfortran instead of c++ gives a nice working
>> Any idea where things could have went wrong? Or has anyone encountered the
>> problem before?
>> Best regards,
> Sorry, I need to add something, because I may have misunderstood something.
> I started the building with the following line:
> cmake -DCMAKE_INSTALL_PREFIX=/usr/local/gfortran_plplot595
> -DBUILD_TEST=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_DYNDRIVERS=OFF
> -DBUILD_SHARED_LIBS=OFF -DENABLE_octave=OFF -DPLD_plmeta=ON
> The main point is that it is done in the external build-directory
> prior to installation with setting -DBUILD_TEST=ON.
Thanks, Joachim, for that additional clarification. It illustrates how
important the exact cmake options are. I confirm the issue for cmake-2.8.0
and the svn trunk version of PLplot as well, but _just_ for the
-DBUILD_SHARED_LIBS=OFF case (which also forces -DENABLE_DYNDRIVERS=OFF).
I am pretty sure this is a cmake bug because if I switch to cmake-2.6.4
the problem disappears.
Would you confirm that version change (or a version change to anything in
the cmake-2.6.x series that is suitable for you) solves your issue as well?
Also, the problem disappears for both cmake-2.6.4 and 2.8.0 if I use the
default -DBUILD_SHARED_LIBS=ON, -DENABLE_DYNDRIVERS=ON case.
Thanks very much for your report, and I will be working on verifying that
this is really a cmake bug by using a simple test case rather than the whole
PLplot build (where we do a few special extra things with basic Fortran
language support under CMake which potentially might also be the source of
the problem here with cmake-2.8.0).
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.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