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

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 ??

Related

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)
(...)

espeak-ng cross compile make install issue

I am trying to cross compile espeak-ng for target=arm-linux-gnueabihf
The sudo make install step gives the following error :
~:~/Downloads/Dependencies/espeak-ng-master$ sudo make install
[sudo] password for abc:
ESPEAK_DATA_PATH=../Downloads/Dependencies/espeak-ng-master src/espeak-ng --compile-intonations && \
ESPEAK_DATA_PATH=../Downloads/Dependencies/espeak-ng-master src/espeak-ng --compile-phonemes && \
touch phsource/phonemes.stamp
src/espeak-ng: line 117: ../Downloads/Dependencies/espeak-ng-master/src/.libs/espeak-ng: cannot execute binary file: Exec format error
src/espeak-ng: line 117: ../Downloads/Dependencies/espeak-ng-master/src/.libs/espeak-ng: Success
Makefile:2590: recipe for target 'phsource/phonemes.stamp' failed
make: *** [phsource/phonemes.stamp] Error 126
I have cross compiled using the following :
./configure CC=arm-linux-gnueabihf-gcc -prefix /opt/myproject-sysroot/usr --build=$MACHTYPE --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
make -B src/speak-ng src/espeak-ng
Configure output
Configuration for eSpeak NG complete.
Source code location: .
C99 Compiler: arm-linux-gnueabihf-gcc
C99 Compiler flags: -Wunused-parameter -Wunused -Wuninitialized -Wreturn-type -Wmissing-prototypes -Wimplicit -g -O2 -std=c99
Sonic: no
PCAudioLib: no
gradle (Android): gradle
ndk-build (Android):
Klatt: yes
MBROLA: yes
Async: yes
Extended Dictionaries:
Russian: no
Chinese (Mandarin): no
Chinese (Cantonese): no
~/Downloads/Dependencies/ESPEAK/espeak-ng-master$ sudo make -B src/speak-ng src/espeak-ng
Output for make command:
---------------
-----------
CC src/libespeak-ng/src_libespeak_ng_la-tr_languages.lo
CC src/libespeak-ng/src_libespeak_ng_la-voices.lo
CC src/libespeak-ng/src_libespeak_ng_la-wavegen.lo
src/libespeak-ng/wavegen.c: In function ‘WavegenFill’:
src/libespeak-ng/wavegen.c:1400:17: warning: variable ‘p_start’ set but not used [-Wunused-but-set-variable]
unsigned char *p_start;
^~~~~~~
CC src/libespeak-ng/src_libespeak_ng_la-klatt.lo
CC src/libespeak-ng/src_libespeak_ng_la-mbrowrap.lo
CC src/libespeak-ng/src_libespeak_ng_la-espeak_command.lo
CC src/libespeak-ng/src_libespeak_ng_la-event.lo
CC src/libespeak-ng/src_libespeak_ng_la-fifo.lo
CCLD src/libespeak-ng.la
arm-linux-gnueabihf-ar: `u' modifier ignored since `D' is the default (see `U')
CCLD src/speak-ng
CC src/espeak-ng.o
src/espeak-ng.c: In function ‘main’:
src/espeak-ng.c:744:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
fread(p_text, 1, filesize, f_text);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CCLD src/espeak-ng
Make install output
~/Downloads/Dependencies/ESPEAK/espeak-ng-master$ sudo make LIBDIR=/opt/myproject-sysroot/usr install
ESPEAK_DATA_PATH=../Downloads/Dependencies/ESPEAK/espeak-ng-master src/espeak-ng --compile-intonations && \
ESPEAK_DATA_PATH=../Downloads/Dependencies/ESPEAK/espeak-ng-master src/espeak-ng --compile-phonemes && \
touch phsource/phonemes.stamp
src/espeak-ng: line 117: ../Downloads/Dependencies/ESPEAK/espeak-ng-master/src/.libs/espeak-ng: cannot execute binary file: Exec format error
src/espeak-ng: line 117: ../Downloads/Dependencies/ESPEAK/espeak-ng-master/src/.libs/espeak-ng: Success
Makefile:2590: recipe for target 'phsource/phonemes.stamp' failed
make: *** [phsource/phonemes.stamp] Error 126

Cannot update Yocto Bitbake Recipe for Bzip2 from 1.0.6 to 1.0.7 for CVE-2019-12900 for Nvidia Jetson Nano

