# Cross compiling for Debian 8 (jessie)

**URL:** <https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673>\
**Category:** General Discussions\
**Tags:** debian, jessie\
**Created:** [May 24, 2021, 7:43pm UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673 "2021-05-24T19:43:56Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![hancerli](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/hancerli/32/1185_2.png) [@hancerli](https://hub.mender.io/u/hancerli)\
**Post date:** [May 24, 2021, 7:43pm UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/1 "2021-05-24T19:43:57Z")

</div>

Hi there,

I’m trying to install Mender client to an armhf Debian (8) jessie system via deb packages but even the oldest one does not fit the because of the glibc version (mender requires at least 2.29 but jessie has 2.19).

Cross-compiling is also not working because of libtool and automake version incompatibility when building glib-2.0.

As the last chance I tried native compilation on the target device but it seems the golang version on the jessie 8 does not let me compile it.

Any suggestions? My host device is Arch-x86.

---

<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:** [May 24, 2021, 8:22pm UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/2 "2021-05-24T20:22:01Z")

</div>

I have not tried this myself. Perhaps @kacf or @lluiscampos may be able to help.

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [May 25, 2021, 9:34am UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/3 "2021-05-25T09:34:35Z")

</div>

I think I tried to cross-compile in Jessie once, too. And from my blurry memory I just remember it being quite a nightmare…

Cross-compile support in Debian had really improved in Debian Stretch and earlier, as you can easily configure apt to get packages for other architectures (namely libraries), but from your question I assume you need it to be Jessie.

So without and strong proof but I would suggest native compilation. If you try with an old Mender client you might be able to workaround the golang version requirement. Otherwise post us here the golang version you are using, and the compile error to see if it is possible to workaround by patching the code…

---

<div class="post-metadata">

**Author:** ![hancerli](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/hancerli/32/1185_2.png) [@hancerli](https://hub.mender.io/u/hancerli)\
**Post date:** [May 25, 2021, 9:44am UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/4 "2021-05-25T09:44:05Z")

</div>

Here’re the native compilation issues coming from versions 1.3.x, 1.4.x, and 1.5.x;

```
mender-1.x.x # make
go build -ldflags "-X main.Version=a8d1d2f"  
../src/github.com/sirupsen/logrus/entry.go:5:2: cannot find package "context" in any of:
        /usr/lib/go/src/pkg/context (from $GOROOT)
        /root/src/context (from $GOPATH)
deployment_log_hook.go:20:2: cannot find package "github.com/Sirupsen/logrus" in any of:
        /usr/lib/go/src/pkg/github.com/Sirupsen/logrus (from $GOROOT)
        /root/src/github.com/Sirupsen/logrus (from $GOPATH)
../src/github.com/minio/sha256-simd/cpuid_other.go:23:2: cannot find package "github.com/klauspost/cpuid/v2" in any of:
        /usr/lib/go/src/pkg/github.com/klauspost/cpuid/v2 (from $GOROOT)
        /root/src/github.com/klauspost/cpuid/v2 (from $GOPATH)
auth.go:20:2: cannot find package "github.com/mendersoftware/log" in any of:
        /usr/lib/go/src/pkg/github.com/mendersoftware/log (from $GOROOT)
        /root/src/github.com/mendersoftware/log (from $GOPATH)
../src/golang.org/x/sys/unix/affinity_linux.go:10:2: cannot find package "math/bits" in any of:
        /usr/lib/go/src/pkg/math/bits (from $GOROOT)
        /root/src/math/bits (from $GOPATH)
Makefile:37: recipe for target 'build' failed
make: *** [build] Error 1

```

And I couldn’t install any of those packages with go get (go1.3.3 linux/arm).

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [May 25, 2021, 10:53am UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/5 "2021-05-25T10:53:51Z")

</div>

Hi @hancerli

Unfortunately, I found out that Debian Jessie uses golang 1.3… which predates Mender 1.0. After adding some hacks to make the GOPAH find packages in the `vendor/` folder (maybe this was not supported at the time of golang 1.3?) I came to simple errors like:

```auto
root@73cc9bd2c724:~/go/src/github.com/mendersoftware/mender# go build
# github.com/mendersoftware/log
../log/log.go:188: undefined: strings.LastIndexByte
../log/log.go:192: undefined: strings.LastIndexByte
# github.com/mendersoftware/mender-artifact/parser
../mender-artifact/parser/generic_parser.go:82: undefined: strings.Compare
../mender-artifact/parser/generic_parser.go:89: undefined: strings.Compare
(...)

```

So yeah, that seems to be a dead road.

Next to try could be downloading a [newer golang](https://golang.org/dl/) from upstream (instead of using Jessie’s one)

---

<div class="post-metadata">

**Author:** ![hancerli](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/hancerli/32/1185_2.png) [@hancerli](https://hub.mender.io/u/hancerli)\
**Post date:** [May 25, 2021, 11:07am UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/6 "2021-05-25T11:07:02Z")

</div>

So unfortunate but thanks anyway. I’ll give it a try with a newer golang version.

Any suggestion on which version I should try?

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [May 25, 2021, 11:13am UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/7 "2021-05-25T11:13:24Z")

</div>

I would actually try latest 🤞

---

<div class="post-metadata">

**Author:** ![hancerli](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/hancerli/32/1185_2.png) [@hancerli](https://hub.mender.io/u/hancerli)\
**Post date:** [May 26, 2021, 10:29am UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/8 "2021-05-26T10:29:15Z")

</div>

Thanks for the suggestion. Btw, I’m kind of new to golang, so please consider I may follow incorrect leads or report unrelated outputs mistakenly :).

Trying with go v1.16 but keep getting these issues:

```
mender-1.5 # make 
go build -ldflags "-X main.Version=4dc2179"  
deployment_log_hook.go:20:2: cannot find package "github.com/Sirupsen/logrus" in any of:
        /usr/lib/go/src/pkg/github.com/Sirupsen/logrus (from $GOROOT)
        /root/go/src/github.com/Sirupsen/logrus (from $GOPATH)
../go/src/github.com/minio/sha256-simd/cpuid_other.go:23:2: cannot find package "github.com/klauspost/cpuid/v2" in any of:
        /usr/lib/go/src/pkg/github.com/klauspost/cpuid/v2 (from $GOROOT)
        /root/go/src/github.com/klauspost/cpuid/v2 (from $GOPATH)
auth.go:20:2: cannot find package "github.com/mendersoftware/log" in any of:
        /usr/lib/go/src/pkg/github.com/mendersoftware/log (from $GOROOT)
        /root/go/src/github.com/mendersoftware/log (from $GOPATH)
Makefile:37: recipe for target 'build' failed
make: *** [build] Error 1

```

However, both cpuid and logrus packages are already installed.

```
 mender-1.5 # tree -L 2 /root/go/src/github.com/
/root/go/src/github.com/
|-- bmatsuo
| `-- lmdb-go
|-- davecgh
| `-- go-spew
|-- klauspost
| |-- compress
| |-- cpuid
| `-- pgzip
|-- mattn
| `-- go-isatty
|-- mendersoftware
| |-- mender
| |-- mender-artifact
| |-- openssl
| `-- progressbar
|-- minio
| `-- sha256-simd
|-- pkg
| `-- errors
|-- pmezard
| `-- go-difflib
|-- remyoudompheng
| `-- go-liblzma
|-- sirupsen
| `-- logrus
|-- stretchr
| |-- objx
| `-- testify
|-- ungerik
| `-- go-sysfs
`-- urfave
    `-- cli
```

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [May 31, 2021, 8:14am UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/9 "2021-05-31T08:14:01Z")

</div>

Hi @hancerli

Yes, golang it a bit picky when it comes to paths. I seems like you have cloned it in a directory named “mender-1.5”? That won’t work… You need to clone mender in your `GOPATH`, following the project directory hierarchy and then checkout the version you want.

```auto
git clone https://github.com/mendersoftware/mender.git /root/go/src/github.com/mendersoftware/mender
cd /root/go/src/github.com/mendersoftware/mender
git checkout 1.7.0
make

```

Let me know if this does not solve the issue.

If using latest golang, I encourage you to try newer Mender versions though.

---

<div class="post-metadata">

**Author:** ![hancerli](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/hancerli/32/1185_2.png) [@hancerli](https://hub.mender.io/u/hancerli)\
**Post date:** [May 31, 2021, 3:21pm UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/10 "2021-05-31T15:21:48Z")

</div>

Hi @lluiscampos,

Thanks for the suggestions, they pushed me a bit more. After trying and fixing a couple of issues between the mender version and golang version here is the point that I got stuck.

```
go build -ldflags "-X github.com/mendersoftware/mender/conf.Version=2.4.2"  
# github.com/mendersoftware/mender/vendor/github.com/mendersoftware/openssl
vendor/github.com/mendersoftware/openssl/conn.go:100:61: could not determine kind of name for C.X509_V_ERR_CA_KEY_TOO_SMALL
vendor/github.com/mendersoftware/openssl/conn.go:101:61: could not determine kind of name for C.X509_V_ERR_CA_MD_TOO_WEAK
vendor/github.com/mendersoftware/openssl/conn.go:103:61: could not determine kind of name for C.X509_V_ERR_DANE_NO_MATCH
vendor/github.com/mendersoftware/openssl/conn.go:105:61: could not determine kind of name for C.X509_V_ERR_EE_KEY_TOO_SMALL
vendor/github.com/mendersoftware/openssl/conn.go:106:61: could not determine kind of name for C.X509_V_ERR_EMAIL_MISMATCH
vendor/github.com/mendersoftware/openssl/conn.go:108:61: could not determine kind of name for C.X509_V_ERR_HOSTNAME_MISMATCH
vendor/github.com/mendersoftware/openssl/conn.go:109:61: could not determine kind of name for C.X509_V_ERR_INVALID_CALL
vendor/github.com/mendersoftware/openssl/conn.go:110:61: could not determine kind of name for C.X509_V_ERR_IP_ADDRESS_MISMATCH
vendor/github.com/mendersoftware/openssl/conn.go:111:61: could not determine kind of name for C.X509_V_ERR_NO_VALID_SCTS
vendor/github.com/mendersoftware/openssl/conn.go:116:49: could not determine kind of name for C.X509_V_ERR_PATH_LOOP
vendor/github.com/mendersoftware/openssl/conn.go:118:49: could not determine kind of name for C.X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION
vendor/github.com/mendersoftware/openssl/conn.go:119:49: could not determine kind of name for C.X509_V_ERR_STORE_LOOKUP
vendor/github.com/mendersoftware/openssl/conn.go:121:49: could not determine kind of name for C.X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256
vendor/github.com/mendersoftware/openssl/conn.go:122:49: could not determine kind of name for C.X509_V_ERR_SUITE_B_INVALID_ALGORITHM
vendor/github.com/mendersoftware/openssl/conn.go:123:49: could not determine kind of name for C.X509_V_ERR_SUITE_B_INVALID_CURVE
vendor/github.com/mendersoftware/openssl/conn.go:124:49: could not determine kind of name for C.X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM
vendor/github.com/mendersoftware/openssl/conn.go:125:49: could not determine kind of name for C.X509_V_ERR_SUITE_B_INVALID_VERSION
vendor/github.com/mendersoftware/openssl/conn.go:126:49: could not determine kind of name for C.X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED
Makefile:76: recipe for target 'mender' failed
make: *** [mender] Error 2

```

Using golang v1.12 (also tried with 1.10) and mender 2.4.2 (also tried with 2.5.x and 2.6.x).

Any idea on how I can proceed?

Edit:  
Tried mender v1.7 and compiled it successfully. I’ll give it a shot first, then try to build v2.x.x if there are any missing functionalities.

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [June 1, 2021, 8:59am UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/11 "2021-06-01T08:59:13Z")

</div>

Hi @hancerli,

The error you posted is an incompatibility with OpenSSL version,

I can see that OpenSSL version in Debian Jessie is `1.0.1t`. Modern mender clients require OpenSSL `1.1.1` (I think `1.1.1k`, but unsure about the exact version).

Mender client added OpenSSL dependency in 2.4.0 (see changelog [here](https://docs.mender.io/release-information/release-notes-changelog/mender-client#mender-2-4-0-1)), so your best shot now is with Mender client 2.3.3.

Quite an adventure 🙂

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [June 1, 2021, 9:00am UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/12 "2021-06-01T09:00:42Z")

</div>

> [@hancerli](#):
>
> Edit:  
> Tried mender v1.7 and compiled it successfully. I’ll give it a shot first, then try to build v2.x.x if there are any missing functionalities.

1.7 is pretty old. If you can make it compile, 2.3 is much more feature rich. Mender client 2.3 is EOL as for this month, but 1.7 has been EOL for couple of years now…

---

<div class="post-metadata">

**Author:** ![hancerli](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/hancerli/32/1185_2.png) [@hancerli](https://hub.mender.io/u/hancerli)\
**Post date:** [June 1, 2021, 9:59am UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/13 "2021-06-01T09:59:13Z")

</div>

> [@lluiscampos](#):
>
> Quite an adventure 🙂

Way more than an adventure :)) 2.3 compiled and worked pretty well, so going with that one.

Thanks for the help all the way down, you did our day, cheers 🍻

here’s a pretty bear and sweet bee for you 🐻 🐝

---

<div class="post-metadata">

**Author:** ![lluiscampos](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lluiscampos/32/112_2.png) [@lluiscampos](https://hub.mender.io/u/lluiscampos)\
**Post date:** [June 1, 2021, 12:41pm UTC](https://hub.mender.io/t/cross-compiling-for-debian-8-jessie/3673/14 "2021-06-01T12:41:32Z")

</div>

Thanks for the emojis, glad you made it work!
