Installation and demos problems

Hi all,

I’m a new FEniCS user and I would like to use FEniCS on Ubuntu with a C++ interface but I have found some problems trying to run some demos.
I have installed fenics using the reccomended procedure for Ubuntu:

Terminal> sudo add-apt-repository ppa:fenics-packages/fenics
Terminal> sudo apt-get update
Terminal> sudo apt-get install fenics
Terminal> sudo apt-get dist-upgrade

Everything seems to be working correctly, so I tried to run some demos, in particular the Poisson problem contained in dolfin.
I tried to recreate it in another folder and I was able to create the .h file with the command:

ffc -l dolfin poisson.ucl

but trying to compile it using the provided CMakeLists.txt file with command

cmake .

there is the following error:

– The C compiler identification is GNU 9.2.0
– The CXX compiler identification is GNU 9.2.0
– Check for working C compiler: /u/sw/pkgs/toolchains/gcc-glibc/9/prefix/bin/gcc
– Check for working C compiler: /u/sw/pkgs/toolchains/gcc-glibc/9/prefix/bin/gcc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info – done
– Detecting C compile features
– Detecting C compile features – done
– Check for working CXX compiler: /u/sw/pkgs/toolchains/gcc-glibc/9/prefix/bin/g++
– Check for working CXX compiler: /u/sw/pkgs/toolchains/gcc-glibc/9/prefix/bin/g++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info – done
– Detecting CXX compile features
– Detecting CXX compile features – done

CMake Error at /usr/share/dolfin/cmake/DOLFINTargets.cmake:81 (message):
The imported target “dolfin” references the file

“/usr/lib//libdolfin.so.2019.2.0.dev0”

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
“/usr/share/dolfin/cmake/DOLFINTargets.cmake”
but not all the files it references.

Call Stack (most recent call first):
/usr/share/dolfin/cmake/DOLFINConfig.cmake:30 (include)
CMakeLists.txt:16 (find_package)

– Configuring incomplete, errors occurred!
See also “/home/apc201819/Desktop/Prova/FE_prova/CMakeFiles/CMakeOutput.log”.

I have tried to solve this problem on my own but without success.
In particular by searching for the file “/usr/lib//libdolfin.so.2019.2.0.dev0” that the program doesn’t seem to find, I saw that it is under a slightly different path:
(“/usr/lib/x86_64-linux-gnu/libdolfin.so.2019.2.0.dev0”).

Do you know what the problem might be and how can I solve it?

Thank you very much in advance to everybody is going to answer me!

There are a couple of strange things in your report.

You’ve got

but the file for the poisson demo is Poisson.ufl not poisson.ucl. (I guess you meant .ufl not .ucl, the problem is in the case, Poisson not poisson). Where did you get your demo source from?

Secondly, your cmake is reporting gcc from /u/sw/pkgs/toolchains/gcc-glibc/9/prefix/bin/. That is not the normal location for the C compiler, it’s usually just /usr/bin/cc, cf. https://launchpadlibrarian.net/500636066/buildlog_ubuntu-groovy-amd64.dolfin_2019.2.0~git20200629.946dbd3-2~ppa1~groovy4_BUILDING.txt.gz

The path that your build is missing is set via ${CMAKE_LIBRARY_ARCHITECTURE} in /usr/share/dolfin/cmake/DOLFINTargets-relwithdebinfo.cmake . For some reason your cmake is not setting CMAKE_LIBRARY_ARCHITECTURE to its proper value.

1 Like

First of all thank you for your answer.

Obviously about the first thing, it was just a typo, the command I wrote was:

ffc -l dolfin Poisson.ufl

I got the demo from: https://fenicsproject.org/docs/dolfin/1.4.0/cpp/demo/documented/poisson/cpp/documentation.html

Then, I tried to solve the second problem reinstalling cmake, but this didn’t work.
So I tried installing a differente virtual machine. In this way I think I solved that problem, but I got a new one:

[ 50%] Building CXX object CMakeFiles/demo_poisson.dir/main.cpp.o
In file included from /usr/include/dolfin/common/dolfin_common.h:9,
from /usr/include/dolfin.h:6,
from /home/martina/Scrivania/FE_2/main.cpp:34:
/usr/include/dolfin/common/types.h:24:10: fatal error: petscsys.h: No
such file or directory
24 | #include <petscsys.h>
| ^~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/demo_poisson.dir/build.make:63:
CMakeFiles/demo_poisson.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/demo_poisson.dir/all]
Error 2
make: *** [Makefile:84: all] Error 2

Any idea for solving that?

1.4.0 is quite an old version and many changes have been made since. You should use the demos provided for the version of FEniCS that you are using, e.g. from /usr/share/dolfin/demo (dolfin-doc package).

2 Likes

Thanks a lot! Now it works!

1 Like