Go error occurred by attempting to build mender master branch via cross compiling

hello everyone,
I got a very strange error by attempting to build mender master branch via cross compiling with following command: make CGO_CFLAGS="-I${LIBLZMA_INSTALL_PATH}/include" CGO_LDFLAGS="-L${LIBLZMA_INSTALL_PATH}/lib" CGO_ENABLED=1 GOOS=linux GOARCH=arm.

error:
go build -ldflags “-X github.com/mendersoftware/mender/conf.Version=412268f

runtime

/usr/lib/go-1.10/src/runtime/extern.go:230:9: undefined: sys.TheVersion
/usr/lib/go-1.10/src/runtime/heapdump.go:494:10: undefined: sys.Goexperiment
/usr/lib/go-1.10/src/runtime/proc.go:13:20: undefined: sys.TheVersion
/usr/lib/go-1.10/src/runtime/proc.go:1184:18: undefined: sys.StackGuardMultiplier
/usr/lib/go-1.10/src/runtime/proc.go:1523:23: undefined: sys.StackGuardMultiplier
/usr/lib/go-1.10/src/runtime/proc.go:4870:7: undefined: sys.Goexperiment
/usr/lib/go-1.10/src/runtime/stack.go:93:2: const initializer 880 * sys.StackGuardMultiplier + _StackSystem is not a constant
/usr/lib/go-1.10/src/runtime/stack.go:93:20: undefined: sys.StackGuardMultiplier
Makefile:75: recipe for target ‘mender’ failed
make: *** [mender] Error 2

has anyone got the similar errors and do you guys have any idea about what went wrong and how to solve this? thank you! i really appreciate any productive responses.

Go 1.10 is more than two years old. Can you try a more recent version,
like 1.13 or the latest 1.14?

that seems to solve that problem! at least the same error didn’t come up again! thank you!

Hi! @kacf

it seems that lzma didn’t know about standard type lib.

go build -ldflags “-X github.com/mendersoftware/mender/conf.Version=412268f

github.com/mendersoftware/mender/vendor/github.com/remyoudompheng/go-liblzma

In file included from vendor/github.com/remyoudompheng/go-liblzma/reader.go:9:0:
/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/include/lzma.h:124:13: fatal error: inttypes.h: No such file or directory

include <inttypes.h>

         ^~~~~~~~~~~~

compilation terminated.

net

/usr/local/go/src/net/cgo_linux.go:10:10: fatal error: netdb.h: No such file or directory
#include <netdb.h>
^~~~~~~~~
compilation terminated.

os/user

/usr/local/go/src/os/user/cgo_lookup_unix.go:20:10: fatal error: unistd.h: No such file or directory
#include <unistd.h>
^~~~~~~~~~
compilation terminated.

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

vendor/github.com/bmatsuo/lmdb-go/lmdb/cursor.go:4:10: fatal error: stdlib.h: No such file or directory
#include <stdlib.h>
^~~~~~~~~~
compilation terminated.
Makefile:75: recipe for target ‘mender’ failed
make: *** [mender] Error 2

did those errors are also common errors? how do i load or link the standard libs to lzma?

The liblzma dependency is explained here:

hi! @kacf
thank you for your hint! but i have already done the section work from liblzma dependency which was explained in mender software github website or in readme! it didn’t help! it appears the same error! and i have tried also with TAGS=nolzma. it also didn’t help. same error! it must be pending on some environmental parameter or something like that. did you have any other advise? this may sit deeper.

While still using TAGS=nolzma, can you try to modify the Makefile and set CGO_ENABLED=0?

i have tried that. if i use TAGS=nolzma with CGA_ENABLED=1. there will be no difference without TAGS=nolzma. it appears the same error.
but using CGA_ENABLED=0 while TAGS=nolzma. it appears following error:
go build -ldflags “-X github.com/mendersoftware/mender/conf.Version=412268f” -tags ‘nolzma’
store/dbstore.go:23:2: build constraints exclude all Go files in /home/rui/go/src/github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
Makefile:75: recipe for target ‘mender’ failed
make: *** [mender] Error 1

i understand it, it still want to include all the lzma package.

What is your CC variable set to?

