OpenMC was not configuredwith DAGMC

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

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

#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

 Version | 0.13.1-dev

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

Thanks,
Luke

EDIT:

Here is the python script:

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

I think I found the issue. Looks like the cmake option for dagmc in the latest version (2. Installation and Configuration — OpenMC Documentation) is OPENMC_USE_DAGMC instead of just dagmc. Will try recompiling and confirm.

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

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

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

I get the error:

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

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?

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

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):

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

Thanks

Paul,

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

Thanks

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

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.

Thanks Patrick,

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

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

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.

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.

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).

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

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.

1 Like

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

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.

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

1 Like