ifort line length limit - fortran

So it seems there are a few questions regarding the gfortran's line width limit, but not a single one about ifort's. I'm having the following issue when compiling:
../../../src/70_gw/gwls_lineqsolver.F90(298): error #5082: Syntax error, found IDENTIFIER 'ENDIF' when expecting one of: ( * ) :: , <END-OF-STATEMENT> ; + . - (/ [ : ] /) ' ** / // > ...
&" endif
----------^
../../../src/70_gw/gwls_lineqsolver.F90(298): error #6404: This name does not have a type, and must have an explicit type. [ENDIF]
&" endif
----------^
../../../src/70_gw/gwls_lineqsolver.F90(297): warning #6043: This Hollerith or character constant is too long and cannot be used in the current numeric context. ['=# of valence states).']
write(std_out,*) " subspace (the kernel contains state i=",min_index," > ",nbandv,"=# of valence states).&
------------------------------------------------------------------------------------------------------------^
../../../src/70_gw/gwls_lineqsolver.F90(290): error #6321: An unterminated block exists.
if (singular .and. ( (project_on_what==1 .and. (min_index > nbandv)) .or. project_on_what==0 )) then
^
compilation aborted for ../../../src/70_gw/gwls_lineqsolver.F90 (code 1)
make[3]: *** [gwls_lineqsolver.o] Error 1
make[3]: Leaving directory `/home/stud2/7.11.3-private/build/src/70_gw'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/stud2/7.11.3-private/build/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/stud2/7.11.3-private/build'
make: *** [all] Error 2
The actual code that triggers the error is below:
if (project_on_what==1 .and. (min_index > nbandv)) then
write(std_out,*) " "
write(std_out,*) " There is a projection on the conduction states, but A is singular in this "
write(std_out,*) " subspace (the kernel contains state i=",min_index," > ",nbandv,"=# of valence states)."
end if
I do not have a gfortran compiler to test it out, but I believe that I get this because of the line length limit. Is there a flag in ifort to remove this limit?

The error is probably caused by a bug in ifort 11.x (Source):
Beginning with the 11.x release, the Intel Fortran compiler does not correctly ignore the -extend-source (and other variants) for free-form source files named with the .F90 extension. The option is correctly ignored for source files named with the lower-case .f90 extension.
The mishandling of the option will cause erroneous syntax errors for any Fortran source statement that extends beyond the designated statement field length specified with the -extend-source option.
The error can be easily avoided by changing the file extension to .f90 and by adding the flag -fpp in order to maintain the preprocessing.

Related

How to install bc on a unix system under local environment

I am trying ti install bc on my cluster.
I used
./configure --prefix=/home/astha/soft/bc-1.07
followed by
make
but getting below error while executing make
./fbc -c ./libmath.b </dev/null >libmath.h
./fix-libmath_h
./fix-libmath_h: line 1: ed: command not found
make[2]: *** [libmath.h] Error 127
make[2]: Leaving directory `/home/astha/soft/bc-1.07/bc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/astha/soft/bc-1.07'
make: *** [all] Error 2
Is there any workaround for it?
I ran into the same snag building under MingW32. fix-libmath_h is a fairly simple here document for ed. I was able to edit libmath.h using vim and rerun make.
You can pretty much hit ":" and type each line into vim. You don't need to escape the "$" in vim.
If you are not familiar with ed, the script basically deletes the last line, puts all the lines in quotes with a trailing comma and adds a leading brace to the first line and trailing zero and a closing brace to the last line.

GCC Compiler error: -Werror=stringop-truncation: no option