On Ubuntu 18.04 I am trying to build a Yocto SD Card Image for the Nvidia Jetson Nano using the "meta-tegra" layer. I ran into the recent bzip2 issue that requires the latest bzip2 ( 1.0.7 ) to fix as detailed in these forum posts:
https://devtalk.nvidia.com/default/topic/1056301/b/t/post/5355418/
https://devtalk.nvidia.com/default/topic/1056381/jetson-agx-xavier/jetpack-4-2-xavier-install-failed/1
I found the latest bzip2 source here:
https://www.sourceware.org/bzip2/downloads.html
I tried playing with ${WORKDIR}, ${S}, do_compile_append, and do_install_append, however I keep getting errors related to the wrong source directory. I basically took the OE Bzip2 1.0.6 recipe and change the version source and checksums.
Please help me fix this build issue with yocto - thanks!
Bitbake Failure:
Initialising tasks: 100% |##########################################################################| Time: 0:00:00
Sstate summary: Wanted 382 Found 0 Missed 382 Current 45 (0% match, 10% complete)
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: bzip2-native-1.0.7-r5 do_compile: oe_runmake failed
ERROR: bzip2-native-1.0.7-r5 do_compile: Function failed: do_compile (log file is located at /home/ubuntu/Desktop/mts-jetson-yocto/build/tmp/work/x86_64-linux/bzip2-native/1.0.7-r5/temp/log.do_compile.115964)
ERROR: Logfile of failure stored in: /home/ubuntu/Desktop/mts-jetson-yocto/build/tmp/work/x86_64-linux/bzip2-native/1.0.7-r5/temp/log.do_compile.115964
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 128
| make: *** No targets specified and no makefile found. Stop.
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /home/ubuntu/Desktop/mts-jetson-yocto/build/tmp/work/x86_64-linux/bzip2-native/1.0.7-r5/temp/log.do_compile.115964)
ERROR: Task (virtual:native:/home/ubuntu/Desktop/mts-jetson-yocto/layers/meta-mts/recipes-extended/bzip2/bzip2_1.0.7.bb:do_compile) failed with exit code '1'
Second Keyboard Interrupt, stopping...
Summary: 1 task failed:
virtual:native:/home/ubuntu/Desktop/mts-jetson-yocto/layers/meta-mts/recipes-extended/bzip2/bzip2_1.0.7.bb:do_compile
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
Current Broken Bitbake recipe:
SECTION = "console/utils"
LICENSE = "bzip2"
LIC_FILES_CHKSUM = "file://LICENSE;beginline=4;endline=37;md5=39406315f540c69bd05b1531daedd2ae"
PR = "r5"
SRC_URI = "https://www.sourceware.org/pub/bzip2/bzip2-1.0.7.tar.gz \
"
#WORKDIR = "${WORKDIR}/bzip-1.0.7"
#WORKDIR = "${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}/${PN}/${EXTENDPE}${PV}-${PR}/bzip2-1.0.7"
#S = "${WORKDIR}/bzip2-1.0.7"
#do_compile_prepend() {
# cd ../
#}
#do_install_prepend() {
# cd ../
#}
SRC_URI[md5sum] = "1a6a61cc867be4f3d6549037a09bf13e"
SRC_URI[sha256sum] = "e768a87c5b1a79511499beb41500bcc4caf203726fff46a6f5f9ad27fe08ab2b"
UPSTREAM_CHECK_URI = "https://www.sourceware.org/bzip2/"
UPSTREAM_VERSION_UNKNOWN = "1"
PACKAGES =+ "libbz2"
CFLAGS_append = " -fPIC -fpic -Winline -fno-strength-reduce -D_FILE_OFFSET_BITS=64"
inherit autotools update-alternatives ptest relative_symlinks
ALTERNATIVE_PRIORITY = "100"
ALTERNATIVE_${PN} = "bunzip2 bzcat bzip2"
#install binaries to bzip2-native under sysroot for replacement-native
EXTRA_OECONF_append_class-native = " --bindir=${STAGING_BINDIR_NATIVE}/${PN}"
do_install_ptest () {
sed -i -e "s|^Makefile:|_Makefile:|" ${D}${PTEST_PATH}/Makefile
}
FILES_libbz2 = "${libdir}/lib*${SOLIBS}"
PROVIDES_append_class-native = " bzip2-replacement-native"
BBCLASSEXTEND = "native nativesdk"
#addtask fix_path before do_compile
Two ideas:
Just apply the patch for the security issue, much easier. This patch is already on the oe-core list.
Take the upgrade patch that is also on the list

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.

Link error undefined reference to `dgels_' in Lapack

I followed this below webpage to install ATLAS + Lapack in linux :
http://math-atlas.sourceforge.net/atlas_install/node6.html
bunzip2 -c atlas3.10.1.tar.bz2 | tar xfm - # create SRCdir
mv ATLAS ATLAS3.10.1 # get unique dir name
cd ATLAS3.10.1 # enter SRCdir
mkdir Linux_C2D64SSE3 # create BLDdir
cd Linux_C2D64SSE3 # enter BLDdir
../configure -b 64 -D c -DPentiumCPS=2400 \ # configure command
--prefix=/home/whaley/lib/atlas \ # install dir
--with-netlib-lapack-tarfile=/home/whaley/dload/lapack-3.4.2.tgz
make build # tune & build lib
make check # sanity check correct answer
make ptcheck # sanity check parallel
make time # check if lib is fast
make install # copy libs to install dir
After that , I try to run an sample in
http://www.netlib.org/lapack/lapacke.html
the sample code :
#include <stdio.h>
#include <lapacke.h>
int main (int argc, const char * argv[])
{
double a[5*3] = {1,2,3,4,5,1,3,5,2,4,1,4,2,5,3};
double b[5*2] = {-10,12,14,16,18,-3,14,12,16,16};
lapack_int info,m,n,lda,ldb,nrhs;
int i,j;
m = 5;
n = 3;
nrhs = 2;
lda = 5;
ldb = 5;
info = LAPACKE_dgels(LAPACK_COL_MAJOR,'N',m,n,nrhs,a,lda,b,ldb);
for(i=0;i<n;i++)
{
for(j=0;j<nrhs;j++)
{
printf("%lf ",b[i+ldb*j]);
}
printf("\n");
}
return(info);
}
I have found out the build library has no iblapacke.a , so I build this library by myslef
cd lapack-3.4.2
cp make.inc.example make.inc
cd lapacke
make
Then , finally I have the iblapacke.a now , so I compile the sample above by :
g++ test3.cpp liblapacke.a -o test3.exe
I get the following errors :
liblapacke.a(lapacke_dgels_work.o): In function `LAPACKE_dgels_work':
lapacke_dgels_work.c:(.text+0x1dd): undefined reference to `dgels_'
lapacke_dgels_work.c:(.text+0x2b7): undefined reference to `dgels_'
After I google , I have found :
http://www.netlib.org/lapack/explore-html/d7/d3b/group__double_g_esolve.html
Functions/Subroutines
subroutine dgels (TRANS, M, N, NRHS, A, LDA, B, LDB, WORK, LWORK, INFO)
DGELS solves overdetermined or underdetermined systems for GE matrices
There is a function dgels , without underline , and in
http://shtools.ipgp.fr/www/faq.html#l4
I think the underline is added for accident ,
nm -A liblapacke.a |grep "dgels_"
liblapacke.a:lapacke_dgels.o: U LAPACKE_dgels_work
liblapacke.a:lapacke_dgels_work.o: U LAPACKE_dge_trans
liblapacke.a:lapacke_dgels_work.o:0000000000000000 T LAPACKE_dgels_work
liblapacke.a:lapacke_dgels_work.o: U LAPACKE_xerbla
liblapacke.a:lapacke_dgels_work.o: U dgels_
liblapacke.a:lapacke_dgels_work.o: U free
liblapacke.a:lapacke_dgels_work.o: U malloc
I think I should try to not avoid underline like build "dgels" not to "dgels" while build liblapack.a ,means I should change something build Lapack and ATLAS ,
just don't know how to do it ....Any suggestion is appreciated !!
Update : http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_lapack_examples/c_bindings.htm
I have no idea if related , -Ddgels=dgels_ is added , the same link error !!
see:
http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=12&t=3336
for example:
gcc LinearEquation.c -Ilapack-3.5.0/lapacke/include/ -Llapack-3.5.0 -llapacke -llapack -lrefblas -lgfortran -o LinearEquation
the order of lapacke > lapack > refblas is important... also if you don't want to use the double step gcc gfortran, use -lgfortran
I had the exact same problem. You need to do it as follows:
gcc(or g++) -c -O3 -I ../include -o test.o test.c
and then
gfortran test.o ../liblapacke.a ../liblapack.a ../blas.a -o test.exe
You can then run it like so:
./test.exe
Basically, you need to follow the gcc compile with a gfortran compile. The -c option in the first command forces gcc to skip the linker. gfortran is then used to link the libraries.
You can learn more by looking at the makefile for the examples provided with LAPACKE.
I had the same problem (using g++), but fixed my problems by adding a -lblas and -lgfortran.
To resolve the issue, here are the steps I have done.
sudo apt-get install libblas-dev liblapack-dev gfortran
linking a -lblas and -lgfortran when it runs

Resources