The following is an example of how we are building DTK for use with MOOSE.  


Install one of our environment packages from our [Getting Started](http://mooseframework.org/getting-started/) pages.

Obtain Trilinos 11.14 from https://trilinos.org/download  
Extract the tarball and clone the DTK repository:  
```bash
tar -xf trilinos-11.14.3-Source.tar.gz
cd trilinos-11.14.3-Source
git clone https://github.com/ORNL-CEES/DataTransferKit.git
```
Note: At the time of writing these instructions, the DataTransferKit hash which was cloned was: `76502c937b4ec52b521b617f9cc399e98dc53f0d`


Make a build directory
```bash
mkdir build
cd build
```

Purge and load necessary modules, Build DTK.  
```bash
module purge
module load advanced_modules cmake moose-dev-gcc

cmake \
-D CMAKE_INSTALL_PREFIX:PATH=/opt/moose/trilinos \
-D CMAKE_INSTALL_NAME_DIR:STRING=/opt/moose/trilinos/lib \
-D CMAKE_BUILD_TYPE:STRING=RELEASE \
-D BUILD_SHARED_LIBS=ON \
-D CMAKE_VERBOSE_MAKEFILE:BOOL=OFF \
-D TPL_ENABLE_MPI:BOOL=ON \
-D TPL_ENABLE_MOAB=OFF \
-D TPL_ENABLE_BoostLib=OFF \
-D Trilinos_ENABLE_Ifpack=ON \
-D Trilinos_ENABLE_Ifpack2=ON \
-D Trilinos_ENABLE_Teuchos=ON \
-D Trilinos_ENABLE_ML=ON \
-D Trilinos_ENABLE_NOX=ON \
-D Trilinos_ENABLE_AztecOO=ON \
-D Trilinos_ENABLE_Epetra=ON \
-D Trilinos_ENABLE_EpetraExt=ON \
-D TPL_ENABLE_Libmesh=OFF \
-D MPI_BASE_DIR:PATH=$MPI_HOME \
-D Trilinos_ENABLE_CXX11:BOOL=ON \
-D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=OFF \
-D Trilinos_ASSERT_MISSING_PACKAGES=OFF \
-D Trilinos_EXTRA_REPOSITORIES="DataTransferKit" \
-D DataTransferKit_FIND_DTK_DATA_DIR=../DataTransferKit \
-D Trilinos_ENABLE_DataTransferKit:BOOL=ON \
-D DataTransferKit_ENABLE_DBC:BOOL=ON \
-D DataTransferKit_ENABLE_TESTS:BOOL=ON \
-D DataTransferKit_ENABLE_EXAMPLES:BOOL=ON \
-D CMAKE_Fortran_FLAGS_RELEASE_OVERRIDE=-fPIC \
-D CMAKE_C_FLAGS_RELEASE_OVERRIDE=-fPIC \
-D CMAKE_CXX_FLAGS_RELEASE_OVERRIDE=-fPIC \
..

make -j $MOOSE_JOBS
make install
```

You can now export the following environment variable and then build libMesh. libMesh will detect this environment variable and assume to enable Trilinos/DTK support.
```bash
export TRILINOS_DIR=/opt/moose/trilinos
```


Our out of tree libMesh configure line is as follows (for reference):
```bash
../configure --with-methods="opt" \
  --prefix=/some/location \
  --enable-silent-rules \
  --enable-unique-id \
  --disable-warnings \
  --enable-unique-ptr
```

Some versions of clang (at least the 3.5.0 we build from source in the MOOSE package) refuse to compile NOX.  Luckily there is a one-line fix for this issue: just apply the following patch: 
```
diff -u -r trilinos-11.14.3-Source.orig/packages/nox/src-lapack/NOX_LAPACK_Matrix.H trilinos-11.14.3-Source/packages/nox/src-lapack/NOX_LAPACK_Matrix.H
--- trilinos-11.14.3-Source.orig/packages/nox/src-lapack/NOX_LAPACK_Matrix.H	2015-04-17 13:05:04.000000000 -0600
+++ trilinos-11.14.3-Source/packages/nox/src-lapack/NOX_LAPACK_Matrix.H	2015-10-09 15:35:37.000000000 -0600
@@ -104,7 +104,7 @@
         stream << operator()(i,j) << " ";
       stream << "]" << std::endl;
     }
-    return stream;
+    return stream.good();
       }
 
       //! Returns the number of rows in the matrix
```