missing separator on Makefile - linux

I am now having problems with a autotools generated Makefile, and it first looks like this. When I was trying make an error arised:
Makefile:327: *** missing separator. Stop.
Then, I tried the following change:
326,327c326
< LDFLAGS = -Wl,-O1,--sort-common,--as-needed,-z,relro -L/home/tjm/tmp/fake-root/libgd/usr/local/lib/ -L /home/tjm/tmp/fake-root/libpng/usr/local/lib -L /home/tjm/tmp/fake-root/freetype/usr/local/lib -L /home/tjm/tmp/fake-root/libpng/usr/local/lib -L /home/tjm/tmp/jpeg-6b
< -static
---
> LDFLAGS = -Wl,-O1,--sort-common,--as-needed,-z,relro -L/home/tjm/tmp/fake-root/libgd/usr/local/lib/ -L /home/tjm/tmp/fake-root/libpng/usr/local/lib -L /home/tjm/tmp/fake-root/freetype/usr/local/lib -L /home/tjm/tmp/fake-root/libpng/usr/local/lib -L /home/tjm/tmp/jpeg-6b -static
But, this time, I got this error:
Making all in intl
Makefile:35: *** missing separator. Stop.
make[1]: *** [Makefile:582: all-recursive] Error 1
make: *** [Makefile:489: all] Error 2
The related lines look like these:
32 skip_next=no; \
33 strip_trailopt () \
34 { \
35 flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
36 }; \
And I teird a lot of things like:
34 { flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; }; \
34 { \
35 flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; }; \
33 strip_trailopt () { flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; }; \
and
35 ^Iflg=printf '%s\n' "$$flg" | sed "s/$$1.*$$//"; \$
But still got the same error.
Does anyone can give me some ieda about how to fix it?

(Note: I'm not sure if this is correct in StackOverflow vs SuperUser.)
If you edited the Makefile, it'll not be useful as it'll just re-generate out of Makefile.in, and that one in turn will be generated out of Makefile.am.
Check your Makefile.am file, and put -static in the same line as everything else; what is happening is that it does not have a continuation symbol at the end of the previous line (\), so the variable definition is not continued. And because of that it tries to parse it as a rule, which it's not.

Related

Run MacOS sed on Linux 64 using nix-shell or nix shell

Answering sed questions on SO I often come across the problem of "works on linux but not MacOS" is it possible to load a version of sed that runs on MacOS into a nix shell?
Currently using flakes I can obtain the latest gnused using:
nix shell nixpkgs#gnused
Is there a way to temporarily install a BSD/MacOS version of sed?
Not so long ago I looked into this problem; perhaps you can make use
of what I found.
Web searches show little demand for FreeBSD sed outside BSD so I
decided to get it (well, GET it) from
github
and build and test it on a recent Debian system. To do so I created
3 files (listed below):
adapt/local.c - support for non-GNU functions
adapt/local.h - ditto header file
Makefile - downloads, generates required files, runs 1 or 2 of
the test suites; refer to comments in header and near target test
On my system the executable builds without errors. To test it using
tests/multi_test.sh I ran
make test | tee multi_test.log | grep '^not ok' | tee multi_test.err.log
with 127 of 130 tests succeeding and 3 failing:
not ok 69 7.1 # Print and file routines
not ok 75 7.7 # w results
not ok 97 8.21 # \ in y command
These discrepancies, I think, are no more than what can be expected: #69
is triggered by differences in output by sed -n l, #75 by differences
in /usr/share/dict/words contents (testcase of limited portability),
and #97 goes away if using SHELL := /bin/bash in the makefile or using
printf '%s\n' 'a\b(c' instead of echo 'a\b(c' in the test script.
UPDATE 2021-11-24: #69 goes away with e.g.
LANG=en make test | grep '^not ok', causing the locale-dependent
library function iswprint()
in process.c#lputs() to return zero for characters 0xA0..0xFF. #75
can only succeed if the first 200 lines of /usr/share/dict/words are
identical to those used by the testcase author; I fail to see the
reasoning behind this. (end UPDATE)
Still on the to-do list:
Makefile's *.names variables are hard-coded, better to create
them dynamically; however, the names seem to change rarely for a
program with sed's history
support for the ATF
tests by tests/sed2_test.sh (currently ignored)
support for embedded ident strings in the executable (__FBSDID
macro currently ignored) rather than rely on a date in the man page for
version
info
./Makefile
Note that recipes aren't prefixed with the usual tab character here
but with > (at beginning of line) acting as a make operator
(.RECIPEPREFIX = >).
# desc:
# Download, build, test FreeBSD sed (dated 2020-06-10) on GNU/Linux
# compat:
# dash 0.5.10 GNU make 4.2.1 GNU wget 1.20 GNU gcc 9.3.0 man 2.9
# ref:
# https://www.freebsd.org/cgi/man.cgi?sed
# https://github.com/freebsd/freebsd-src/tree/main/usr.bin/sed
# https://github.com/joshuarubin/wcwidth9
# files:
# Makefile adapt/local.c adapt/local.h
# howto:
# make download
# make all
# (optional) make download.tests download.regress.multitest.out test
# (optional) cp $(exe) /usr/local/bin/bsdsed
# (optional) cp $(man.1) /usr/local/man/man1/bsdsed.1
# note:
# Mind the $(wgetFlags) and $(CFLAGS)
SHELL := /bin/sh
wgetFlags ?= --no-verbose --wait=1
# $(call wgetCmd,subtarget-name)
define wgetCmd =
wget $(wgetFlags) --no-host-directories --directory-prefix=$($1.ldir) \
-- $(addprefix $($1.url),$($1.names))
endef
#
hdrs := defs.h extern.h
srcs := misc.c compile.c process.c main.c
hdrx := wcwidth9.h
srcx := local.c
objs := $(patsubst %.c,%.o,$(srcs) $(srcx))
# test scripts expect an executable named 'sed'
exe := sed
man.1 := $(exe).1
man.ps := $(exe).ps
binaries := $(exe) $(man.1) $(man.ps)
#
subtargets := wcwidth9 sed tests regress.multitest.out
dnldtargets := $(addprefix download.,$(subtargets))
#
wcwidth9.url := https://github.com/joshuarubin/wcwidth9/raw/master/
wcwidth9.names := $(hdrx)
wcwidth9.ldir := ./
#
sed.url := https://github.com/freebsd/freebsd-src/raw/master/usr.bin/sed/
sed.names := POSIX sed.1 $(srcs) $(hdrs)
sed.ldir := ./
tests.url := $(sed.url)tests/
tests.names := \
hanoi.sed inplace_race_test.sh legacy_test.sh math.sed \
multi_test.sh regress.G.out regress.P.out regress.b2a.out \
regress.bcb.out regress.c0.out regress.c1.out regress.c2.out \
regress.c3.out regress.hanoi.out regress.icase1.out \
regress.icase2.out regress.icase3.out regress.icase4.out \
regress.in regress.math.out regress.not.out regress.psl.out \
regress.s3.out regress.s4.out regress.s5.out regress.sg.out \
regress.sh regress.y.out sed2_test.sh
tests.ldir := ./tests/
regress.multitest.out.url := $(sed.url)tests/regress.multitest.out/
regress.multitest.out.names := \
1.1 1.2 1.3 1.4 1.4.1 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 \
1.14 1.15 1.16 1.17 1.18 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 \
2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 \
2.22 2.23 3.1 3.2 3.3 3.4 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 5.1 \
5.2 5.3 5.4 5.5 5.6 5.7 5.8 6.1 6.2 6.3 6.4 6.5 6.6 7.1 7.2 \
7.3 7.4 7.5 7.6 7.7 7.8 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 \
8.10 8.11 8.12 8.13 8.14 8.15 8.16 8.17 8.18 8.19 8.20 8.21 \
8.22 8.23 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 9.10 9.11 9.12 \
9.13 9.14 9.15 9.16 9.17 9.18 9.19 9.20 9.21 9.22 9.23 9.24 \
9.25 9.26 9.27 9.28 9.29 9.30 9.31
regress.multitest.out.ldir := ./tests/regress.multitest.out/
.RECIPEPREFIX = >
.DELETE_ON_ERROR:
.PHONY: all clean realclean
all : $(binaries)
clean : ; rm -f -- $(objs) $(binaries)
realclean : clean
> rm -f -- local.c manpage.1 $(foreach T,$(subtargets),$(addprefix $($(T).ldir),$($(T).names)))
> rmdir --ignore-fail-on-non-empty -- \
$(patsubst %/,%,$(foreach T,$(subtargets),$(filter-out %. %./,$($(T).ldir))))
# notonbsd: enable modifications in extern.h and $(srcx)
# __FBSDID: don't embed RCS ID
$(objs) : CFLAGS += -Dnotonbsd -D__FBSDID\(s\)=
$(objs) : $(srcs) $(hdrs)
extern.h : adapt/local.h
> grep -q '^.ifdef\s*notonbsd' $# || { cat $# $< > $#.tmp && mv -f -- $#.tmp $# ; }
local.c : adapt/local.c
> cp $< $#
local.o : $(hdrx)
main.o : CFLAGS += -D__unreachable=__builtin_unreachable
$(exe) : $(objs)
> $(LINK.c) -o $# $^
> $(if $(DEBUG),,strip $#)
$(man.1) : manpage.1
> cp $< $#
%.ps : %.1
> man -l -t $< > $#
.PHONY : download.all $(dnldtargets) download
download.all : $(dnldtargets)
$(dnldtargets) :
> $(call wgetCmd,$(patsubst download.%,%,$#))
download : download.wcwidth9 download.sed
> mv -f sed.1 manpage.1
> touch adapt/local.h
.PHONY: test
# ! run after: make download.tests download.regress.multitest.out
# ! hint: make test | tee multi_test.log | grep '^not ok' | tee multi_test.err.log
# - set PATH so scripts invoke the new sed executable
# - run multi_test.sh (requires /usr/share/dict/words regress.multitest.out/*)
# - optionally run inplace_race_test.sh
# - ignore legacy_test.sh regress.* (require m4 regress.m4 hanoi.sed math.sed)
# - ignore sed2_test.sh (requires ATF, cf. https://github.com/freebsd/freebsd-src/tree/main/contrib/atf)
test : | /usr/share/dict/words
> cd $(patsubst %/,%,$(tests.ldir)); \
PATH="..:$$PATH"; \
$(SHELL) multi_test.sh \
$(if $(racetest),; $(SHELL) inplace_race_test.sh && rm -f file[0-9] file[0-9].prev)
./adapt/local.c
/* Support for non-GNU functions, cf. man.freebsd.org */
#ifdef notonbsd
#include <err.h>
#include <limits.h>
#include <regex.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <stdarg.h>
#include <errno.h>
#include "defs.h"
#include "extern.h"
#include "wcwidth9.h" /* https://github.com/joshuarubin/wcwidth9 */
void
errc(int eval, int code, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
errno = code;
err(eval, fmt, args);
va_end(args);
}
char*
getprogname()
{
return (program_invocation_short_name);
}
int
wcwidth(wchar_t wc)
{
return wcwidth9(wc);
}
size_t
strlcpy(char *dst, const char *src, size_t dstsize)
{
return snprintf(dst, dstsize, "%s", src);
}
size_t
strlcat(char *dst, const char *src, size_t dstsize)
{
int dlen, slen, dslen, addlim;
dlen = strlen(dst);
slen = strlen(src);
dslen = dlen + slen;
addlim = (dstsize > dslen ? slen : dstsize - dlen - 1);
if ( addlim > 0 )
strncat(dst, src, addlim);
return dslen;
}
#endif /* notonbsd */
./adapt/local.h
/* To be appended to extern.h */
#ifdef notonbsd
extern char *program_invocation_short_name;
char *getprogname();
void errc(int eval, int code, const char *fmt, ...);
int wcwidth(wchar_t wc);
size_t strlcpy(char *dst, const char *src, size_t dstsize);
size_t strlcat(char *dst, const char *src, size_t dstsize);
#endif /* notonbsd */
UPDATE on 2022-01-07
Following Makefile to build macOS sed on a Debian system uses the
same ./adapt/local.c and ./adapt/local.h as listed above. At my end
make download all builds the executable without errors but warns about
an ignored return value of fchown if $(CFLAGS) contains -O3.
make download.TEST test downloads test files, generates and runs
test-edited.sh (a modified TEST/sed.test) which adjusts test
parameters and fixes a redirection issue. Test logs show that 113
(30+83) out of 115 (30+85) test cases succeed (30 in test_error(),
the rest numbered):
test 2.8 fails: sed -n -e '0p' lines1 is run by macOS sed (and
FreeBSD sed) but GNU sed says "invalid usage of line address 0"
test 7.1 fails, even when line continuation char.s are eliminated:
l command of macOS sed (and FreeBSD sed) outputs backslash as \
but POSIX.1-2017
(and GNU sed) says \\
Test 7.7 (involving /usr/share/dict/words) is an indication that
the equivalent FreeBSD sed testcase #75 (see above) should be run
against the local file, not one produced by the test author.
./Makefile
Note: recipe prefix is > (at beginning of line), not tab.
# desc:
# Download, build, test macOS sed (dated 2017-03-27) on GNU/Linux.
# compat:
# dash 0.5.10 GNU make 4.2.1 GNU wget 1.20.3 GNU gcc 9.3.0
# GNU sed 4.7 GNU coreutils 8.30 man 2.9.1
# ref:
# https://opensource.apple.com/source/text_cmds/text_cmds-106/sed/
# https://github.com/joshuarubin/wcwidth9
# see:
# Last sed manpage (dated May 10, 2005) captured by archive.org on Aug 8, 2017
# https://web.archive.org/web/20170808213955/https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/sed.1.html
# https://leancrew.com/all-this/2021/03/apple-and-links/
# https://opensource.apple.com/source/text_cmds/text_cmds-106/text_cmds.plist
# https://unix.stackexchange.com/questions/13711/differences-between-sed-on-mac-osx-and-other-standard-sed
# files:
# Makefile adapt/local.c adapt/local.h
# howto:
# make download
# make all
# (optional) make download.TEST test
# note:
# Mind the $(wgetFlags) and $(CFLAGS)
SHELL := /bin/sh
refsed ?= /usr/bin/sed --posix
wgetFlags ?= --no-verbose --wait=1
# $(call wgetCmd,subtarget-name)
define wgetCmd =
wget $(wgetFlags) --no-host-directories --directory-prefix=$($1.ldir) \
-- $(addprefix $($1.url),$($1.names))
endef
#
hdrs := defs.h extern.h
srcs := misc.c compile.c process.c main.c
hdrx := wcwidth9.h
srcx := local.c
objs := $(patsubst %.c,%.o,$(srcs) $(srcx))
exe := sed
#
sed.genfiles := $(exe) $(exe).1.gz $(exe).pdf
test.gendirs := ./sed.out/ ./nsed.out/
test.genfiles := test-edited.sh test.log test-diff.log $(addsuffix *,$(test.gendirs))
#
subtargets := wcwidth9 sed TEST
dnldtargets := $(addprefix download.,$(subtargets))
#
wcwidth9.url := https://github.com/joshuarubin/wcwidth9/raw/master/
wcwidth9.names := $(hdrx)
wcwidth9.ldir := ./
sed.url := https://opensource.apple.com/source/text_cmds/text_cmds-106/sed/
sed.names := POSIX sed.1 $(srcs) $(hdrs)
sed.ldir := ./
TEST.url := $(sed.url)TEST/
TEST.names := hanoi.sed math.sed sed.test
TEST.ldir := ./TEST/
.RECIPEPREFIX = >
.DELETE_ON_ERROR:
.PHONY: all testclean clean realclean
all : $(sed.genfiles)
testclean :
> rm -f -d -- $(test.genfiles) $(patsubst %/,%,$(test.gendirs))
clean : testclean
> rm -f -- $(objs) $(sed.genfiles)
realclean : clean
> rm -f -- local.c $(foreach T,$(subtargets),$(addprefix $($(T).ldir),$($(T).names)))
> rmdir --ignore-fail-on-non-empty -- $(patsubst %/,%, \
$(foreach T,$(subtargets),$(filter-out %. %./,$($(T).ldir))))
# notonbsd: enable modifications in extern.h and $(srcx)
# __FBSDID: don't embed RCS ID
$(objs) : CFLAGS += $(if $(DEBUG),,-s -O3) -Dnotonbsd -D__FBSDID\(s\)=
$(objs) : $(srcs) $(hdrs)
extern.h : adapt/local.h
> grep -q '^.ifdef\s*notonbsd' $# || { cat $# $< > $#.tmp && mv -f -- $#.tmp $# ; }
local.c : adapt/local.c
> cp $< $#
local.o : $(hdrx)
main.o : CFLAGS += -D__unreachable=__builtin_unreachable
$(exe) : $(objs)
> $(LINK.c) $^ -o $#
%.1.gz : %.1
> gzip -fk $<
%.ps : %.1
> man -l -t $< > $#
%.pdf : %.ps
> ps2pdf $< $#
.PHONY : download.all $(dnldtargets) download
download.all : $(dnldtargets)
$(dnldtargets) :
> $(call wgetCmd,$(patsubst download.%,%,$#))
download : download.wcwidth9 download.sed
> touch adapt/local.h
.PHONY: test
# run after: make download.TEST
# notes:
# test 2.8: GNU sed says "invalid usage of line address 0"
# test 7.1 fails, even when line continuation char.s are eliminated:
# `l` command of macOS sed (and BSD sed) outputs backslash as '\'
# but POSIX.1-2017 (and GNU sed) says `\\`
test : test-diff.log
> printf '## test results in "%s"\n' '$<' 1>&2
test-diff.log : test.log
> - diff -c $(test.gendirs) > $#
# notes:
# `LANG=en`: cause test 7.1 not to output unicode/widechar
# creates $(test.gendirs)
# all tests in test_error() are supposed to produce error output
test.log : test-edited.sh
> LANG=en $(SHELL) $< 1>$# 2>&1
> rm -f -- lines[1-4] script[1-2]
test-edited.sh : $(TEST.ldir)sed.test $(exe)
> $(refsed) \
-e '# main() : adjust test parameters' \
-e '/^.BASE=/ s,.*,BASE="$(refsed)",' \
-e '/^.TEST=/ s,.*,TEST="./$(exe)",' \
-e '# be silent' \
-e '/^.BSD=/ s,.*,BSD=0,' \
-e '/^.GNU=/ s,.*,GNU=0,' \
-e '/^.SUN=/ s,.*,SUN=0,' \
-e '# allow "sed --posix" as exename' \
-e '/^.tests / s,\(\$$[A-Z][A-Z]*\),"\1",g' \
-e '# comment out "diff -c"' \
-e '/^.diff -c/ s,^,#,' \
-e '# test_error(): fix stdin redirection' \
-e '/^.exec 0>&3 4>&1 5>&2/ s,0>&3,3<\&0,' \
-e '/^.exec 0>&3 1>&4 2>&5/ s,0>&3,0<\&3,' \
$< > $#
.PHONY : test-7.1-compare
# special case
test-7.1-compare : $(addsuffix .nolinecontinuation,$(wildcard $(addsuffix *_7.1,$(test.gendirs))))
> - diff -c $^
%.nolinecontinuation : %
> $(refsed) -e ':a' -e '/[^\\]\\$$/N; s/\\\n//; ta' < $< > $#
Possibly of interest:
$ apt-cache search '^freebsd'
ctfutils - FreeBSD CTF utilities
freebsd-buildutils - Utilities for building FreeBSD sources
freebsd-glue - Emulate a FreeBSD build environment
freebsd-manpages - Manual pages for a GNU/kFreeBSD system
freebsd-mk - FreeBSD makefile templates for bmake
libarchive-tools - FreeBSD implementations of 'tar' and 'cpio' and other archive tools
libfreebsd-glue-0 - FreeBSD glue environment (shared objects)
libipx2 - FreeBSD IPX address conversion support library
libsbuf6 - FreeBSD string buffer library
libutil-freebsd-9 - FreeBSD utility library

fortran: Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(8)/INTEGER(2))

I am a beginner of Fortran and running a model written by Fortran. When I tried to compile it, I got an error message like:
libtool: link: (cd ".libs" && rm -f "libgrib_api_f77.so" && ln -s "libgrib_api_f77.so.1.0.0" "libgrib_api_f77.so")
libtool: link: ar cru .libs/libgrib_api_f77.a grib_fortran.o grib_f77.o
libtool: link: ranlib .libs/libgrib_api_f77.a
libtool: link: ( cd ".libs" && rm -f "libgrib_api_f77.la" && ln -s "../libgrib_api_f77.la" "libgrib_api_f77.la" )
gfortran -c -o same_int_long.o same_int_long.f90
same_int_long.f90:23:18:
17 | call check_long(x2(1),x2(2),ret)
| 2
......
23 | call check_long(x4(1),x4(2),ret)
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/INTEGER(2)).
same_int_long.f90:29:18:
17 | call check_long(x2(1),x2(2),ret)
| 2
......
29 | call check_long(x8(1),x8(2),ret)
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(8)/INTEGER(2)).
same_int_long.f90:51:17:
45 | call check_int(x2(1),x2(2),ret)
| 2
......
51 | call check_int(x4(1),x4(2),ret)
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/INTEGER(2)).
same_int_long.f90:57:17:
45 | call check_int(x2(1),x2(2),ret)
| 2
......
57 | call check_int(x8(1),x8(2),ret)
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(8)/INTEGER(2)).
make[2]: *** [Makefile:546: same_int_long.o] Error 1
make[2]: Leaving directory '/gpfs/home3/eccei339/snellius_surfex/open_SURFEX_V8_1/src/LIB/grib_api-1.17.0-Source/fortran'
make[1]: *** [Makefile:604: all-recursive] Error 1
make[1]: Leaving directory '/gpfs/home3/eccei339/snellius_surfex/open_SURFEX_V8_1/src/LIB/grib_api-1.17.0-Source'
make: *** [Makefile:398: /home/eccei339/snellius_surfex/open_SURFEX_V8_1/src/LIB/grib_api-1.17.0-Source-LXgfortran/include/grib_api.mod] Error 2
What I did is basically following the installation of the model:
Step1
(base) [eccei339#int3 ~]$ mkdir snellius_surfex
(base) [eccei339#int3 ~]$ cp open_surfex_v8_1_20200107.tar-2.gz snellius_surfex/
(base) [eccei339#int3 ~]$ cd snellius_surfex/
(base) [eccei339#int3 snellius_surfex]$ tar zxvf open_surfex_v8_1_20200107.tar-2.gz
…(omit the tar zxvf logging information)
Step 2: some essential env variable
(base) [eccei339#int3 snellius_surfex]$ export VER_MPI="NOMPI"
(base) [eccei339#int3 snellius_surfex]$ export OMP_NUM_THREADS=1
(base) [eccei339#int3 snellius_surfex]$ module load 2021
(base) [eccei339#int3 snellius_surfex]$ module load GCC/10.3.0
(base) [eccei339#int3 snellius_surfex]$ ls
open_SURFEX_V8_1 open_surfex_v8_1_20200107.tar-2.gz
(here I exported some necessary envi var following the instructions of installation of the software)
Step 3: configure
(base) [eccei339#int3 snellius_surfex]$ cd open_SURFEX_V8_1/src/
(base) [eccei339#int3 src]$ ls
ASSIM Makefile Rules.bullXI15.mk Rules.MCgfortran.mk SURFEX
configure Makefile.SURFEX.mk Rules.bullXI16.mk Rules.SX8.mk
FORC OFFLIN Rules.LXgfortran.mk Rules.zgfortran.mk
include Rules.AIX64.mk Rules.LXifort.mk Rules.zifort.mk
LIB Rules.bgfortran.mk Rules.LXpgi.mk scripts
(base) [eccei339#int3 src]$ ./configure
(omit the long logging info of the “configure” command)
(base) [eccei339#int3 src]$ . ../conf/profile_surfex-LXgfortran-SFX-V8-1-1-NOMPI-OMP-O2-X0
(an essential step following the instructions of installation of the software)
Step 4: make the master
(base) [eccei339#int3 src]$ make
find: ‘/home/eccei339/snellius_surfex/open_SURFEX_V8_1/src/dir_obj-LXgfortran-SFX-V8-1-1-NOMPI-OMP-O2-X0/MASTER’: No such file or directory
cd /home/eccei339/snellius_surfex/open_SURFEX_V8_1/src/LIB/grib_api-1.17.0-Source && LDFLAGS= FCFLAGS= CPPFLAGS="" \
./configure --disable-jpeg --prefix=/home/eccei339/snellius_surfex/open_SURFEX_V8_1/src/LIB/grib_api-1.17.0-Source-LXgfortran FC="gfortran" && \
make -j 1 clean && \
make -j 1 && \
make -j 1 install && \
make -j 1 clean
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
(omit the long logging information, and the final lines are the error message shown in the beginning of this question description.)
I searched the Internet that this could be due to the GCC 10 is more strict than older GCC (I compiled this model last year with older GCC and made it, but failed this time because our server is transferred to a new system, thus the GCC is upgraded from older version to a new version). Some information from Google said that I could add something like this:
export FCFLAGS="-w -fallow-argument-mismatch -O2"
export FFLAGS="-w -fallow-argument-mismatch -O2"
But I tried it in the step 2 where I export some essential environmental variables, it still does not work. So I am wondering is there anybody who can help me? Thanks a lot!
Updates: the source code of grib_api-1.17.0-Source/fortran/same_int_long.f90 from http://distfiles.macports.org/grib_api/ is as following:
! Copyright 2005-2016 ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
integer function kind_of_long()
integer(2), dimension(2) :: x2 = (/1, 2/)
integer(4), dimension(2) :: x4 = (/1, 2/)
integer(8), dimension(2) :: x8 = (/1, 2/)
character(len=1) :: ret
kind_of_long=-1
call check_long(x2(1),x2(2),ret)
if (ret == 't') then
kind_of_long=2
return
endif
call check_long(x4(1),x4(2),ret)
if (ret == 't') then
kind_of_long=4
return
endif
call check_long(x8(1),x8(2),ret)
if (ret == 't') then
kind_of_long=8
return
endif
end function kind_of_long
integer function kind_of_int()
integer(2), dimension(2) :: x2 = (/1, 2/)
integer(4), dimension(2) :: x4 = (/1, 2/)
integer(8), dimension(2) :: x8 = (/1, 2/)
character(len=1) :: ret
kind_of_int=-1
call check_int(x2(1),x2(2),ret)
if (ret == 't') then
kind_of_int=2
return
endif
call check_int(x4(1),x4(2),ret)
if (ret == 't') then
kind_of_int=4
return
endif
call check_int(x8(1),x8(2),ret)
if (ret == 't') then
kind_of_int=8
return
endif
end function kind_of_int
program same_int_long
integer ki,kl
ki=kind_of_int()
kl=kind_of_long()
if (ki /= kl) then
write (*,'(i1)') 0
else
write (*,'(i1)') 1
endif
end program same_int_long
Here is the full log information of make: https://drive.google.com/file/d/14rkj2ay39Rv84QBL6UDiSdlIAfhuEt_z/view?usp=sharing
This appened to me with a MPI fortran code. The cause is a decision from gcc developpers on what should be «good interfaces» see here.
Two solutions in my case :
Tells gfortran to ignore this concerns with option -fallow-argument-mismatch.
Use modern fortran interface (use mpi instead of include mpif.h)
I chose the latter.
What you are instantiating as an INTEGER is getting its value assigned by another (variable or declaration) integer of a different "byte" memory storage size.
e.g. in other languages int is 4 bytes and long is 8 bytes. (note) Fortran also has pointers alike C/C++
https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vna5/index.html
nb: You did not show the code that has the problem , somewhere around line 29 char 18 in source file same_int_long.f90 ??

ERROR: Installing a Fortran library on Ubuntu 12.04

I have been trying to install the library with a Makefile written in Fortran using the latest gfortran version.
The instructions are:
M-LIB is provided with a very bare-bones makefile, which should be
modified for your Fortran compiler. To compile, run make in the src
directory. This creates library lib.a and executable m-lib.
The Makefile is:
FC = gfortran
FCFLAGS = -O3
AR = ar
ARFLAGS = -cru
LDFLAGS =
LIBRARY = lib.a
PROGRAM = m-lib
PROGOBJECTS = LIBTEST.o EOS.o
LIBOBJECTS = ADATA.o \
ADEBY.o \
AE2PH.o \
AEHPP.o \
AEI3.o \
AZRTR.o
%.o: %.f
$(FC) -c $(FCFLAGS) $<
default: $(PROGRAM)
$(LIBRARY): $(LIBOBJECTS)
rm -f $(LIBRARY)
$(AR) -cr $(LIBRARY) $(LIBOBJECTS)
$(PROGRAM): $(PROGOBJECTS) $(LIBRARY)
$(FC) $(FCFLAGS) -o $(PROGRAM) $(PROGOBJECTS) $(LIBRARY)
install:
cp ../input/q_.input ../example/m-lib.INPUT
cp ./m-lib ../example/m-lib
clean:
rm -f $(LIBOBJECTS) $(PROGOBJECTS)
allclean:
rm -f $(PROGRAM) $(LIBRARY)
make clean
And I get this error:
enter codegfortran -c -O3 LIBTEST.f
LIBTEST.f:36.26:
allocate (character(arglen) :: arg)
1
Error: Variable 'arglen' cannot appear in the expression at (1)
LIBTEST.f:99.72:
DO 10 I=1,NDENS
1
Warning: DO loop at (1) will be executed zero times
LIBTEST.f:104.72:
DO 20 J=1,NTEMP
1
Warning: DO loop at (1) will be executed zero times
make: *** [LIBTEST.o] Error 1
¿Any idea what is wrong?
EDIT
This is source code of EOS.o:
SUBROUTINE EOS(TEMP,TEMP0,P,RHO,E,M)
IMPLICIT REAL*8 (A-H,O-Z)
TEMP=TEMP0
IT=0
10 CONTINUE
IT=IT+1
IF(IT.GT.50) STOP 'TOO MANY ITERATIONS--EOS'
CALL ADEBY (TEMP,RHO,P,ETRIAL,S,CV,DPDT,DPDR,FKROS,CS,KPA,M)
IF (ABS(E-ETRIAL) .LT. 1.0D-9*E) RETURN
TEMP=TEMP+(E-ETRIAL)/CV
GOTO 10
END
This is first lines of the source code of LIBTEST.o:
PROGRAM LIBTEST
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
INTEGER STYLE
PARAMETER (NDENS=0)
PARAMETER (NTEMP=0)
DIMENSION IZETL(21)
COMMON /FILEOS/ KLST, KINP
COMMON /ANGELX/ W,Y,ALFA,BETA,DADT,DADR,DBDT,ZZ,ET,
& SN,CVN,EN,PN,PM,EM,SM,CVM,EC,PC,RHO0,RHO00,ZVIB,
& SMLT,CVMLT,EMLT,PMLT,H1,H2
COMMON /ANEEL/ TEVX,RHOX,ABARX,ZBARM,T32X,FNX
& ,PE,EE,SE,CVE,DPTE,DPRE
& ,NMATSX,IIZX
COMMON /ANEDIS/ GAMMA,PSI,THETA
PARAMETER (MATBUF=64)
COMMON /ANESQT/ SQTS(MATBUF),IPSQTS
DIMENSION RHO(NDENS),TEMP(NTEMP),HISTDENS(100),HISTPRESS(100)
DIMENSION HISTDPDR(100)
DIMENSION TARR(2000)
DIMENSION DARR(2000)
DIMENSION PARR(2000,2000)
DIMENSION SARR(2000,2000)
DIMENSION EARR(2000,2000)
DIMENSION CSARR(2000,2000)
DIMENSION CVARR(2000,2000)
DIMENSION ZKARR(2000,2000)
C
CSTS ADDS --help, --no_table, and file checks
character(:), allocatable :: arg
integer arglen, stat
logical file_exists
call get_command_argument(number=1, length=arglen) ! Assume for simplicity success
allocate (character(arglen) :: arg)
call get_command_argument(number=1, value=arg, status=stat)
IF (arg.NE.'--quiet') THEN
write(*,9020)
write(*,9021)
write(*,9022)
write(*,9023)
(...)

do_compile fails when building an image using the yocto-project "no such file or directory"

I tried to append a layer from git (https://github.com/sigysmund/meta-lora-net) to my Image and whenever I try to bitbake one of the recipes (the other worked), I get this error message:
ERROR: lora-pkt-fwd-4.0.1-r0 do_configure: oe_runmake failed
ERROR: lora-pkt-fwd-4.0.1-r0 do_configure: Function failed: do_configure (log file is located at /home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/temp/log.do_configure.23440)
ERROR: Logfile of failure stored in: /home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/temp/log.do_configure.23440
(see last part for full message)
I have already tried to edit the bb file.
I changed the DEPENDS to "lora-gateway pkgconfig" instead of just the name since I read on another thread, that this can produce Issues but it didn't help.
This is the bb file of the recipe:
SUMMARY = "LoRa network packet forwarder project"
SECTION = "libs/network"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=22af7693d7b76ef0fc76161c4be76c45"
SRC_URI = "https://github.com/Lora-net/packet_forwarder/archive/v${PV}.tar.gz"
SRC_URI[md5sum] = "a1f942e0cc7b02d604b11c8cb5f2a029"
SRC_URI[sha256sum] = "e68fadf6f1d2e5e7b601e504d5efb48b0a8f374c2c29c0476ab2fe9db68d33ae"
#old: DEPENDS += "lora-gateway"
# since new release of yocto you should add pkg-config
DEPENDS += "lora-gateway pkgconfig"
S = "${WORKDIR}/packet_forwarder-${PV}"
CFLAGS_append = "-I ${includedir}/libloragw -I ${S}/lora_pkt_fwd/inc -I ${S}/util_tx_test/inc "
do_configure_prepend() {
export LGW_PATH="${STAGING_LIBDIR}/libloragw"
}
do_compile_prepend() {
export LGW_PATH="${STAGING_LIBDIR}/libloragw"
}
do_install() {
install -d ${D}${bindir}
install -d ${D}${docdir}/lora-pkt-fwd/conf
install ${B}/lora_pkt_fwd/lora_pkt_fwd ${D}${bindir}
install ${B}/util_*/util_* ${D}${bindir}
install -D -m 0644 ${S}/PROTOCOL.TXT ${D}${docdir}/lora-pkt-fwd/PROTOCOL.TXT
install -D -m 0644 ${S}/lora_pkt_fwd/readme.md ${D}${docdir}/lora-pkt-fwd/readme.md
install -D -m 0644 ${S}/lora_pkt_fwd/global_conf.json ${D}${docdir}/lora-pkt-fwd/global_conf.json
install -D -m 0644 ${S}/lora_pkt_fwd/local_conf.json ${D}${docdir}/lora-pkt-fwd/local_conf.json
install -D -m 0755 ${S}/lora_pkt_fwd/update_gwid.sh ${D}${docdir}/lora-pkt-fwd
install -D -m 0644 ${S}/lora_pkt_fwd/cfg/*.json.* ${D}${docdir}/lora-pkt-fwd/conf
rm -f ${D}${bindir}/util_tx_test
rm -f ${D}${bindir}/.debug/util_tx_test
}
PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src"
PACKAGES = "${PN}-dbg ${PN} ${PN}-doc"
# Avoid QA Issue: No GNU_HASH in the elf binary
INSANE_SKIP_${PN} = "ldflags"
FILES_${PN}-dbg = " \
${bindir}/.debug \
"
FILES_${PN} = " \
${bindir}/* \
"
FILES_${PN}-doc = " \
${docdir} \
"
the full error is:
ERROR: lora-pkt-fwd-4.0.1-r0 do_configure: oe_runmake failed
ERROR: lora-pkt-fwd-4.0.1-r0 do_configure: Function failed: do_configure (log file is located at /home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/temp/log.do_configure.23440)
ERROR: Logfile of failure stored in: /home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/temp/log.do_configure.23440
Log data follows:
| DEBUG: Executing python function sysroot_cleansstate
| DEBUG: Python function sysroot_cleansstate finished
| DEBUG: Executing shell function do_configure
| NOTE: make clean
| ERROR: oe_runmake failed
| make clean -e -C lora_pkt_fwd
| make[1]: Entering directory `/home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/packet_forwarder-4.0.1/lora_pkt_fwd'
| Makefile:17: /home/kilian/mlinux-4.x/build/tmp/sysroots/mtcdt/usr/lib/libloragw/library.cfg: No such file or directory
| make[1]: *** No rule to make target `/home/kilian/mlinux-4.x/build/tmp/sysroots/mtcdt/usr/lib/libloragw/library.cfg'. Stop.
| make[1]: Leaving directory `/home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/packet_forwarder-4.0.1/lora_pkt_fwd'
| make: *** [clean] Error 2
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_configure (log file is located at /home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/temp/log.do_configure.23440)
ERROR: Task (/home/kilian/mlinux-4.x/layers/meta-custom/recipes-wireless/lora-pkt-fwd/lora-pkt-fwd_4.0.1.bb:do_configure) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1590 tasks of which 1580 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/home/kilian/mlinux-4.x/layers/meta-custom/recipes-wireless/lora-pkt-fwd/lora-pkt-fwd_4.0.1.bb:do_configure
Summary: There was 1 WARNING message shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
I know that is has got something to do with the libloragw/library.cfg file but since that is imported and I don't know enough about these scripts, I can't find the error.
Any hint is really appreciated!
P.s I didn't include the logfiles since everything in there is already in the Log data follows part of the error. If you need it I can upload it.
Edit:
Thank you jku, appending CLEANBROKEN = "1" fixed this error.
Sadly I am getting a new one:
ERROR: lora-pkt-fwd-4.0.1-r0 do_compile: oe_runmake failed
ERROR: lora-pkt-fwd-4.0.1-r0 do_compile: Function failed: do_compile (log file is located at /home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/temp/log.do_compile.24486)
ERROR: Logfile of failure stored in: /home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/temp/log.do_compile.24486
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 2
| ERROR: oe_runmake failed
| make all -e -C lora_pkt_fwd
| make[1]: Entering directory `/home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/packet_forwarder-4.0.1/lora_pkt_fwd'
| Makefile:17: /home/kilian/mlinux-4.x/build/tmp/sysroots/mtcdt/usr/lib/libloragw/library.cfg: No such file or directory
| make[1]: *** No rule to make target `/home/kilian/mlinux-4.x/build/tmp/sysroots/mtcdt/usr/lib/libloragw/library.cfg'. Stop.
| make[1]: Leaving directory `/home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/packet_forwarder-4.0.1/lora_pkt_fwd'
| make: *** [all] Error 2
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/kilian/mlinux-4.x/build/tmp/work/arm926ejste-mlinux-linux-gnueabi/lora-pkt-fwd/4.0.1-r0/temp/log.do_compile.24486)
So there is still a problem with the libloragw/library.cfg file
I did check and there is such a file in the recipe given by the DEPENDS variable so I guess that including that and the corresponding commands don't work
CFLAGS_append = "-I ${includedir}/libloragw -I ${S}/lora_pkt_fwd/inc -I ${S}/util_tx_test/inc "
do_configure_prepend() {
export LGW_PATH="${STAGING_LIBDIR}/libloragw"
}
do_compile_prepend() {
export LGW_PATH="${STAGING_LIBDIR}/libloragw"
}
But I still don't know what to edit so any help is precious.
| DEBUG: Executing shell function do_configure
| NOTE: make clean
| ERROR: oe_runmake failed
| make clean -e -C lora_pkt_fwd
Yocto/OpenEmbedded tries to run "make clean" during configure to ensure a reproducible build but this particular project fails to do so cleanly. You can either fix the project (patching the Makefile) or add
CLEANBROKEN = "1"
in the recipe: this way OpenEmbedded won't run make clean on configure.

Weka command line attributes arguments

On the command line, I'm able to get this rolling with no problem:
java weka.Run weka.classifiers.timeseries.WekaForecaster -W
"weka.classifiers.functions.MultilayerPerceptron -L 0.01 -M 0.2 -N 500 -V 0 -S 0 -E 20 -H 20 " -t "C:\MyFile.arff" -F DirectionNumeric -L 1 -M 3 -prime 3 -horizon 6 -holdout 100 -G TradeDay -dayofweek -weekend -future
But once I try to put the skip list, I start to get errors saying that it's missing a date that is not in the skip list even though the date is in fact on it:
java weka.Run weka.classifiers.timeseries.WekaForecaster -W "weka.classifiers.functions.MultilayerPerceptron -L 0.01 -M 0.2 -N 500 -V 0 -S 0 -E 20 -H 20 " -t "C:\MyFile.arff" -F DirectionNumeric -L 1 -M 3 -prime 3 -horizon 6 -holdout 100 -G TradeDay -dayofweek -weekend -future -skip ""2014-06-07#yyyy-MM-dd, 2014-06-12"
Does anybody knows how to get this working? Weka is low on documentation as far as I know.
Thank's in advance!
Forget it. I got it, the problem was the 's' must be in capital letters:
-Skip
instead of
-skip.

Resources