"Fossies" - the Fresh Open Source Software Archive

Member "plplot-5.15.0/doc/wiki_source/Building_PLplot_with_a_cross-compiler" (1 Jun 2019, 4101 Bytes) of package /linux/misc/plplot-5.15.0.tar.gz:

As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 <!---
    2 N.B.  The definitive Markdown source of this file is located in the
    3 doc/wiki_source subdirectory of the PLplot source tree.  So only use
    4 the ctrl-v and delete capabilities of the GUI file editor at
    5 SourceForge to make changes to the SourceForge version of this file,
    6 where ctrl-v is used to complete a cut and paste from the definitive
    7 version of this file in the PLplot source tree that is being edited
    8 with your favorite file editor, and delete used to remove extraneous
    9 unmodified text whose changed form has been copied with the cut and
   10 paste.
   11 -->
   13 From version 2.6.0 cmake includes support for cross-compiling. The [CMake wiki](http://www.cmake.org/Wiki/CMake_Cross_Compiling) provides a useful source of background information here.
   15 Cross-compiling plplot is complicated because a full build involves lots of external libraries for different drivers and multiple different compilers /interpreters for the language bindings. However, it is possible to build a cut-down version of PLplot using cmake. PLplot compiles and runs several executables to create source files / data for the project at build time. Obviously it is not generally possible to run the cross-compiled versions and so access is also required to a native build tree in which to find the native versions of the build-time executables. Support for this was only added to PLplot on 3rd March 2009 (svn revision 9665).
   17 The following instructions were written and tested on using the mingw32 cross-compiler for Windows running under Linux. Debian and Ubuntu supply packages for this environment so it is simple to install and test.
   19 Build a native version of PLplot
   20 --------------------------------
   22 This can just be a normal PLplot build. The only thing to be careful of it to ensure that it uses dynamic drivers if you intend to use them for the cross compiler otherwise get-drv-info will not be built.
   24 Create a CMake toolchain
   25 ------------------------
   27 See the [CMake wiki](http://www.cmake.org/Wiki/CMake_Cross_Compiling) for details of this for individual platforms. The mingw32 example worked fine for me.
   29 Building a cross-compiled version of PLplot
   30 -------------------------------------------
   32 -   Create a new directory for the cross-compile build and change to that directory.
   33 -   Run cmake.
   35 <!-- -->
   37 -   -   You probably want to disable all languages and drivers by default and then just enable the ones you need. You can achieve this by setting DEFAULT_NO_DEVICES=ON and DEFAULT_NO_BINDINGS=ON. Failure to do this can lead to strange results if cmake picks up native rather than cross-compiler versions of tools, for example the fortran compiler, which are not part of your toolchain.
   38     -   You will need to set the following CMake variables.
   39         -   CMAKE_TOOLCHAIN_FILE: points to the CMake toolchain file for this cross-compiler.
   40         -   CMAKE_NATIVE_BINARY_DIR: points to the top-level directory in the native PLplot build tree.
   41     -   You will need to disable pkg-config support or ensure that pkg-config is using the correct package information files for the cross-platform. The simplest way of disabling this is by setting PKG_CONFIG_EXECUTABLE to something like NOT-FOUND.
   42     -   You will either need to disable support for the CSA library, or explicitly set NanAwareCCompiler (probably to ON) since this uses a build-time executable to check for support. This can't be executed for a cross-compiled environment.
   44 <!-- -->
   46 -   Run make to build the cross-compiled version of PLplot.
   48 Using this method I have successfully cross-compiled the C++ bindings and the ps and svg drivers. Note that neither of these has external dependencies. For reference the cmake command line looked like
   50 `cmake -DCMAKE_TOOLCHAIN_FILE=~/Toolchain-mingw32.cmake -DDEFAULT_NO_DEVICES=ON -DPLD_ps=ON -DPLD_svg=ON -DPKG_CONFIG_EXECUTABLE=Not-Found -DDEFAULT_NO_BINDINGS=ON -DENABLE_cxx=ON -DNaNAwareCCompiler=ON -DCMAKE_NATIVE_BINARY_DIR=/home/andrew/software/plplot/build`
   51 `../plplot`
   54 The content of this page is available under the [GNU Free Documentation License 1.2](http://www.gnu.org/copyleft/fdl.html).