Developer Tutorials/Cross Compilation

If your app or applet will package any architecture-dependent resources (such as executables compiled from C or C++) you will need to ensure that you can produce resources targeting the Execution Environment platform: Ubuntu 14.04 or 12.04 running on a 64-bit processor.

The DNAnexus Platform and the SDK provide some assistance with this if your development machine is not running Ubuntu 14.04 or 12.04 on a 64-bit processor.

You can run dx build or dx build --create-app with the --remote flag, for example:

$ dx build --remote myapplet $ dx build --create-app --remote --publish myapp

This uploads the target directory from your local machine to the DNAnexus platform and runs the remaining steps (./configure, make, and dx build or dx build --create-app) in a virtualized Ubuntu 14.04 or 12.04 environment, depending on the release version specified in dxapp.json.

Build-time dependencies

If your app requires certain dependencies at build time, you can specify them in the runSpec.buildDepends field of your dxapp.json. You can specify any package that is available in the Ubuntu 14.04 or 12.04 repositories.

{ [...]
  "runSpec": { [...]
    "execDepends": [
      {"name": "libfreecell-solver0"}
    ],
    "buildDepends": [
      {"name": "libfreecell-solver-dev"}
    ]
  }
}

Note that, as in this example, some header dependencies will also require a corresponding library dependency to be installed at the app's runtime.

Caveats

  • Some dx build flags cannot be used in conjunction with --remote at the moment. Supplying these flags will cause an error to be raised.

  • If you have tested building your app on your local machine, you may have compiled resources targeting your local machine (not targeting the Platform environment), and yet these resources might not be recompiled by the remote build. This is because from make's perspective the compiled object was compiled later than the source file and is therefore considered up-to-date. If you believe your app might be susceptible to this, run your make clean target or your version control system's "clean" functionality (e.g. git clean) to remove any such resources before you run dx build --remote or dx build --create-app --remote. (In general, cleaning the directory before you upload it will also save bandwidth and time.)

  • dx build --remote --destination=PROJ:FOLDER/NAME will automatically create the folder FOLDER if it doesn't exist (the non-remote build with the same options will fail if FOLDER doesn't exist).

Last edited by commandlinegirl, 2017-10-20 00:31:12

 Feedback