I did the following on a clean Ubuntu machine and was not able re-produce your issues,

sudo apt-get install gcc-arm-linux-gnueabihf
export CC=arm-linux-gnueabihf-gcc

wget -q https://tukaani.org/xz/xz-5.2.4.tar.gz
tar -xzf xz-5.2.4.tar.gz
cd xz-5.2.4/
./configure --host=arm --prefix=$(pwd)/install
make
make install

export LIBLZMA_INSTALL_PATH=$(pwd)/install

wget https://dl.google.com/go/go1.13.10.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.13.10.linux-amd64.tar.gz


export PATH=$PATH:/usr/local/go/bin

# It is expected for this to fail build, but just using it for fetching the source
go get github.com/mendersoftware/mender
cd go/src/github.com/mendersoftware/mender/
make CGO_CFLAGS="-I${LIBLZMA_INSTALL_PATH}/include" CGO_LDFLAGS="-L${LIBLZMA_INSTALL_PATH}/lib" CGO_ENABLED=1 GOOS=linux GOARCH=arm

Above was all performed in the same bash session as defined environment variables do not persist unless put in e.g .bashrc

i run following CC variable setting:
export CC=“arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=$SDKTARGETSYSROOT”

actually i have run same procedure like yours.

This looks to me like a Yocto SDK toolchain? Is this correct?

Can you please share step by step details on what you are trying to do, and what the outcome is? It is hard to be helpful when we get errors pasted here without context.

yes! this is a yocto toolchain!

OK! I’ll post the context!

i first ran a env file.

# Check for LD_LIBRARY_PATH being set, which can break SDK and generally is a bad practice
# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80
# http://xahlee.info/UnixResource_dir/_/ldpath.html
# Only disable this check if you are absolutely know what you are doing!
if [ ! -z "$LD_LIBRARY_PATH" ]; then
    echo "Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'"
    echo "but please check why this was set in the first place and that it's safe to unset."
    echo "The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set."
    echo "For more references see:"
    echo "  http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80"
    echo "  http://xahlee.info/UnixResource_dir/_/ldpath.html"
    return 1
fi
export SDKTARGETSYSROOT=/usr/local/oecore-x86_64/sysroots/armv7at2hf-neon-angstrom-linux-gnueabi
export PATH=/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/bin:/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/sbin:/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/bin:/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/sbin:/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/bin/../x86_64-angstromsdk-linux/bin:/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/bin/arm-angstrom-linux-gnueabi:/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/bin/arm-angstrom-linux-musl:$PATH
export PKG_CONFIG_SYSROOT_DIR=$SDKTARGETSYSROOT
export PKG_CONFIG_PATH=$SDKTARGETSYSROOT/usr/lib/pkgconfig:$SDKTARGETSYSROOT/usr/share/pkgconfig
export CONFIG_SITE=/usr/local/oecore-x86_64/site-config-armv7at2hf-neon-angstrom-linux-gnueabi
export OECORE_NATIVE_SYSROOT="/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux"
export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT"
export OECORE_ACLOCAL_OPTS="-I /usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux/usr/share/aclocal"
unset command_not_found_handle
export CC="arm-angstrom-linux-gnueabi-gcc  -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=$SDKTARGETSYSROOT"
export CXX="arm-angstrom-linux-gnueabi-g++  -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=$SDKTARGETSYSROOT"
export CPP="arm-angstrom-linux-gnueabi-gcc -E  -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=$SDKTARGETSYSROOT"
export AS="arm-angstrom-linux-gnueabi-as "
export LD="arm-angstrom-linux-gnueabi-ld  --sysroot=$SDKTARGETSYSROOT"
export GDB=arm-angstrom-linux-gnueabi-gdb
export STRIP=arm-angstrom-linux-gnueabi-strip
export RANLIB=arm-angstrom-linux-gnueabi-ranlib
export OBJCOPY=arm-angstrom-linux-gnueabi-objcopy
export OBJDUMP=arm-angstrom-linux-gnueabi-objdump
export AR=arm-angstrom-linux-gnueabi-ar
export NM=arm-angstrom-linux-gnueabi-nm
export M4=m4
export TARGET_PREFIX=arm-angstrom-linux-gnueabi-
export CONFIGURE_FLAGS="--target=arm-angstrom-linux-gnueabi --host=arm-angstrom-linux-gnueabi --build=x86_64-linux --with-libtool-sysroot=$SDKTARGETSYSROOT"
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
export LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
export CPPFLAGS=""
export KCFLAGS="--sysroot=$SDKTARGETSYSROOT"
export OECORE_DISTRO_VERSION="v2017.12"
export OECORE_SDK_VERSION="nodistro.0"
export ARCH=arm
export CROSS_COMPILE=arm-angstrom-linux-gnueabi-

