Mender-client compile failing

Hi,

The mender-client is failing to compile within Yocto. Here is the console output:

md5sum: /ws/rufilla/octopus/yocto/build-release/tmp/work/mips32r2el-24kec-nf-poky-linux/mender-client/2.2.0-r0/server.crt: No such file or directory
NOTE: make -j 4 V=1
mipsel-poky-linux-go build -ldflags "-X github.com/mendersoftware/mender/conf.Version=2.2.0" -v 
# github.com/mendersoftware/mender/vendor/github.com/remyoudompheng/go-liblzma
{standard input}: Assembler messages:
{standard input}: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/remyoudompheng/go-liblzma
{standard input}: Assembler messages:
{standard input}:17: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/remyoudompheng/go-liblzma
{standard input}: Assembler messages:
{standard input}:17: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/remyoudompheng/go-liblzma
{standard input}: Assembler messages:
{standard input}:17: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
github.com/mendersoftware/mender/system
# github.com/mendersoftware/mender/system
system/ioctl.go:165:19: cannot use stat.Rdev (type uint32) as type uint64 in argument to unix.Major
system/ioctl.go:165:42: cannot use stat.Rdev (type uint32) as type uint64 in argument to unix.Minor
system/ioctl.go:173:19: cannot use stat.Dev (type uint32) as type uint64 in argument to unix.Major
system/ioctl.go:173:41: cannot use stat.Dev (type uint32) as type uint64 in argument to unix.Minor
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}:17: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}:17: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}:17: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}:17: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}:17: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}:17: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}:17: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
mdb.c: In function 'mdb_cursor_put':
mdb.c:6535:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
 6535 |      if (SIZELEFT(fp) < offset) {
      |         ^
mdb.c:6540:5: note: here
 6540 |     case MDB_CURRENT:
      |     ^~~~
{standard input}: Assembler messages:
{standard input}:16: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}:16: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
{standard input}: Assembler messages:
{standard input}:17: Warning: the `dsp' extension requires MIPS32 revision 2 or greater
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
vendor/github.com/bmatsuo/lmdb-go/lmdb/val.go:116:11: type [2147483647]byte larger than address space
Makefile:74: recipe for target 'mender' failed
make: *** [mender] Error 2
ERROR: oe_runmake failed
WARNING: temp/run.do_compile:1 exit 1 from 'exit 1'

Any ideas as to what is going wrong? I’m using the zeus branch and the board has a MIPS based processor, should be rev 2 so I think I can ignore those warnings.

Many Thanks,
Martin.

Tracked it down to /src/github.com/mendersoftware/mender/vendor/github.com/bmatsuo
In lmdb-go/lmdb/val.go the function that fails is

func getBytes(val C.MDB_val) []byte {
return (
[valMaxSize]byte)(unsafe.Pointer(val.mv_data))[:val.mv_size:val.mv_size]
}

valMaxSize is calculated with

const (
valSizeBits = lmdbarch.Width64*32 + (1-lmdbarch.Width64)*31
valMaxSize = 1<<valSizeBits - 1
)

Sadly I don’t know much about go so can’t workout how to fix this properly but changing the *31 to *30 means it compiles.

Looks like you are building for MIPS which I don’t believe we have done any time recently (although I may be incorrect). It’s possible that is somehow related.

@kacf any ideas?

I believe you may find your answer here. No idea if these are included in zeus for your platform.

https://elinux.org/How_to_make_a_yocto_rootfs_for_MIPS_CI20

See the sections on:
Adding support for MIPS32r2
Adding the CI20 machine

1 Like

I have the following

DEFAULTTUNE = “mips32r2el-24kec”
require conf/machine/include/mips/tune-mips-24k.inc

which I believe is correct for Zeus. This should be the rev 2 which is required for the client.

It looks like you are also hitting this bug, https://github.com/mendersoftware/mender/commit/9c5c16190158c07838dc94c80c591e3741dde640#diff-a48daccd61950d577922656f941b1ac3

My GO fu is not great either, and tagging @kacf and @oleorhagen :slight_smile:

Hi,

I am facing this same compilation error, its a warning but build is been stooped.
DEBUG: Executing shell function do_compile_ptest_base

github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb

mdb.c: In function ‘mdb_cursor_put’:
mdb.c:6535:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
if (SIZELEFT(fp) < offset) {
^
mdb.c:6540:5: note: here
case MDB_CURRENT:
^~~~

Can anyone please help me.

I’ve applied the following patch to get it to compile:

 vendor/github.com/bmatsuo/lmdb-go/lmdb/val.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb/val.go b/src/github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb/val.go
index 528d7f0..ee0b394 100644
--- a/src/github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb/val.go
+++ b/src/github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb/val.go
@@ -25,7 +25,7 @@ import (
 // On 64-bit systems, luckily, the value 2^32-1 coincides with the maximum data
 // size for LMDB (MAXDATASIZE).
 const (
-	valSizeBits = lmdbarch.Width64*32 + (1-lmdbarch.Width64)*31
+	valSizeBits = lmdbarch.Width64*32 + (1-lmdbarch.Width64)*30
 	valMaxSize  = 1<<valSizeBits - 1
 )
 
-- 
2.7.4

but it segfaults when I try and run it

# ./mender
Segmentation fault

The version of the compiler is

2.3.1-r0$ ./recipe-sysroot-native/usr/bin/mipsel-poky-linux/mipsel-poky-linux-go version
go version go1.15.2 linux/amd64

Any ideas on how to debug this?

It’s now working. I think the binary somehow got corrupted when copying across. @elliotmtx try the patch above if you are still having problems.

after rebuilding the image and flashing the problem is back. If I scp the mender binary from

./packages-split/mender-client/usr/bin/mender

it works. I’ve checked the md5sums of the mender on the target and the one above and they are different.

# md5sum /usr/bin/mender
46ea2e9418a86ec37dc4764d5036fa46  /usr/bin/mender
$ md5sum ./packages-split/mender-client/usr/bin/mender 
cd50800d6f518e729c492778567dd27f  ./packages-split/mender-client/usr/bin/mender

and the file sizes are different

# ls -la /usr/bin/mender
-rwxr-xr-x    1 root     root       7023252 Mar  9  2018 /usr/bin/mender
$ ls -la ./packages-split/mender-client/usr/bin/mender 
-rwxr-xr-x 2 martin martin 7016180 Dec  4 18:47 ./packages-split/mender-client/usr/bin/mender

Any ideas as to what is going on before I delve into the mender-client recipe?