On 2014-01-03 11:43-0500 Tom Kacvinsky wrote: > OK, here is what I have found: when building Ada executables, we link > against two other libraries, one with C code, one with C++ code. CMake > keeps track of this and adds implicit dependencies. Thus, when we link > against the C++ built library, -lstdc++ comes along for the ride.
Hi Tom: So it is a linking issue, and you can therefore largely ignore the post I just made. The simple cmake test case that I referred to in that post doesn't have the equivalent case of linking to a C library so if you try that case, you won't have these linking issues. However, our PLplot build system certainly does have an equivalent case; our principal Ada library (called libplplotadad) is linked to our principal C PLplot library (called libplplotd). To see how our principal Ada library is built by our build system logic look at bindings/ada/CMakeLists.txt within plplot-5.9.11.tar.gz. The resulting build steps are recorded in the build_x02a.out.gz file I attached previously. Look there for the following lines (without the e-mail wrapping issues). [100%] Building Ada object bindings/ada/CMakeFiles/plplotadad.dir/plplot.o cd /home/software/plplot_svn/HEAD/build_dir/bindings/ada && /usr/bin/gnatgcc -fPIC -c /home/software/plplot_svn/HEAD/plplot_allura/bindings/ada/plplot.adb -o CMakeFiles/plplotadad.dir/plplot.o /home/software/cmake/install-2.8.12/bin/cmake -E cmake_progress_report /home/software/plplot_svn/HEAD/build_dir/CMakeFiles [100%] Building Ada object bindings/ada/CMakeFiles/plplotadad.dir/plplot_thin.o cd /home/software/plplot_svn/HEAD/build_dir/bindings/ada && /usr/bin/gnatgcc -fPIC -c /home/software/plplot_svn/HEAD/plplot_allura/bindings/ada/plplot_thin.adb -o CMakeFiles/plplotadad.dir/plplot_thin.o /home/software/cmake/install-2.8.12/bin/cmake -E cmake_progress_report /home/software/plplot_svn/HEAD/build_dir/CMakeFiles [100%] Building Ada object bindings/ada/CMakeFiles/plplotadad.dir/plplot_traditional.o cd /home/software/plplot_svn/HEAD/build_dir/bindings/ada && /usr/bin/gnatgcc -fPIC -c /home/software/plplot_svn/HEAD/plplot_allura/bindings/ada/plplot_traditional.adb -o CMakeFiles/plplotadad.dir/plplot_traditional.o /home/software/cmake/install-2.8.12/bin/cmake -E cmake_progress_report /home/software/plplot_svn/HEAD/build_dir/CMakeFiles [100%] Building Ada object bindings/ada/CMakeFiles/plplotadad.dir/plplot_auxiliary.o cd /home/software/plplot_svn/HEAD/build_dir/bindings/ada && /usr/bin/gnatgcc -fPIC -c /home/software/plplot_svn/HEAD/plplot_allura/bindings/ada/plplot_auxiliary.adb -o CMakeFiles/plplotadad.dir/plplot_auxiliary.o Linking Ada shared library libplplotadad.so cd /home/software/plplot_svn/HEAD/build_dir/bindings/ada && /home/software/cmake/install-2.8.12/bin/cmake -E cmake_link_script CMakeFiles/plplotadad.dir/link.txt --verbose=1 /usr/bin/gnatgcc -fPIC -shared -Wl,-soname,libplplotadad.so.1 -o libplplotadad.so.1.0.0 CMakeFiles/plplotadad.dir/plplot.o CMakeFiles/plplotadad.dir/plplot_thin.o CMakeFiles/plplotadad.dir/plplot_traditional.o CMakeFiles/plplotadad.dir/plplot_auxiliary.o ../../src/libplplotd.so.12.0.0 /usr/lib/x86_64-linux-gnu/libgnat.so -Wl,-rpath,/home/software/plplot_svn/HEAD/build_dir/src:/home/software/plplot_svn/HEAD/build_dir/lib/csa:/home/software/plplot_svn/HEAD/build_dir/lib/nn:/home/software/plplot_svn/HEAD/build_dir/lib/qsastime: -Wl,-rpath-link,/home/software/plplot_svn/HEAD/build_dir/lib/csa:/home/software/plplot_svn/HEAD/build_dir/lib/nn:/home/software/plplot_svn/HEAD/build_dir/lib/qsastime Clearly, there are no extra C library flags such as -lm or -lc. Therefore, I strongly suggest you should just copy what we do in bindings/ada/CMakeLists.txt, and that should likely solve the problem of the extra C++ library flags (such as -lstdc++) for your case where the linked library is written in C++ rather than C. Alan __________________________ 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); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); 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 __________________________ ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel