Command '/usr/bin/gcc' failed with exit code -11 when using mesh imported from gmshio.read_from_msh

Dear FEniCS developers,

Thank you for building this fantastic package!

I have encountered a problem when trying to run the following MWE (modified from the NS code from the tutorial) on dolfinx 0.5.0 on Arch Linux:

import numpy as np
import ufl
from dolfinx import fem, io, log, mesh, nls, plot
from dolfinx.io import gmshio
from mpi4py import MPI
from petsc4py import PETSc
nDim = 2
domain, cell_tags, facet_tags = gmshio.read_from_msh(
    "model.msh", MPI.COMM_WORLD, 0, gdim=nDim
)
element_CG2 = ufl.VectorElement("CG", domain.ufl_cell(), 2)
element_CG1 = ufl.FiniteElement("CG", domain.ufl_cell(), 1)
V_vv = fem.FunctionSpace(domain, element_CG2)
V_p = fem.FunctionSpace(domain, element_CG1)

The mesh file can be downloaded from https://files.catbox.moe/y2f494.msh (I’m not sure when the file will get deleted on this site. Please let me know if you cannot download it)

The script failed at the line “V_vv = fem.FunctionSpace(domain, element_CG2)” and complete output is:

Info    : Reading 'model.msh'...
Info    : 11 entities
Info    : 1950 nodes
Info    : 2045 elements
Info    : Done reading 'model.msh'
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py", line 173, in _compile
    self.spawn(compiler_so + cc_args + [src, '-o', obj] +
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py", line 917, in spawn
    spawn(cmd, dry_run=self.dry_run, **kwargs)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/spawn.py", line 68, in spawn
    raise DistutilsExecError(
distutils.errors.DistutilsExecError: command '/usr/bin/gcc' failed with exit code -11

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/cffi/ffiplatform.py", line 51, in _build
    dist.run_command('build_ext')
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 1214, in run_command
    super().run_command(command)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 79, in run
    _build_ext.run(self)
  File "/usr/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/usr/lib/python3.10/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
    _build_ext.build_ext.build_extensions(self)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "/usr/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
    _build_ext.build_extension(self, ext)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 528, in build_extension
    objects = self.compiler.compile(sources,
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py", line 176, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command '/usr/bin/gcc' failed with exit code -11

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vortex/Downloads/Work/Incompressible flow/Untitled.py", line 36, in <module>
    V_vv = fem.FunctionSpace(domain, element_CG2)
  File "/usr/lib/python3.10/site-packages/dolfinx/fem/function.py", line 457, in __init__
    (self._ufcx_element, self._ufcx_dofmap), module, code = jit.ffcx_jit(
  File "/usr/lib/python3.10/site-packages/dolfinx/jit.py", line 56, in mpi_jit
    return local_jit(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/dolfinx/jit.py", line 206, in ffcx_jit
    r = ffcx.codegeneration.jit.compile_elements([ufl_object], parameters=p_ffcx, **p_jit)
  File "/usr/lib/python3.10/site-packages/ffcx/codegeneration/jit.py", line 126, in compile_elements
    impl = _compile_objects(decl, elements, names, module_name, p, cache_dir,
  File "/usr/lib/python3.10/site-packages/ffcx/codegeneration/jit.py", line 252, in _compile_objects
    ffibuilder.compile(tmpdir=cache_dir, verbose=True, debug=cffi_debug)
  File "/usr/lib/python3.10/site-packages/cffi/api.py", line 725, in compile
    return recompile(self, module_name, source, tmpdir=tmpdir,
  File "/usr/lib/python3.10/site-packages/cffi/recompiler.py", line 1564, in recompile
    outputfilename = ffiplatform.compile('.', ext,
  File "/usr/lib/python3.10/site-packages/cffi/ffiplatform.py", line 22, in compile
    outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
  File "/usr/lib/python3.10/site-packages/cffi/ffiplatform.py", line 58, in _build
    raise VerificationError('%s: %s' % (e.__class__.__name__, e))
cffi.VerificationError: CompileError: command '/usr/bin/gcc' failed with exit code -11

I have determined the error is related to the use of read_from_mesh somehow. If I change that line into

domain = mesh.create_rectangle(MPI.COMM_WORLD, [np.array([0, 0]), np.array([2.2, 0.41])], [10, 5])

The script can run without any errors. It’s so strange.

Thank you in advance!

Edit: The script is run without mpirun.

I cannot reproduce this with docker (docker run --rm -ti -v $(pwd):/root/shared -w /root/shared dolfinx/dolfinx:v0.5.0).
Could you please add details about how you installed dolfinx?

Dear Dokken,

Thank you for your help!

My FEniCSx is installed through the AUR package. I have just updated everything to the latest version and tried the script again, but the error persists. I also tried cleaned ~/.cache/fenics but no luck.

Any insights on the possible causes? Are there any debug info I can collect?

Thanks,
Carrot

Running the script on my computer generates a single file in the cache folder, with names like “libffcx_elements_f41ababc603b51af256f438edb10172ba6b5b17a.c.failed”.

Not sure if it will help anything, but I have uploaded this file as well (link).

Thank you!

Best,
Carrot

Hi @PeculiarCarrot, thanks for using the package that I am maintaining python-fenics-dolfinx in AUR.

I am providing too the Dockerfile and the image based on Arch Linux and 0.5.0. Please, follow the instructions here. Again, I cannot reproduce the error.

Probably, my advice is recompile the software due new versions of gcc two weeks ago. Is possible that I need fix somewhere in the PKGBUILD, please keep testing in this way.

Stay safe.

2 Likes

Dear @carlosal1015,

Thank you for helping me to verify the issue. Thanks to you I am able to narrow down the possible causes specific to my setup.

It is not the problem of the new gcc, but it is related to the linux-hardened kernel I’m using. When I swtiched to the normal linux kernel, the script can run with no errors.

It is quite surprising since this is the first time the hardened kernel failed for me. I’m still not sure of the exact cause but I guess something used in dolfinx relies on the kernel config.

Best,