Feature: Use LTS cross-compiler for Linux armv6/armv7 to use glibc 2.28 (#440)
* Feature: Use LTS cross-compiler for Linux armv6/armv7 to use glibc 2.28 * Use softfp for armv7 * Fix armv6 config * Update native libraries --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
4faf2a3768
commit
ad2e2d7378
|
@ -17,6 +17,7 @@ lib_managed/
|
|||
src_managed/
|
||||
project/boot/
|
||||
project/plugins/project/
|
||||
.bsp
|
||||
|
||||
# Scala-IDE specific
|
||||
.scala_dependencies
|
||||
|
|
4
Makefile
4
Makefile
|
@ -196,10 +196,10 @@ linux-arm: jni-header
|
|||
./docker/dockcross-armv5 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=/usr/xcc/armv5-unknown-linux-gnueabi/bin//armv5-unknown-linux-gnueabi- OS_NAME=Linux OS_ARCH=arm'
|
||||
|
||||
linux-armv6: jni-header
|
||||
./docker/dockcross-armv6 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=armv6-unknown-linux-gnueabihf- OS_NAME=Linux OS_ARCH=armv6'
|
||||
./docker/dockcross-armv6 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native OS_NAME=Linux OS_ARCH=armv6'
|
||||
|
||||
linux-armv7: jni-header
|
||||
./docker/dockcross-armv7 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=/usr/xcc/armv7-unknown-linux-gnueabi/bin/armv7-unknown-linux-gnueabi- OS_NAME=Linux OS_ARCH=armv7'
|
||||
./docker/dockcross-armv7 -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native OS_NAME=Linux OS_ARCH=armv7'
|
||||
|
||||
linux-android-arm: jni-header
|
||||
./docker/dockcross-android-arm -a $(DOCKER_RUN_OPTS) bash -c 'make clean-native native CROSS_PREFIX=/usr/arm-linux-androideabi/bin/arm-linux-androideabi- OS_NAME=Linux OS_ARCH=android-arm'
|
||||
|
|
|
@ -213,16 +213,16 @@ Linux-arm_LINKFLAGS := -shared -static-libgcc
|
|||
Linux-arm_LIBNAME := libsnappyjava.so
|
||||
Linux-arm_SNAPPY_FLAGS:=
|
||||
|
||||
Linux-armv6_CXX := $(CROSS_PREFIX)g++
|
||||
Linux-armv6_STRIP := $(CROSS_PREFIX)strip
|
||||
Linux-armv6_CXX := ${CROSS_ROOT}/bin/${CROSS_TRIPLE}-g++
|
||||
Linux-armv6_STRIP := ${CROSS_ROOT}/bin/${CROSS_TRIPLE}-strip
|
||||
Linux-armv6_CXXFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=hard -std=c++11
|
||||
Linux-armv6_LINKFLAGS := -shared -static-libgcc -std=c++11
|
||||
Linux-armv6_LIBNAME := libsnappyjava.so
|
||||
Linux-armv6_SNAPPY_FLAGS:=
|
||||
|
||||
Linux-armv7_CXX := $(CROSS_PREFIX)g++
|
||||
Linux-armv7_STRIP := $(CROSS_PREFIX)strip
|
||||
Linux-armv7_CXXFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=hard -std=c++11
|
||||
Linux-armv7_CXX := ${CROSS_ROOT}/bin/${CROSS_TRIPLE}-g++
|
||||
Linux-armv7_STRIP := ${CROSS_ROOT}/bin/${CROSS_TRIPLE}-strip
|
||||
Linux-armv7_CXXFLAGS := -Ilib/inc_linux -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -mfloat-abi=softfp -std=c++11
|
||||
Linux-armv7_LINKFLAGS := -shared -static-libgcc
|
||||
Linux-armv7_LIBNAME := libsnappyjava.so
|
||||
Linux-armv7_SNAPPY_FLAGS:=
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
DEFAULT_DOCKCROSS_IMAGE=dockcross/linux-armv6
|
||||
DEFAULT_DOCKCROSS_IMAGE=dockcross/linux-armv6-lts
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Helpers
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DEFAULT_DOCKCROSS_IMAGE=dockcross/linux-armv7
|
||||
DEFAULT_DOCKCROSS_IMAGE=dockcross/linux-armv7-lts:20230421-a0eaff4
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Helpers
|
||||
#
|
||||
err() {
|
||||
echo -e >&2 ERROR: $@\\n
|
||||
echo -e >&2 "ERROR: $*\n"
|
||||
}
|
||||
|
||||
die() {
|
||||
err $@
|
||||
err "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -22,28 +22,39 @@ has() {
|
|||
type -t $kind:$name | grep -q function
|
||||
}
|
||||
|
||||
# If OCI_EXE is not already set, search for a container executor (OCI stands for "Open Container Initiative")
|
||||
if [ -z "$OCI_EXE" ]; then
|
||||
if which podman >/dev/null 2>/dev/null; then
|
||||
OCI_EXE=podman
|
||||
elif which docker >/dev/null 2>/dev/null; then
|
||||
OCI_EXE=docker
|
||||
else
|
||||
die "Cannot find a container executor. Search for docker and podman."
|
||||
fi
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Command handlers
|
||||
#
|
||||
command:update-image() {
|
||||
docker pull $FINAL_IMAGE
|
||||
$OCI_EXE pull $FINAL_IMAGE
|
||||
}
|
||||
|
||||
help:update-image() {
|
||||
echo Pull the latest $FINAL_IMAGE .
|
||||
echo "Pull the latest $FINAL_IMAGE ."
|
||||
}
|
||||
|
||||
command:update-script() {
|
||||
if cmp -s <( docker run $FINAL_IMAGE ) $0; then
|
||||
echo $0 is up to date
|
||||
if cmp -s <( $OCI_EXE run --rm $FINAL_IMAGE ) $0; then
|
||||
echo "$0 is up to date"
|
||||
else
|
||||
echo -n Updating $0 '... '
|
||||
docker run $FINAL_IMAGE > $0 && echo ok
|
||||
echo -n "Updating $0 ... "
|
||||
$OCI_EXE run --rm $FINAL_IMAGE > $0 && echo ok
|
||||
fi
|
||||
}
|
||||
|
||||
help:update-image() {
|
||||
echo Update $0 from $FINAL_IMAGE .
|
||||
help:update-script() {
|
||||
echo "Update $0 from $FINAL_IMAGE ."
|
||||
}
|
||||
|
||||
command:update() {
|
||||
|
@ -52,7 +63,7 @@ command:update() {
|
|||
}
|
||||
|
||||
help:update() {
|
||||
echo Pull the latest $FINAL_IMAGE, and then update $0 from that.
|
||||
echo "Pull the latest $FINAL_IMAGE, and then update $0 from that."
|
||||
}
|
||||
|
||||
command:help() {
|
||||
|
@ -98,6 +109,7 @@ while [[ $# != 0 ]]; do
|
|||
case $1 in
|
||||
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
|
||||
|
@ -171,29 +183,95 @@ fi
|
|||
# Set the docker run extra args (if any)
|
||||
FINAL_ARGS=${ARG_ARGS-${DOCKCROSS_ARGS}}
|
||||
|
||||
# If we are not running via boot2docker
|
||||
if [ -z $DOCKER_HOST ]; then
|
||||
USER_IDS="-e BUILDER_UID=$( id -u ) -e BUILDER_GID=$( id -g ) -e BUILDER_USER=$( id -un ) -e BUILDER_GROUP=$( id -gn )"
|
||||
# Bash on Ubuntu on Windows
|
||||
UBUNTU_ON_WINDOWS=$([ -e /proc/version ] && grep -l Microsoft /proc/version || echo "")
|
||||
# MSYS, Git Bash, etc.
|
||||
MSYS=$([ -e /proc/version ] && grep -l MINGW /proc/version || echo "")
|
||||
# CYGWIN
|
||||
CYGWIN=$([ -e /proc/version ] && grep -l CYGWIN /proc/version || echo "")
|
||||
|
||||
if [ -z "$UBUNTU_ON_WINDOWS" -a -z "$MSYS" -a "$OCI_EXE" != "podman" ]; then
|
||||
USER_IDS=(-e BUILDER_UID="$( id -u )" -e BUILDER_GID="$( id -g )" -e BUILDER_USER="$( id -un )" -e BUILDER_GROUP="$( id -gn )")
|
||||
fi
|
||||
|
||||
# Change the PWD when working in Docker on Windows
|
||||
if [ -n "$UBUNTU_ON_WINDOWS" ]; then
|
||||
WSL_ROOT="/mnt/"
|
||||
CFG_FILE=/etc/wsl.conf
|
||||
if [ -f "$CFG_FILE" ]; then
|
||||
CFG_CONTENT=$(cat $CFG_FILE | sed -r '/[^=]+=[^=]+/!d' | sed -r 's/\s+=\s/=/g')
|
||||
eval "$CFG_CONTENT"
|
||||
if [ -n "$root" ]; then
|
||||
WSL_ROOT=$root
|
||||
fi
|
||||
fi
|
||||
HOST_PWD=`pwd -P`
|
||||
HOST_PWD=${HOST_PWD/$WSL_ROOT//}
|
||||
elif [ -n "$MSYS" ]; then
|
||||
HOST_PWD=$PWD
|
||||
HOST_PWD=${HOST_PWD/\//}
|
||||
HOST_PWD=${HOST_PWD/\//:\/}
|
||||
elif [ -n "$CYGWIN" ]; then
|
||||
for f in pwd readlink cygpath ; do
|
||||
test -n "$(type "${f}" )" || { echo >&2 "Missing functionality (${f}) (in cygwin)." ; exit 1 ; } ;
|
||||
done ;
|
||||
HOST_PWD="$( cygpath -w "$( readlink -f "$( pwd ;)" ; )" ; )" ;
|
||||
else
|
||||
HOST_PWD=$PWD
|
||||
[ -L $HOST_PWD ] && HOST_PWD=$(readlink $HOST_PWD)
|
||||
fi
|
||||
|
||||
# Mount Additional Volumes
|
||||
if [ -z "$SSH_DIR" ]; then
|
||||
SSH_DIR="$HOME/.ssh"
|
||||
fi
|
||||
|
||||
HOST_VOLUMES=
|
||||
if [ -e "$SSH_DIR" -a -z "$MSYS" ]; then
|
||||
if test -n "${CYGWIN}" ; then
|
||||
HOST_VOLUMES+="-v $(cygpath -w ${SSH_DIR} ; ):/home/$(id -un)/.ssh" ;
|
||||
else
|
||||
HOST_VOLUMES+="-v $SSH_DIR:/home/$(id -un)/.ssh" ;
|
||||
fi ;
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Now, finally, run the command in a container
|
||||
#
|
||||
docker run --rm \
|
||||
-v $PWD:/work \
|
||||
$USER_IDS \
|
||||
TTY_ARGS=
|
||||
tty -s && [ -z "$MSYS" ] && TTY_ARGS=-ti
|
||||
CONTAINER_NAME=dockcross_$RANDOM
|
||||
$OCI_EXE run $TTY_ARGS --name $CONTAINER_NAME \
|
||||
-v "$HOST_PWD":/work \
|
||||
$HOST_VOLUMES \
|
||||
"${USER_IDS[@]}" \
|
||||
$FINAL_ARGS \
|
||||
$FINAL_IMAGE "$@"
|
||||
run_exit_code=$?
|
||||
|
||||
# Attempt to delete container
|
||||
rm_output=$($OCI_EXE rm -f $CONTAINER_NAME 2>&1)
|
||||
rm_exit_code=$?
|
||||
if [[ $rm_exit_code != 0 ]]; then
|
||||
if [[ "$CIRCLECI" == "true" ]] && [[ $rm_output == *"Driver btrfs failed to remove"* ]]; then
|
||||
: # Ignore error because of https://circleci.com/docs/docker-btrfs-error/
|
||||
else
|
||||
echo "$rm_output"
|
||||
exit $rm_exit_code
|
||||
fi
|
||||
fi
|
||||
|
||||
exit $run_exit_code
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# This image is not intended to be run manually.
|
||||
#
|
||||
# To create a dockcross helper script for the
|
||||
# dockcross/linux-armv7 image, run:
|
||||
# dockcross/linux-armv7-lts:20230421-a0eaff4 image, run:
|
||||
#
|
||||
# docker run --rm dockcross/linux-armv7 > dockcross-linux-armv7
|
||||
# chmod +x dockcross-linux-armv7
|
||||
# docker run --rm dockcross/linux-armv7-lts:20230421-a0eaff4 > dockcross-linux-armv7-lts-20230421-a0eaff4
|
||||
# chmod +x dockcross-linux-armv7-lts-20230421-a0eaff4
|
||||
#
|
||||
# You may then wish to move the dockcross script to your PATH.
|
||||
#
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue