This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

error while compiling demo program

+1 vote

I am using fenics under anaconda.
While compiling demo_spatial_coordinates.py under dolfin/demo/undocumented/spatial-coordinates:

I got this error:

python demo_spatial-coordinates.py 
Calling FFC just-in-time (JIT) compiler, this may take some time.
In instant.recompile: The module did not compile with command 'make VERBOSE=1', see '/home/sohail/.instant/error/ffc_form_35571ce6b6170527aa12c75fec4b9d67bcbe8660/compile.log'

How to get pass through this?

Edit: I can get through this using sudo python demo_spatial-coordinates.py, but don't know why?

asked Aug 31, 2015 by Orange FEniCS Novice (470 points)
edited Sep 1, 2015 by Orange

could you post the file that is mentioned at the end of the error message? Pastebin would be a good way to do it. I have been having similar issues. If your logfile contains the same error message then at least there would be two of us with this problem.

Also, did you always have this problem or did it appear "overnight"?

Here is the file: http://pastebin.com/bNtexLJc

I never had this problem before but recently I started using fenics under anaconda and this might have be the problem.

Unfortunately that is not the same error that I am getting. What version of the compiler and ubuntu are you using? Try typing

g++ -v

at the command line and post the results here (or pastebin or whereever). I am not an expert on this but since your compiler is complaining about a fairly new standard (c++11), it seems that something may not be up to date.

Also try compiling a small example like "hello world" with the -std=c++11 flag. Let me know if you need any help for that.

Here is some more information that you may find useful.

Here is the file: http://pastebin.com/8sCaUqw7

Once you have narrowed down it to c++ compiler. I tried some thing(as you can see in the terminal.)

My native installation of g++ successfully compiled the hello_world.cpp while when doing it under fenics env., I have problems.

I don't know for sure that whether fenics comes with g++ compiler or not but in my case its broken.

Additionally I noticed that I can successfully run both C++ and fenics program when I use sudo.

If it works with sudo, does it mean you consider the problem solved? By the way, your gcc version is definitely out-of-date. According to the link I posted, your version is too old for fenics. (i.e. to know the c++11 standard)

Also, I meant that you should try to compile your program like this:

g++ -std=c++11 hello_world.cpp

because the error message from fenics that you originally posted was complaining about that flag.

Could you explin what all that "activate fenics" stuff does orprovide a link where it is explained? It looks interesting :D

Sorry for late reply. I tried to solve it in many ways.

No I don't consider it solved. As you may have forgotten that I was using anaconda and my fenics was installed in fenics27 environment. So doing source activate fenics27 activate that particular environment and source deactivate would get me out of it. You can read more about it at
http://conda.pydata.org/docs/
and under section Installation from conda packages at http://fenicsproject.org/download/

I have solved the problem regarding gcc, initially I thought that 4.6.4 support c++11 standard but it appears 4.8.1 is the first version to support it. Any ways its not a problem now, but I have another. Please have a look: http://pastebin.com/HSYqRCzB
The compile.log file is: http://pastebin.com/AmD6ZYVj

Please comment on this error log.

Hello there. I am very sorry but I am afraid that I don't know how to help anymore. As mentioned before, "Expressions" don't work on my computer. But I can actually use fenics without any trouble as long as I avoid expression.

I know that it's annoying, especially because it means that you can't run the demos "out of the box". If you look around the forum, you will find that there have been many issues with the dolfin compiler that are related to other programs (like having the wrong version of gcc). By the way, I noticed that your SWIG version is also out-of-date

sorry I couldn't be more helpful

You need at least swig 3.0.5 for proper c++11 handling.

I've heard from several people that the conda packages are broken.

@martinal

I am no more using anaconda for fenics.
fenics comes with swig2.0 and many core packages of fenics depends on it, so there is no way I can uninstall swig 2.0 without disturbing the core packages of fenics.

So without uninstalling swig2.0, I tried installing the recent version of swig, but the problem is that swig, by default, install at /usr/local/bin. I tried their way of using ./configure --prefix=/usr/bin/ but this did not work either though which swig gives /usr/local/bin

Finally I deleted swig file from /usr/bin/ and created a symbolic link: ln -s /usr/local/bin/swig /usr/bin/swig. This solves the version problem of swig, Fenics accepted the swig version 3.0.7 as shown in compile.log http://pastebin.com/js055cnn

So the first error here is a missing ) in your expression:

error: expected ‘)’ before ‘;’ token values[0] = sin(pi*x[0]*x[1];

Note that installing a different version of swig without recompiling FEniCS will not work.

...