Unsuccesful Fenics installtion? C++, errors in .h file from ffc: tabulate tensor

Hey,

I am using a fresh installation of FEniCs (2019.2.0.dev0) on Ubuntu 18.04.5. Note: I encountered similar issues as described here: Petsc_dir issues and solved them analogously by uninstalling a previous Petsc version.

Using ffc to compile my .ufl files works fine, when compiling my C++ code, I am met with the follow errors:

error: ‘void heat_cell_integral_0_otherwise::tabulate_tensor(double*, const double* const*, const double*, int) const’ marked ‘final’, but is not virtual
void tabulate_tensor(double * A,
error: invalid new-expression of abstract class type ‘heat_cell_integral_0_otherwise’
return new heat_cell_integral_0_otherwise();

I am suspecting something went wrong with my fenics installation, since I do not have the same issues on another machine (where I did not have the petsc issue). However, I have no idea where to start.

Any ideas or help would be much appreciated.

As it works on your other computer, it is clearly something with your installation.
Could you tell me which steps you used to install the latest version?
Did you use the following steps:

apt-get update
apt-get install  -y sudo
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt-get install -y fenics

Yes, I followed those steps.

Then please supply a minimal code example that produces the error

heat.ufl

element = FiniteElement(“Lagrange”, triangle, 1)
v = TestFunction(element)
u = TrialFunction(element)
u0 = Coefficient(element)
dt = Coefficient(FiniteElement(“Real”, triangle, 0))
eq = u * v * dx - u0 * v * dx + dt*dot(grad(u), grad(v))*dx
a = lhs(eq)
L = rhs(eq)

CMakeLists.txt

cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0004 NEW)
find_package(DOLFIN REQUIRED)
include(${DOLFIN_USE_FILE})
add_executable(a min_ex.cpp)
target_link_libraries(a dolfin)

min_ex.cpp

#include “dolfin.h”
#include “heat.h”

int main(int argc, char *argv){
dolfin::init(argc, argv);
}

ffc -l dolfin heat.ufl
cmake .
make

This is about as minimal as I could get it.

I tried to reproduce your error with docker

docker run -ti -v $PWD:/home/shared -w /home/shared --rm ubuntu:18.04

Installing dolfin with:

apt-get update
apt-get install  -y sudo
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt-get install -y fenics

Running your minimal example as:

ffc heat.ufl
cmake .
make

without any errors.

Could you check if your C++ version matches the one used in the docker image? (or on your other computer). As far as I can tell from other similar issues in other projects: https://github.com/feixh/VISMA/issues/2 it because a newer version of gcc is used.

The C++ versions are identical for both of my machines: gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)

Hm, this is really strange then. Did you have a previous installation of fenics on this computer ?

Yes, I do not quite remember at which point it stopped working though. However, the above problem persists with removing fenics via

sudo apt-get purge --auto-remove fenics

and re-installing it.

It’s also worth deleting the jit cache (e.g. ~/.cache/fenics/). If the error is from ffc then this is a likely culprit. The jit generated files are sensitive to specific conditions, including python version.

If that doesn’t help then check you don’t have user-installed python modules interfering (e.g. in ~/.local/lib/python3*/site-packages/)

3 Likes

It seems like the cleaning up ~/.local/lib/python3*/site-packages/ did the trick (I uninstalled FEniCs, cleaned up and installed again). In particular, I removed a few FEniCs/ffc related things.

Thanks a lot for the help dokken and dparsons!

1 Like