# Mender-client compile failing

**URL:** <https://hub.mender.io/t/mender-client-compile-failing/2060>\
**Category:** General Discussions\
**Tags:** mender-client\
**Created:** [June 17, 2020, 1:29pm UTC](https://hub.mender.io/t/mender-client-compile-failing/2060 "2020-06-17T13:29:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://hub.mender.io/u/martin)\
**Post date:** [June 17, 2020, 1:29pm UTC](https://hub.mender.io/t/mender-client-compile-failing/2060/1 "2020-06-17T13:29:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://hub.mender.io/u/martin)\
**Post date:** [June 17, 2020, 2:04pm UTC](https://hub.mender.io/t/mender-client-compile-failing/2060/2 "2020-06-17T14:04:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [June 17, 2020, 5:14pm UTC](https://hub.mender.io/t/mender-client-compile-failing/2060/3 "2020-06-17T17:14:50Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![wkswain](https://avatars.discourse-cdn.com/v4/letter/w/3e96dc/32.png) [@wkswain](https://hub.mender.io/u/wkswain)\
**Post date:** [June 17, 2020, 11:35pm UTC](https://hub.mender.io/t/mender-client-compile-failing/2060/4 "2020-06-17T23:35:16Z")

</div>

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](https://elinux.org/How_to_make_a_yocto_rootfs_for_MIPS_CI20)

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

---

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://hub.mender.io/u/martin)\
**Post date:** [June 18, 2020, 7:53am UTC](https://hub.mender.io/t/mender-client-compile-failing/2060/5 "2020-06-18T07:53:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [June 18, 2020, 8:00am UTC](https://hub.mender.io/t/mender-client-compile-failing/2060/6 "2020-06-18T08:00:47Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![elliotmtx](https://avatars.discourse-cdn.com/v4/letter/e/4491bb/32.png) [@elliotmtx](https://hub.mender.io/u/elliotmtx)\
**Post date:** [November 9, 2020, 2:39pm UTC](https://hub.mender.io/t/mender-client-compile-failing/2060/7 "2020-11-09T14:39:44Z")

</div>

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](http://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.

---

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://hub.mender.io/u/martin)\
**Post date:** [December 4, 2020, 4:52pm UTC](https://hub.mender.io/t/mender-client-compile-failing/2060/8 "2020-12-04T16:52:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://hub.mender.io/u/martin)\
**Post date:** [December 4, 2020, 5:52pm UTC](https://hub.mender.io/t/mender-client-compile-failing/2060/9 "2020-12-04T17:52:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://hub.mender.io/u/martin)\
**Post date:** [December 4, 2020, 7:09pm UTC](https://hub.mender.io/t/mender-client-compile-failing/2060/10 "2020-12-04T19:09:40Z")

</div>

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?