I am trying to run a gcc compiler to make an executable, but I get this whenever I run the 'make' command in my terminal:
Scanning dependencies of target my_libs-atmega328p
[ 2%] Building CXX object my_libs/CMakeFiles/my_libs-atmega328p.dir/CLed.cpp.obj
cc1plus: error: -Werror=stringop-truncation: no option -Wstringop-truncation
make[2]: *** [my_libs/CMakeFiles/my_libs-atmega328p.dir/build.make:63:my_libs/CMakeFiles/my_libs-atmega328p.dir/CLed.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:246: my_libs/CMakeFiles/my_libs-atmega328p.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
I don't even have a string in the file it gets tripped up on (CLed.cpp), so I don't know why it is trying to truncate a string. I have even commented out the entire file and it still is looking for something. Where might I go to find the solution?
I don't even have a string in the file it gets tripped up on (CLed.cpp), so I don't know why it is trying to truncate a string
It is not "trying to truncate a string", nor is it warning about "trying to truncate a string."
The error is saying that the compiler was given the option -Werror=stringop-truncation while the compiler does not recognise such warning option. The solution is to not pass -Werror=stringop-truncation to the compiler. Or to use another compiler (version) that does support such option.

Build error "ISO C++ forbids zero-size array ‘f_handle’ [-Wpedantic]" only when using snapcraft VM

I'm using the catkin command line tools to build benchmark_catkin, which is a catkin wrapper for Google's benchmark. The build uses a CMakeLists file and always worked fine so far on Ubuntu 18.04. I'm now trying to build this package with snapcraft. Snapcraft has the catkin-tools plugin and sets up a VM before building. However, I'm now getting an error from a system library and the build is not successful:
In file included from /root/parts/workspace/install/usr/include/x86_64-linux-gnu/bits/fcntl.h:61:0,
from /root/parts/workspace/install/usr/include/fcntl.h:35,
from /root/parts/workspace/build/benchmark_catkin/benchmark_src-prefix/src/benchmark_src/src/sysinfo.cc:23:
/root/parts/workspace/install/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:355:27: error: ISO C++ forbids zero-size array ‘f_handle’ [-Wpedantic]
unsigned char f_handle[0];
^
In file included from /root/parts/workspace/install/usr/include/x86_64-linux-gnu/bits/fcntl.h:61:0,
from /root/parts/workspace/install/usr/include/fcntl.h:35,
from /root/parts/workspace/build/benchmark_catkin/benchmark_src-prefix/src/benchmark_src/src/timers.cc:23:
/root/parts/workspace/install/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:355:27: error: ISO C++ forbids zero-size array ‘f_handle’ [-Wpedantic]
unsigned char f_handle[0];
^
make[5]: *** [src/CMakeFiles/benchmark.dir/sysinfo.cc.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [src/CMakeFiles/benchmark.dir/timers.cc.o] Error 1
make[4]: *** [src/CMakeFiles/benchmark.dir/all] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [all] Error 2
make[2]: *** [benchmark_src-prefix/src/benchmark_src-stamp/benchmark_src-build] Error 2
make[1]: *** [CMakeFiles/benchmark_src.dir/all] Error 2
make: *** [all] Error 2
I assume this error is referring to a zero-size array in the libc6-dev library. Since I'm using base: core18 in my snapcraft.yaml and also running an Ubuntu 18.04 system, I'm wondering why I just get the error in the VM. Is this a bug in the library? How can I solve this?
For reference, my snapcraft.yaml file:
name: nav
base: core18
version: 'w1.0'
summary: The Nav Software
description: |
grade: devel
confinement: strict
plugs:
network:
network-bind:
parts:
core-dep:
plugin: nil
build-packages:
- autoconf
- libtool
- git
workspace:
plugin: catkin-tools
source: .
catkin-packages: [catkin_simple, glog_catkin, gflags_catkin, benchmark_catkin]
after: [core-dep]
On request, here the code around the erroneous line of /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h:
/* File handle structure. */
struct file_handle
{
unsigned int handle_bytes;
int handle_type;
/* File identifier. */
unsigned char f_handle[0];
};
I took a look into the project. CMakeLists.txt of benchmark_catkin internally checks out google/benchmark and builds that. The error comes from that build.
CMakeLists.txt google/benchmark sets tons of compiler options, and specifically -pedantic-errors (as well as -pedantic and -Werror) which causes the compiler to stop on any use of a language extension. Frankly in my opinion, CMakeLists.txt should not set any warning flags and especially no -Werror or -pedantic-errors flags without the user asking for it, so I would consider that a bug, but google devs may disagree.
The glibc header uses a language extension. But that is fine because warnings in system headers should be ignored. So the actual cause for the build failure is failure to treat the glibc header as a system header.
I know nothing about snapcraft, but I suspect that the cause of the problem is in there.

Build failure of OpenMPI due to _noalias when using mpicxx

I tried to install lammps on my department machine with a newer version of 11Aug17. However, mpicxx gives error to the following lines:
mpicxx -g -O3 -DLAMMPS_GZIP -DLAMMPS_MEMALIGN=64 -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX=1 -I/home/shixx597/codes/kim-api-v1.7.3/lib/kim-api-v1/include -c ../pair_list.cpp
../pair_list.cpp(88): error: expected a ";"
const dbl3_t * _noalias const x = (dbl3_t *) atom->x[0];
^
../pair_list.cpp(89): error: "restrict" has already been declared in the current scope
dbl3_t * _noalias const f = (dbl3_t *) atom->f[0];
^
../pair_list.cpp(89): error: expected a ";"
dbl3_t * _noalias const f = (dbl3_t *) atom->f[0];
^
../pair_list.cpp(114): error: identifier "x" is undefined
const double dx = x[i].x - x[j].x;
^
../pair_list.cpp(160): error: identifier "f" is undefined
f[i].x += dx*fpair;
^
../pair_list.cpp(166): error: identifier "f" is undefined
f[j].x -= dx*fpair;
^
compilation aborted for ../pair_list.cpp (code 2)
make[1]: *** [pair_list.o] Error 2
make[1]: Leaving directory `/home/shixx597/codes/lammps-11Aug17/src/Obj_mpi'
make: *** [mpi] Error 2
My colleagues told me that it is the problem of openmpi. So I tried to install a new openmpi for me. However, I get the following error told me that automake is not installed like this:
cd . && /bin/sh /home/shixx597/codes/openmpi-3.0.0/config/missing automake-1.15 --foreign
/home/shixx597/codes/openmpi-3.0.0/config/missing: line 81: automake-1.15: command not found
WARNING: 'automake-1.15' is missing on your system.
You should only need it if you modified 'Makefile.am' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'automake' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>
make: *** [Makefile.in] Error 1
When I tried to install automake-1.15, I get the following error:
CDPATH="${ZSH_VERSION+.}:" && cd . && "/home/shixx597/codes/automake-1.15/t/wrap/aclocal-1.15"
Can't locate /home/shixx597/codes/automake-1.15/bin/aclocal in #INC (#INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /home/shixx597/codes/automake-1.15/t/wrap/aclocal-1.15 line 29.
make: *** [aclocal.m4] Error 2
I do not have any sudo privilege to do anything on this weird department machine.
Even I tried to finish installing lammps on the departmental machine, I am wondering if I could finish the run of a large bonded force field model.
Actually, this a fairly well-known issue, and there are three solutions.
Use GCC rather than an Intel compiler (possibly not desirable).
Use the -restrict flag while compiling (I'm assuming by appending it when running make, like make CXX_FLAGS=-restrict
Just remove those two files from the build.
If you really want to try, you could also try to remove the _noalias keyword using sed or awk from the two offending files: pair_list.h and pair_list.cpp, or just define _noalias to be an empty keyword, as suggested by jww in the comments.

Qt on RaspberryPi - QXmlAttributes implicit declaration

I am building Qt on RaspberryPi using host desktop following this guide https://wiki.qt.io/Raspberry_Pi_Beginners_Guide.
And when it comes to building Qt with make command i got a strange error:
In file included from ../../include/QtXml/qxml.h:1:0,
from dom/qdom.cpp:54:
../../include/QtXml/../../src/xml/sax/qxml.h:121:5: error: function ‘QXmlAttributes::QXmlAttributes(QXmlAttributes&&)’ defaulted on its first declaration with an exception-specification that differs from the implicit declaration ‘QXmlAttributes::QXmlAttributes(QXmlAttributes&&)’
Makefile:1338: recipe for target '.obj/qdom.o' failed
make[2]: *** [.obj/qdom.o] Error 1
make[2]: Leaving directory '/home/anon/opt/qt5/qtbase/src/xml'
Makefile:295: recipe for target 'sub-xml-make_first' failed
make[1]: *** [sub-xml-make_first] Error 2
make[1]: Leaving directory '/home/anon/opt/qt5/qtbase/src'
Makefile:46: recipe for target 'sub-src-make_first' failed
make: *** [sub-src-make_first] Error 2
Some specification:
Host - Debian Jessie
RPI - Raspbian
What should I do now? Restarting installation from beginning gives nothing.
The first error apparently is resulted from a conflict in the declaration of "QXmlAttributes::QXmlAttributes(QXmlAttributes&&)"
I had the same error : function ‘QXmlAttributes::QXmlAttributes(QXmlAttributes&&)’ defaulted on its first declaration with an exception-specification that differs from the implicit declaration ‘QXmlAttributes::QXmlAttributes(QXmlAttributes&&)’
I managed to solve this by following rocommendations from the following link : Cross compiling for Raspberry Error
The solution is to change :
1.Open the /qt5/qtbase/src/xml/sax/qxml.h file
2.Change : "QXmlAttributes(QXmlAttributes &&) Q_DECL_NOTHROW = default"
to "QXmlAttributes(QXmlAttributes &&) = default"
Hope this helps !