The module did not compile with command

Hi there,

I am trying to run some fenics code for solids with Ubuntu on my Windows pc.
I installed version fenics=2017.2.0 with python=3.6 sympy=1.1.1 boost=1.65 libboost=1.65.

Some parts of fenics seem to run fine, since I can create a mesh and define function spaces. However, when I use “Expression()” I get the following error:

" RuntimeError: In instant.recompile: The module did not compile with command ‘cmake -DDEBUG=TRUE .’ "

I also get this error when using “CompiledSubDomain()”

My code is below:

import

from dolfin import *
from fenics import *
import numpy as np

Define mesh parameters

Lx = 2. # [cm] -length of patch
Ly = 1.
Lz = 1.
Nx = 4
Ny = 2
Nz = Ny
elem_dg = 2 # set the degree of mesh elements

Create mesh and define function space

mesh = BoxMesh(Point(0,0,0),Point(Lx,Ly,Lz),Nx,Ny,Nz)
V_normal = FunctionSpace(mesh, “Lagrange”,elem_dg)
V_vector = VectorFunctionSpace(mesh, “Lagrange”, elem_dg)
V_tensor = TensorFunctionSpace(mesh, “Lagrange”, elem_dg)

fiber_exp = Expression((“1.0”, “0.0”,“0.0”), element=V_vector.ufl_element())

The full error message is:

File “question.py”, line 30, in
fiber_exp = Expression((“1.0”, “0.0”,“0.0”), element=V_vector.ufl_element())
File “/home/mvdknaap/anaconda3/envs/fenics-2017-2-new/lib/python3.6/site-packages/dolfin/functions/expression.py”, line 679, in new
mpi_comm=kwargs.get(“mpi_comm”))
File “/home/mvdknaap/anaconda3/envs/fenics-2017-2-new/lib/python3.6/site-packages/dolfin/compilemodules/expressions.py”, line 266, in compile_expressions
mpi_comm=mpi_comm)
File “/home/mvdknaap/anaconda3/envs/fenics-2017-2-new/lib/python3.6/site-packages/dolfin/compilemodules/expressions.py”, line 183, in compile_expression_code
mpi_comm=mpi_comm)
File “/home/mvdknaap/anaconda3/envs/fenics-2017-2-new/lib/python3.6/site-packages/dolfin/compilemodules/jit.py”, line 70, in mpi_jit
return local_jit(*args, **kwargs)
File “/home/mvdknaap/anaconda3/envs/fenics-2017-2-new/lib/python3.6/site-packages/dolfin/compilemodules/compilemodule.py”, line 603, in compile_extension_module
**instant_kwargs)
File “/home/mvdknaap/anaconda3/envs/fenics-2017-2-new/lib/python3.6/site-packages/instant/build.py”, line 577, in build_module
build_system)
File “/home/mvdknaap/anaconda3/envs/fenics-2017-2-new/lib/python3.6/site-packages/instant/build.py”, line 158, in recompile
instant_error(msg % (cmd, compile_log_filename_dest))
File “/home/mvdknaap/anaconda3/envs/fenics-2017-2-new/lib/python3.6/site-packages/instant/output.py”, line 96, in instant_error
raise RuntimeError(text)
RuntimeError: In instant.recompile: The module did not compile with command ‘cmake -DDEBUG=TRUE .’, see ‘/home/mvdknaap/anaconda3/envs/fenics-2017-2-new/.cache/instant/error/dolfin_16904bd4f218f3971471e7768edfd087b53fdf38/compile.log’

The compile log tells:
CMake Error: CMake was unable to find a build program corresponding to “Unix Makefiles”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage

CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

– Configuring incomplete, errors occurred!

See also “/tmp/tmpbj70l9s_2020-12-28-11-08_instant_44f59f19d720d7567e1428c71e966a4151401d3b/dolfin_16904bd4f218f3971471e7768edfd087b53fdf38/CMakeFiles/CMakeOutput.log”.

compile.log (END)

I guess some versions are not compatible, but my knowledge in software is not sufficient to some this. I am still using the older version because the models I will use later on are not compatible with the newer fincs versions. It would be really nice if someone could help me fix this problem, so I can finally start building some models instead of keep struggling with the installation.

Thanks in advance,

Maite

Seems like you are using the wrong version of cmake: https://stackoverflow.com/questions/59099924/cmake-error-cmake-was-unable-to-find-a-build-program-corresponding-to-unix-mak

The easiest way of using dolfin of Windows is by using docker (Which has easy access to a large span of versions, 2016.2.0-dev version), and saves you from installation issues.

Thanks a lot for your reply. Though I do not really know how to solve it. In the link you shared they are doing cross compiling, but I am trying to install and run with ubuntu.

Also they say: “the problem is about the version of cmake 3.16.0 has this problem, but it can build under 3.10.3.”
My cmake version is 3.18.2. Should I also change it to 3.10.3? And if so, how do I do that?

Thankyou,

Maite

If you are installing dolfin from source, you should be able to follow How to install dolfin on Ubuntn-20.04 from source

I still recommend using docker, as you can then skip all installation by running


docker run -ti -p 127.0.0.1:8000:8000 -v $(pwd):/home/fenics/shared -w /home/fenics/shared quay.io/fenicsproject/stable:current

It took a while but the problem is solved. Running the lines:

Sudo apt-get install make
Sudo apt-get install --reinstall pkg-config cmake-data

This way fenics can find the right files and my code does run.