# Append environment subscripts
if [ -d "$OECORE_TARGET_SYSROOT/environment-setup.d" ]; then
    for envfile in $OECORE_TARGET_SYSROOT/environment-setup.d/*.sh; do
	    . $envfile
    done
fi
if [ -d "$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
    for envfile in $OECORE_NATIVE_SYSROOT/environment-setup.d/*.sh; do
	    . $envfile
    done
fi

then i goto xz-5.2.4 from my mender GO project path: ~/go/src/github.com/mendersoftware/mender
and ran

sudo ./configure  --host=arm-angstom-linux-gnueabi --target=arm-angstom-linux-gnueabi --build=x86_64-pc-linux-gnu --prefix=$(pwd)/install

and then it outputs:

XZ Utils 5.2.4

System type:
checking build system type... x86_64-pc-linux-gnu
checking host system type... arm-angstom-linux-gnueabi

Configure options:
checking if debugging code should be compiled... no
checking which encoders to build... lzma1 lzma2 delta x86 powerpc ia64 arm armthumb sparc
checking which decoders to build... lzma1 lzma2 delta x86 powerpc ia64 arm armthumb sparc
checking which match finders to build... hc3 hc4 bt2 bt3 bt4
checking which integrity checks to build... crc32 crc64 sha256
checking if external SHA-256 should be used... no
checking if assembler optimizations should be used... no
checking if small size is preferred over speed... no
checking if threading support is wanted... yes, posix
checking how much RAM to assume if the real amount is unknown... 128 MiB
checking if library symbol versioning should be used... yes
checking if sandboxing should be used... no

checking for a shell that conforms to POSIX... /bin/bash

Initializing Automake:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-angstom-linux-gnueabi-strip... no
checking for strip... strip
configure: WARNING: using cross tools not prefixed with host triplet
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether ln -s works... yes
checking for style of include used by make... GNU
checking for arm-angstom-linux-gnueabi-gcc... no
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... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for gcc option to accept ISO C99... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes

POSIX threading support:
checking if compiler needs -Werror to reject unknown flags... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for library containing clock_gettime... none required
checking for clock_gettime... yes
checking for pthread_condattr_setclock... yes
checking whether CLOCK_MONOTONIC is declared... yes

Initializing Libtool:
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... no
checking for arm-angstom-linux-gnueabi-dumpbin... no
checking for arm-angstom-linux-gnueabi-link... no
checking for dumpbin... no
checking for link... link -dump
checking the name lister (nm) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to arm-angstom-linux-gnueabi format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for arm-angstom-linux-gnueabi-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for arm-angstom-linux-gnueabi-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for arm-angstom-linux-gnueabi-ar... no
checking for ar... ar
checking for archiver @FILE support... @
checking for arm-angstom-linux-gnueabi-strip... strip
checking for arm-angstom-linux-gnueabi-ranlib... no
checking for ranlib... ranlib
checking command to parse nm output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for arm-angstom-linux-gnueabi-mt... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for arm-angstom-linux-gnueabi-windres... no
checking for windres... no

Initializing gettext:
checking whether NLS is requested... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for shared library run path origin... done
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking for GNU gettext in libc... yes
checking whether to use NLS... yes
checking where the gettext function comes from... libc

System headers and functions:
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking immintrin.h usability... yes
checking immintrin.h presence... yes
checking for immintrin.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for int32_t... yes
checking for uint32_t... yes
checking for int64_t... yes
checking for uint64_t... yes
checking for uintptr_t... yes
checking size of size_t... 8
checking for struct stat.st_atim.tv_nsec... yes
checking for struct stat.st_atimespec.tv_nsec... no
checking for struct stat.st_atimensec... no
checking for struct stat.st_uatime... no
checking for struct stat.st_atim.st__tim.tv_nsec... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking whether byte ordering is bigendian... no
checking getopt.h usability... yes
checking getopt.h presence... yes
checking for getopt.h... yes
checking for getopt_long... yes
checking whether optreset is declared... no
checking for futimens... yes
checking for posix_fadvise... yes
checking whether program_invocation_name is declared... yes
checking byteswap.h usability... yes
checking byteswap.h presence... yes
checking for byteswap.h... yes
checking if bswap_16 is available... yes
checking if bswap_32 is available... yes
checking if bswap_64 is available... yes
checking if unaligned memory access should be used... no
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking how to detect the amount of physical memory... sysconf
checking for sys/param.h... (cached) yes
checking how to detect the number of available CPU cores... sched_getaffinity
checking whether mbrtowc and mbstate_t are properly declared... yes
checking for wcwidth... yes
checking whether _mm_movemask_epi8 is declared... yes

GCC extensions:
checking whether the -Werror option is usable... yes
checking for simple visibility declarations... yes
checking if gcc accepts -Wall... yes
checking if gcc accepts -Wextra... yes
checking if gcc accepts -Wvla... yes
checking if gcc accepts -Wformat=2... yes
checking if gcc accepts -Winit-self... yes
checking if gcc accepts -Wmissing-include-dirs... yes
checking if gcc accepts -Wstrict-aliasing... yes
checking if gcc accepts -Wfloat-equal... yes
checking if gcc accepts -Wundef... yes
checking if gcc accepts -Wshadow... yes
checking if gcc accepts -Wpointer-arith... yes
checking if gcc accepts -Wbad-function-cast... yes
checking if gcc accepts -Wwrite-strings... yes
checking if gcc accepts -Wlogical-op... yes
checking if gcc accepts -Waggregate-return... yes
checking if gcc accepts -Wstrict-prototypes... yes
checking if gcc accepts -Wold-style-definition... yes
checking if gcc accepts -Wmissing-prototypes... yes
checking if gcc accepts -Wmissing-declarations... yes
checking if gcc accepts -Wmissing-noreturn... yes
checking if gcc accepts -Wredundant-decls... yes

checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Doxyfile
config.status: creating Makefile
config.status: creating po/Makefile.in
config.status: creating lib/Makefile
config.status: creating src/Makefile
config.status: creating src/liblzma/Makefile
config.status: creating src/liblzma/api/Makefile
config.status: creating src/xz/Makefile
config.status: creating src/xzdec/Makefile
config.status: creating src/lzmainfo/Makefile
config.status: creating src/scripts/Makefile
config.status: creating tests/Makefile
config.status: creating debug/Makefile
config.status: creating src/scripts/xzdiff
config.status: creating src/scripts/xzgrep
config.status: creating src/scripts/xzmore
config.status: creating src/scripts/xzless
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile

Edit: @mirzak: formatting

then i ran make

which outputs:


make  all-recursive
make[1]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4'
Making all in src
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src'
Making all in liblzma
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma'
Making all in api
make[4]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma/api'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma/api'
make[4]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma'
make[4]: Nothing to be done for 'all-am'.
make[4]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma'
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma'
Making all in xzdec
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xzdec'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xzdec'
Making all in xz
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xz'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xz'
Making all in lzmainfo
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/lzmainfo'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/lzmainfo'
Making all in scripts
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/scripts'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/scripts'
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src'
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src'
Making all in po
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/po'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/po'
Making all in tests
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/tests'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/tests'
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4'
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4'
make[1]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4'

then i ran sudo make install

which outputs:

Making install in src
make[1]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src'
Making install in liblzma
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma'
Making install in api
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma/api'
make[4]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma/api'
make[4]: Nothing to be done for 'install-exec-am'.
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/include'
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/include/lzma'
 /usr/bin/install -c -m 644  lzma/base.h lzma/bcj.h lzma/block.h lzma/check.h lzma/container.h lzma/delta.h lzma/filter.h lzma/hardware.h lzma/index.h lzma/index_hash.h lzma/lzma12.h lzma/stream_flags.h lzma/version.h lzma/vli.h '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/include/lzma'
 /usr/bin/install -c -m 644  lzma.h '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/include/.'
make[4]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma/api'
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma/api'
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma'
make[4]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma'
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib'
 /bin/bash ../../libtool   --mode=install /usr/bin/install -c   liblzma.la '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib'
libtool: install: /usr/bin/install -c .libs/liblzma.so.5.2.4 /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib/liblzma.so.5.2.4
libtool: install: (cd /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib && { ln -s -f liblzma.so.5.2.4 liblzma.so.5 || { rm -f liblzma.so.5 && ln -s liblzma.so.5.2.4 liblzma.so.5; }; })
libtool: install: (cd /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib && { ln -s -f liblzma.so.5.2.4 liblzma.so || { rm -f liblzma.so && ln -s liblzma.so.5.2.4 liblzma.so; }; })
libtool: install: /usr/bin/install -c .libs/liblzma.lai /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib/liblzma.la
libtool: install: /usr/bin/install -c .libs/liblzma.a /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib/liblzma.a
libtool: install: chmod 644 /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib/liblzma.a
libtool: install: ranlib /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib/liblzma.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib/pkgconfig'
 /usr/bin/install -c -m 644 liblzma.pc '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/lib/pkgconfig'
make[4]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma'
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma'
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/liblzma'
Making install in xzdec
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xzdec'
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xzdec'
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin'
  /bin/bash ../../libtool   --mode=install /usr/bin/install -c xzdec lzmadec '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin'
libtool: install: /usr/bin/install -c .libs/xzdec /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin/xzdec
libtool: install: /usr/bin/install -c .libs/lzmadec /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin/lzmadec
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/man/man1'
 /usr/bin/install -c -m 644 xzdec.1 '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/man/man1'
make  install-data-hook
make[4]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xzdec'
cd /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/man/man1 && \
target=`echo xzdec | sed 's,x,x,'` && \
link=`echo lzmadec | sed 's,x,x,'` && \
rm -f $link.1 && \
ln -s $target.1 $link.1
make[4]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xzdec'
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xzdec'
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xzdec'
Making install in xz
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xz'
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xz'
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin'
  /bin/bash ../../libtool   --mode=install /usr/bin/install -c xz '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin'
libtool: install: /usr/bin/install -c .libs/xz /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin/xz
make  install-exec-hook
make[4]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xz'
cd /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin && \
target=`echo xz | sed 's,x,x,'` && \
for name in unxz xzcat lzma unlzma lzcat; do \
	link=`echo $name | sed 's,x,x,'` && \
	rm -f $link && \
	ln -s $target $link; \
done
make[4]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xz'
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/man/man1'
 /usr/bin/install -c -m 644 xz.1 '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/man/man1'
make  install-data-hook
make[4]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xz'
cd /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/man/man1 && \
target=`echo xz | sed 's,x,x,'` && \
for name in unxz xzcat lzma unlzma lzcat; do \
	link=`echo $name | sed 's,x,x,'` && \
	rm -f $link.1 && \
	ln -s $target.1 $link.1; \
done
make[4]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xz'
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xz'
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/xz'
Making install in lzmainfo
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/lzmainfo'
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/lzmainfo'
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin'
  /bin/bash ../../libtool   --mode=install /usr/bin/install -c lzmainfo '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin'
libtool: install: /usr/bin/install -c .libs/lzmainfo /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin/lzmainfo
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/man/man1'
 /usr/bin/install -c -m 644 lzmainfo.1 '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/man/man1'
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/lzmainfo'
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/lzmainfo'
Making install in scripts
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/scripts'
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/scripts'
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin'
 /usr/bin/install -c xzdiff xzgrep xzmore xzless '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin'
make  install-exec-hook
make[4]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/scripts'
cd /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/bin && \
for pair in xzdiff-xzcmp xzgrep-xzegrep xzgrep-xzfgrep xzdiff-lzdiff xzdiff-lzcmp xzgrep-lzgrep xzgrep-lzegrep xzgrep-lzfgrep xzmore-lzmore xzless-lzless; do \
	target=`echo $pair | sed 's/-.*$//' | sed 's,x,x,'` && \
	link=`echo $pair | sed 's/^.*-//' | sed 's,x,x,'` && \
	rm -f $link && \
	ln -s $target $link; \
done
make[4]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/scripts'
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/man/man1'
 /usr/bin/install -c -m 644 xzdiff.1 xzgrep.1 xzmore.1 xzless.1 '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/man/man1'
make  install-data-hook
make[4]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/scripts'
cd /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/man/man1 && \
for pair in xzdiff-xzcmp xzgrep-xzegrep xzgrep-xzfgrep xzdiff-lzdiff xzdiff-lzcmp xzgrep-lzgrep xzgrep-lzegrep xzgrep-lzfgrep xzmore-lzmore xzless-lzless; do \
	target=`echo $pair | sed 's/-.*$//' | sed 's,x,x,'` && \
	link=`echo $pair | sed 's/^.*-//' | sed 's,x,x,'` && \
	rm -f $link.1 && \
	ln -s $target.1 $link.1; \
done
make[4]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/scripts'
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/scripts'
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src/scripts'
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src'
make[3]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src'
make[3]: Nothing to be done for 'install-exec-am'.
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src'
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src'
make[1]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/src'
Making install in po
make[1]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/po'
installing cs.gmo as /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/locale/cs/LC_MESSAGES/xz.mo
installing de.gmo as /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/locale/de/LC_MESSAGES/xz.mo
installing fr.gmo as /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/locale/fr/LC_MESSAGES/xz.mo
installing it.gmo as /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/locale/it/LC_MESSAGES/xz.mo
installing pl.gmo as /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/locale/pl/LC_MESSAGES/xz.mo
installing vi.gmo as /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/locale/vi/LC_MESSAGES/xz.mo
if test "xz" = "gettext-tools"; then \
  /bin/mkdir -p /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/gettext/po; \
  for file in Makefile.in.in remove-potcdate.sin quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot   Makevars.template; do \
    /usr/bin/install -c -m 644 ./$file \
		    /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/gettext/po/$file; \
  done; \
  for file in Makevars; do \
    rm -f /home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/gettext/po/$file; \
  done; \
else \
  : ; \
fi
make[1]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/po'
Making install in tests
make[1]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/tests'
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/tests'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/tests'
make[1]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/tests'
make[1]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4'
make[2]: Entering directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4'
make[2]: Nothing to be done for 'install-exec-am'.
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/doc/xz'
 /usr/bin/install -c -m 644 AUTHORS COPYING COPYING.GPLv2 NEWS README THANKS TODO doc/faq.txt doc/history.txt doc/xz-file-format.txt doc/lzma-file-format.txt '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/doc/xz'
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/doc/xz/examples'
 /usr/bin/install -c -m 644 doc/examples/00_README.txt doc/examples/01_compress_easy.c doc/examples/02_decompress.c doc/examples/03_compress_custom.c doc/examples/04_compress_easy_mt.c doc/examples/Makefile '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/doc/xz/examples'
 /bin/mkdir -p '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/doc/xz/examples_old'
 /usr/bin/install -c -m 644 doc/examples_old/xz_pipe_comp.c doc/examples_old/xz_pipe_decomp.c '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/share/doc/xz/examples_old'
make[2]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4'
make[1]: Leaving directory '/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4'

then i go back to mender main project path: ~/go/src/github.com/mendersoftware/mender

and ran

make CGO_CFLAGS="-I${LIBLZMA_INSTALL_PATH}/include" CGO_LDFLAGS="-L${LIBLZMA_INSTALL_PATH}/lib" CGO_ENABLED=1 GOOS=linux GOARCH=arm

which appears errors like i described:


go build -ldflags "-X github.com/mendersoftware/mender/conf.Version=412268f"  
# github.com/mendersoftware/mender/vendor/github.com/remyoudompheng/go-liblzma
vendor/github.com/remyoudompheng/go-liblzma/reader.go:9:10: fatal error: lzma.h: No such file or directory
 #include <lzma.h>
          ^~~~~~~~
compilation terminated.
# net
/usr/local/go/src/net/cgo_linux.go:10:10: fatal error: netdb.h: No such file or directory
 #include <netdb.h>
          ^~~~~~~~~
compilation terminated.
# os/user
/usr/local/go/src/os/user/cgo_lookup_unix.go:20:10: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
          ^~~~~~~~~~
compilation terminated.
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
vendor/github.com/bmatsuo/lmdb-go/lmdb/cursor.go:4:10: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
          ^~~~~~~~~~
compilation terminated.
Makefile:75: recipe for target 'mender' failed
make: *** [mender] Error 2

Edit: @mirzak: formatting

sorry! i made a txt file. but it seems it can not upload txt file.

Thanks for sharing the additional information. Now I was able to reproduce you problem.

What I think the problem here is that that the Yocto SDK is supposed to be a self-contained environment but you are mixing CC from the SDK with a native go binary and I think is what causing you errors with not being able to find paths for stdlib headers. I assume that the CGO_ENABLED is not able to pick these settings up from the environment variables defined in the SDK and maybe you need to pass additional variables with CGO_FLAGS.

E.g the following worked for me (targeting a qemux86-64):

$ make CGO_CFLAGS="--sysroot=/opt/poky/2.7.3/sysroots/core2-64-poky-linux" CGO_LDFLAGS="--sysroot=/opt/poky/2.7.3/sysroots/core2-64-poky-linux" CGO_ENABLED=1 GOOS=linux GOARCH=amd64

Note that I skip including the LZMA paths as this is already part of my SDK generated from Yocto.

Optimally you would want to have go already included in the Yocto SDK with the correct paths setup, but I do not think this works, at least on warrior as the result does not still contain valid paths. Maybe this has been resolved in newer Yocto versions

1 Like

so thank you for your hint!

i have tried the command like this:

make CGO_CFLAGS="--sysroot=/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux" CGO_LDFLAGS="--sysroot=/usr/local/oecore-x86_64/sysroots/x86_64-angstromsdk-linux" CGO_CFLAGS="-I${LIBLZMA_INSTALL_PATH}/include" CGO_LDFLAGS="-L${LIBLZMA_INSTALL_PATH}/lib" CGO_ENABLED=1 GOOS=linux GOARCH=arm

but it won’t help it still has almost the same error:

go build -ldflags "-X github.com/mendersoftware/mender/conf.Version=412268f"  
# github.com/mendersoftware/mender/vendor/github.com/remyoudompheng/go-liblzma
In file included from vendor/github.com/remyoudompheng/go-liblzma/reader.go:9:0:
/home/rui/go/src/github.com/mendersoftware/mender/xz-5.2.4/install/include/lzma.h:124:13: fatal error: inttypes.h: No such file or directory
 #   include <inttypes.h>
             ^~~~~~~~~~~~
compilation terminated.
# net
/usr/local/go/src/net/cgo_linux.go:10:10: fatal error: netdb.h: No such file or directory
 #include <netdb.h>
          ^~~~~~~~~
compilation terminated.
# os/user
/usr/local/go/src/os/user/cgo_lookup_unix.go:20:10: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
          ^~~~~~~~~~
compilation terminated.
# github.com/mendersoftware/mender/vendor/github.com/bmatsuo/lmdb-go/lmdb
vendor/github.com/bmatsuo/lmdb-go/lmdb/cursor.go:4:10: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
          ^~~~~~~~~~
compilation terminated.
Makefile:75: recipe for target 'mender' failed
make: *** [mender] Error 2

is it GOARCH=arm still correct?

What is your target?

arm-angstom-linux-gnueabi

Then GOARCH=arm is needed.

I also think that you have passed the wrong sysroot as argument, host instead of target. It should be something like this:

make CGO_CFLAGS="--sysroot=$SDKTARGETSYSROOT -I${LIBLZMA_INSTALL_PATH}/include" CGO_LDFLAGS="--sysroot=$SDKTARGETSYSROOT -L${LIBLZMA_INSTALL_PATH}/lib" CGO_ENABLED=1 GOOS=linux GOARCH=arm