# OpenMC was not configuredwith DAGMC

**URL:** https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871
**Category:** User Support
**Created:** [March 28, 2022, 11:38am UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871 "2022-03-28T11:38:02Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![LukeLabrie](https://avatars.discourse-cdn.com/v4/letter/l/c37758/32.png) [@LukeLabrie](https://openmc.discourse.group/u/LukeLabrie)
#### Post date: [March 28, 2022, 11:38am UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/1 "2022-03-28T11:38:02Z")

</div>

I just installed OpenMC on a new machine and got the following error trying to use dagmc:

```auto
OpenMC was not configuredwith DAGMC

```

My installation is from source, and I included the dagmc flag (see below), so I’m not sure what the issue is here

```auto
#source install
cd /opt
sudo git clone --recurse-submodules --single-branch --branch develop --depth 1 https://github.com/openmc-dev/openmc.git
cd openmc
sudo mkdir build
cd build
sudo cmake -Doptimize=on \
           -Ddagmc=ON \
           -DDAGMC_ROOT=$HOME/openmc/DAGMC \
           -DHDF5_PREFER_PARALLEL=off ..
sudo make install
cd /opt/openmc/
sudo python setup.py install

```

Runs as the following version

```auto
 Version | 0.13.1-dev

```

Any ideas? Let me know if I can provide more detail.

Thanks,  
Luke

EDIT:

Here is the python script:

```auto
#Geometry
h5m_filepath = 'h5m_files/zpre.h5m'
dag_univ = openmc.DAGMCUniverse(filename=h5m_filepath)
geom = openmc.Geometry(root=dag_univ)
geom.export_to_xml()

```

---

<div class="post-metadata">

### Author: ![LukeLabrie](https://avatars.discourse-cdn.com/v4/letter/l/c37758/32.png) [@LukeLabrie](https://openmc.discourse.group/u/LukeLabrie)
#### Post date: [March 28, 2022, 11:48am UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/2 "2022-03-28T11:48:29Z")

</div>

I think I found the issue. Looks like the cmake option for dagmc in the latest version ([2. Installation and Configuration — OpenMC Documentation](https://docs.openmc.org/en/latest/usersguide/install.html#usersguide-build)) is `OPENMC_USE_DAGMC` instead of just `dagmc`. Will try recompiling and confirm.

---

<div class="post-metadata">

### Author: ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)
#### Post date: [March 28, 2022, 12:08pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/3 "2022-03-28T12:08:31Z")

</div>

@LukeLabrie That’s correct – the CMake option is indeed `OPENMC_USE_DAGMC` now due to a recent change.

---

<div class="post-metadata">

### Author: ![willia.smith-14](https://avatars.discourse-cdn.com/v4/letter/w/ecb155/32.png) [@willia.smith-14](https://openmc.discourse.group/u/willia.smith-14)
#### Post date: [June 22, 2022, 1:57pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/4 "2022-06-22T13:57:42Z")

</div>

Hi there, I have also had this issue when attempting to use dagmc. When installing from source

```auto
sudo cmake 
-Doptimize=on            
-DOPENMC_USE_DAGMC=ON            
-DDAGMC_ROOT=/home/williamjsmith15/dagmc_bld/DAGMC/DAGMC -DHDF5_PREFER_PARALLEL=off

```

I get the error:

```auto
CMake Warning:
  No source or binary directory provided. Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.

-- Configuring DAGMC 3.2.2
CMake Error at /home/williamjsmith15/dagmc_bld/DAGMC/DAGMC/CMakeFiles/Export/lib/cmake/dagmc/DAGMCTargets.cmake:111 (message):
  The imported target "dagmc-shared" references the file

     "/home/williamjsmith15/dagmc_bld/DAGMC/DAGMC/CMakeFiles/Export/lib/libdagmc.so"

  but this file does not exist. Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/home/williamjsmith15/dagmc_bld/DAGMC/DAGMC/CMakeFiles/Export/lib/cmake/dagmc/DAGMCTargets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /home/williamjsmith15/dagmc_bld/DAGMC/DAGMC/DAGMCConfig.cmake:31 (include)
  CMakeLists.txt:70 (find_package)

```

Any ideas at a solution? The libdagmc.so file is not in that location but I have followed the installation steps as per the DAGMC website.

Thanks,  
Will

---

<div class="post-metadata">

### Author: ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)
#### Post date: [June 22, 2022, 3:57pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/5 "2022-06-22T15:57:01Z")

</div>

Hi @willia.smith-14 and welcome to the community! Sorry to hear you’re having trouble building with DAGMC. Maybe @pshriwise (our local DAGMC expert) can chime in. In the meantime, if you don’t see the libdagmc.so file, what do you see in the `/home/williamjsmith15/dagmc_bld/DAGMC/DAGMC/CMakeFiles/Export/lib/` directory?

---

<div class="post-metadata">

### Author: ![pshriwise](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pshriwise/32/3863_2.png) [@pshriwise](https://openmc.discourse.group/u/pshriwise)
#### Post date: [June 22, 2022, 10:01pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/6 "2022-06-22T22:01:18Z")

</div>

Hi Will!

Thanks for posting here. Hopefully we can get you up and running with a few tweaks to your CMake line. What would be helpful for me to see is the CMake command you used when building DAGMC if you wouldn’t mind sharing it.

-Patrick

---

<div class="post-metadata">

### Author: ![willia.smith-14](https://avatars.discourse-cdn.com/v4/letter/w/ecb155/32.png) [@willia.smith-14](https://openmc.discourse.group/u/willia.smith-14)
#### Post date: [June 22, 2022, 10:16pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/7 "2022-06-22T22:16:34Z")

</div>

Hi Patrick,

Thanks for getting back so quick! I used the one in the DAGMC Guide (Installing for use with OpenMC, [Installing for use with OpenMC — DAGMC](https://svalinn.github.io/DAGMC/install/openmc.html)):

```auto
cmake ../src -DMOAB_DIR=$HOME/dagmc_bld/MOAB \
               -DBUILD_TALLY=ON \
               -DCMAKE_INSTALL_PATH=$INSTALL_PATH

```

Thanks

---

<div class="post-metadata">

### Author: ![willia.smith-14](https://avatars.discourse-cdn.com/v4/letter/w/ecb155/32.png) [@willia.smith-14](https://openmc.discourse.group/u/willia.smith-14)
#### Post date: [June 22, 2022, 10:18pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/8 "2022-06-22T22:18:43Z")

</div>

Paul,

Thanks for getting back to me so quick!  
The path just has a cmake file in it

 ![image](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/7/7935d6a32dcebdbd5e55630e45ff90d634ceea6e.png)

Thanks

---

<div class="post-metadata">

### Author: ![pshriwise](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pshriwise/32/3863_2.png) [@pshriwise](https://openmc.discourse.group/u/pshriwise)
#### Post date: [June 22, 2022, 10:44pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/9 "2022-06-22T22:44:10Z")

</div>

Thanks Will!  
I would try the following CMake command when configuring OpenMC:

```auto
sudo cmake ../src
-Doptimize=on            
-DOPENMC_USE_DAGMC=ON            
-DCMAKE_PREFIX_PATH=$INSTALL_PATH
-DHDF5_PREFER_PARALLEL=off

```

The `CMAKE_PREFIX_PATH` variable is an updated way of providing the DAGMC installation location.

---

<div class="post-metadata">

### Author: ![willia.smith-14](https://avatars.discourse-cdn.com/v4/letter/w/ecb155/32.png) [@willia.smith-14](https://openmc.discourse.group/u/willia.smith-14)
#### Post date: [June 24, 2022, 11:54am UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/10 "2022-06-24T11:54:48Z")

</div>

Thanks Patrick,

Is this run in the build folder of the OpenMC install location? When running it there it just spits out:

```auto
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>
  cmake [options] -S <path-to-source> -B <path-to-build>

Specify a source directory to (re-)generate a build system for it in the
current working directory. Specify an existing build directory to
re-generate its build system.

Run 'cmake --help' for more information.

-Doptimize=on: command not found
-DOPENMC_USE_DAGMC=ON: command not found
-DCMAKE_PREFIX_PATH=: command not found
-DHDF5_PREFER_PARALLEL=off: command not found

```

I’ve tried running it on a fresh install of OpenMC and running it after the `cmake ..` , `make` and `make install` as shown in the installing from source guide.

Thanks  
Will

---

<div class="post-metadata">

### Author: ![pshriwise](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pshriwise/32/3863_2.png) [@pshriwise](https://openmc.discourse.group/u/pshriwise)
#### Post date: [June 24, 2022, 12:14pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/11 "2022-06-24T12:14:49Z")

</div>

Ah, yeah the CMake command I provided above was missing the path to the source directory. I’ve updated it to include that based on the path used above.

---

<div class="post-metadata">

### Author: ![KSartakov](https://avatars.discourse-cdn.com/v4/letter/k/76d3ee/32.png) [@KSartakov](https://openmc.discourse.group/u/KSartakov)
#### Post date: [November 14, 2022, 4:46pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/12 "2022-11-14T16:46:15Z")

</div>

Hello!

I have been following this thread because Im stuck with the same problem. While trying to plot the geometry or run openmc I get the following error:

RuntimeError: DAGMC Universes are present but OpenMC was not configuredwith DAGMC

I have followed the instruction given in the answers above but I still run into the same error. Im new to openmc and dagmc so I don’t really know how to solve this error or from where I could find some solutions. I would greatly appreciate it, if someone could lead me in the right direction.

---

<div class="post-metadata">

### Author: ![pshriwise](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pshriwise/32/3863_2.png) [@pshriwise](https://openmc.discourse.group/u/pshriwise)
#### Post date: [November 15, 2022, 3:23pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/13 "2022-11-15T15:23:38Z")

</div>

Hi @KSartakov! Welcome to the forum!

There are a couple of reasons you might be seeing this error. You’ll want to make sure you’ve built the OpenMC library and executable with DAGMC enabled ([instructions here](https://docs.openmc.org/en/stable/usersguide/install.html?highlight=DAGMC#cmakelists-txt-options)).

Also, if you built OpenMC once without DAGMC, installed the Python API, and then re-built OpenMC with DAGMC support, do make sure you install the Python API again so the updated OpenMC library gets included with the Python package. The plotter will rely on this library rather than the one placed in the installation location by CMake.

I hope this helps! Let us know if you have any additional questions.

-Patrick

---

<div class="post-metadata">

### Author: ![Shimwell](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/shimwell/32/3876_2.png) [@Shimwell](https://openmc.discourse.group/u/Shimwell)
#### Post date: [November 15, 2022, 6:25pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/14 "2022-11-15T18:25:04Z")

</div>

I just wanted to add that Gavin added this nice feature recently. Typing openmc -v will let you know how it was built and if dagmc is included or not.

> <https://github.com/openmc-dev/openmc/pull/2253>
>
> Allows some printing of basic build options. This way, people wouldn't have to t…est with a libmesh input or similar to find out if their installation supports that feature. Personally I would have found this convenient when doing an install through spack. This would also likely be useful when helping users debug their inputs.
> 
> This functionality could be expanded a little bit further. One option is to add the date (as python shows when ran in REPL mode), but that makes it so that two binaries compiled with identical options/compiler are not the same. This seemed like it wouldn't be worth it as there's probably some value to having a perfectly reproducible compile.
> 
> Another aspect is that we have both a short form and long form of command line arguments, but this seems it would be so infrequently used that it almost doesn't deserve a shortcut like -b. Maybe just --build-info would be OK, but it would stick out like a sore thumb.
> 
> Example:
> 
> \`\`\`
> gpad% openmc -h
> Usage: openmc \[options\] \[directory\]
> 
> Options:
> -c, --volume Run in stochastic volume calculation mode
> -g, --geometry-debug Run with geometry debugging on
> -n, --particles Number of particles per generation
> -p, --plot Run in plotting mode
> -r, --restart Restart a previous run from a state point
> or a particle restart file
> -s, --threads Number of OpenMP threads
> -t, --track Write tracks for all particles (up to max\_tracks)
> -e, --event Run using event-based parallelism
> -v, --version Show version information
> -b, --build-info Show compile options
> -h, --help Show this message
> 
> gpad% openmc -b
> Build type: RelWithDebInfo
> Compiler ID: GNU 12.1.0
> MPI enabled: no
> Parallel HDF5 enabled: no
> PNG support: yes
> DAGMC support: no
> libMesh support: no
> Coverage testing: no
> Profiling flags: no
> 
> \`\`\`
> 
> Thoughts?

---

<div class="post-metadata">

### Author: ![soha](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/soha/32/3658_2.png) [@soha](https://openmc.discourse.group/u/soha)
#### Post date: [January 4, 2023, 11:48pm UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/15 "2023-01-04T23:48:51Z")

</div>

I had a similar issue, but it is resolved! Thanks @pshriwise!

---

<div class="post-metadata">

### Author: ![pshriwise](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pshriwise/32/3863_2.png) [@pshriwise](https://openmc.discourse.group/u/pshriwise)
#### Post date: [January 5, 2023, 3:46am UTC](https://openmc.discourse.group/t/openmc-was-not-configuredwith-dagmc/1871/16 "2023-01-05T03:46:15Z")

</div>

Hi @soha,

For clarity, the command I provided above should be run in the OpenMC build directory rather than DAGMC. Also, that command is intended to be run on one line, but from your post and from @willia.smith-14’s above, I can see that it won’t work that way if copied into a terminal. Here’s an updated version of that command that will execute as one line if copied in.

```bash
sudo cmake ../src \
-Doptimize=ON \     
-DOPENMC_USE_DAGMC=ON \
-DCMAKE_PREFIX_PATH=$INSTALL_PATH \
-DHDF5_PREFER_PARALLEL=OFF

```

I hope this helps get you further with the installation.

Best,

Patrick
