Skip to content

ARM builds #699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
49ae380
Make build of digest and validate tools depend on availability of libssl
TheAssassin Nov 30, 2018
b032818
Add cross-compiling CMake toolchain file
TheAssassin Nov 30, 2018
281cffb
Cross-build ARM (hard-float) binaries on Travis
TheAssassin Nov 30, 2018
309b658
Fix Travis build script
TheAssassin Nov 30, 2018
5ce00ae
Fix Travis config file, mk. 1
TheAssassin Nov 30, 2018
f1d2709
Fix check in CMake
TheAssassin Nov 30, 2018
9db1117
Fix Travis config file, mk. 2
TheAssassin Nov 30, 2018
397a579
Use CMake toolchain file for ARM builds
TheAssassin Nov 30, 2018
2c98913
Make CMake find arch specific tools, mk. 1
TheAssassin Nov 30, 2018
47f8043
Update libappimage
TheAssassin Dec 1, 2018
f391f65
Update libappimage
TheAssassin Dec 1, 2018
dadaf8c
Make libssl optional in CMake
TheAssassin Dec 1, 2018
c5acd4e
Update libappimage
TheAssassin Dec 1, 2018
2343501
Update libappimage
TheAssassin Dec 1, 2018
6d57b67
Don't create new releases if not on main branch
TheAssassin Dec 1, 2018
1693cb6
Fix copying of libffi
TheAssassin Dec 1, 2018
e409754
Make sure the prebuilt libraries in the container will be found
TheAssassin Dec 1, 2018
933a189
Fix embedding of sections in runtime
TheAssassin Dec 1, 2018
e661277
Fix embedding of .digest_md5 section
TheAssassin Dec 1, 2018
fa8f874
Also build 64-bit ARM binaries on Travis
TheAssassin Dec 2, 2018
2c9c45d
Use proper toolchain for 64-bit ARM builds
TheAssassin Dec 2, 2018
5fd394b
No need to build mksquashfs with debug information
TheAssassin Dec 2, 2018
15e6583
Actually add aarch64 toolchain
TheAssassin Dec 3, 2018
3f93639
Fix permissions
TheAssassin Dec 3, 2018
c777bd4
Bundle libffi on aarch64, too
TheAssassin Dec 4, 2018
42afa73
Cannot test cross-compiled ARM AppImages outside suitable environment
TheAssassin Dec 4, 2018
b53f21f
Make script crash on error
TheAssassin Dec 4, 2018
f5426ce
Deploy the right zsyncmake and desktop-file-validate
TheAssassin Dec 4, 2018
3de952d
Fix embedding of magic bytes
TheAssassin Dec 5, 2018
d48de6d
Make sure magic bytes were embedded correctly
TheAssassin Dec 5, 2018
8fa356a
Fix embedding of magic bytes, mk. 2
TheAssassin Dec 5, 2018
0691b2c
Fix embedding of magic bytes, mk. 3
TheAssassin Dec 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
language: c
compiler: gcc
sudo: required

services:
- docker

env:
- ARCH=x86_64 DOCKER_IMAGE=quay.io/appimage/appimagebuild
- ARCH=i686 DOCKER_IMAGE=quay.io/appimage/appimagebuild-i386
matrix:
include:
- env: ARCH=x86_64 DOCKER_IMAGE=quay.io/appimage/appimagebuild
- env: ARCH=i686 DOCKER_IMAGE=quay.io/appimage/appimagebuild-i386
- env: ARCH=armhf DOCKER_IMAGE=quay.io/appimage/appimagebuild-armhf-cross
addons:
apt:
update: true
packages:
# install binfmt support system-wide (for use in Docker containers)
- binfmt-support
# sets up the required binfmt interpreters so that qemu will actually be used (for use in Docker containers)
- qemu-user-static
- env: ARCH=aarch64 DOCKER_IMAGE=quay.io/appimage/appimagebuild-aarch64-cross
addons:
apt:
update: true
packages:
# install binfmt support system-wide (for use in Docker containers)
- binfmt-support
# sets up the required binfmt interpreters so that qemu will actually be used (for use in Docker containers)
- qemu-user-static

script:
- bash travis/travis-build.sh
Expand All @@ -16,6 +35,8 @@ after_success:
- ls -lh out/* # <= wrong line: see https://travis-ci.org/AppImage/AppImageKit/jobs/347965050#L4211
- ls -lh build/out/*
- wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
# make sure only pushes to rewrite create a new release, otherwise pretend PR and upload to transfer.sh
- if [ "$TRAVIS_BRANCH" != "$TRAVIS_TAG" ] && [ "$TRAVIS_BRANCH" != "appimagetool/master" ]; then export TRAVIS_EVENT_TYPE=pull_request; fi
- bash ./upload.sh build/out/*

notifications:
Expand All @@ -24,7 +45,7 @@ notifications:
- "chat.freenode.net#AppImage"
on_success: always # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: always # options: [always|never|change] default: always
on_start: always # options: [always|never|change] default: always
template:
- "%{repository} build %{build_number}: %{result} %{build_url}"
use_notice: true
Expand Down
8 changes: 7 additions & 1 deletion build-appdir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ mkdir -p "$APPIMAGETOOL_APPDIR"/usr/lib/appimagekit/
# Copy AppDir specific files
cp ../resources/AppRun "$APPIMAGETOOL_APPDIR"
cp install_prefix/usr/lib/appimagekit/mksquashfs "$APPIMAGETOOL_APPDIR"/usr/lib/appimagekit/
# prefer binaries from /deps, if available
export PATH=/deps/bin:"$PATH"
cp $(which desktop-file-validate) "$APPIMAGETOOL_APPDIR"/usr/bin/
cp $(which zsyncmake) "$APPIMAGETOOL_APPDIR"/usr/bin/

Expand All @@ -36,7 +38,11 @@ if [ -d /deps/ ]; then
# https://mail.gnome.org/archives/gtk-devel-list/2012-July/msg00062.html
if [ "$ARCH" == "x86_64" ]; then
cp /usr/lib64/libffi.so.5 "$APPIMAGETOOL_APPDIR"/usr/lib/
else
elif [ "$ARCH" == "i686" ]; then
cp /usr/lib/libffi.so.5 "$APPIMAGETOOL_APPDIR"/usr/lib/
elif [ "$ARCH" == "armhf" ] || [ "$ARCH" == "aarch64" ]; then
cp /deps/lib/libffi.so.6 "$APPIMAGETOOL_APPDIR"/usr/lib/
else
echo "WARNING: unknown architecture, not bundling libffi"
fi
fi
11 changes: 10 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,16 @@ cd build
# make sure that deps in separate install tree are found
export PKG_CONFIG_PATH=/deps/lib/pkgconfig/

cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON -DAPPIMAGEKIT_PACKAGE_DEBS=ON
# make CMake use the right tools for ARM cross-compiling using toolchain file
if [ "$ARCH" == "armhf" ]; then
export PATH=/deps/bin:"$PATH"
export EXTRA_CMAKE_FLAGS="-DCMAKE_TOOLCHAIN_FILE=$HERE/cmake/toolchains/arm-linux-gnueabihf.cmake"
elif [ "$ARCH" == "aarch64" ]; then
export PATH=/deps/bin:"$PATH"
export EXTRA_CMAKE_FLAGS="-DCMAKE_TOOLCHAIN_FILE=$HERE/cmake/toolchains/aarch64-linux-gnu.cmake"
fi

cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON -DAPPIMAGEKIT_PACKAGE_DEBS=ON "${EXTRA_CMAKE_FLAGS[@]}"
make -j$JOBS
make install DESTDIR=install_prefix/

Expand Down
4 changes: 3 additions & 1 deletion cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ include(${PROJECT_SOURCE_DIR}/lib/libappimage/cmake/scripts.cmake)
# the names of the targets need to differ from the library filenames
# this is especially an issue with libcairo, where the library is called libcairo
# therefore, all libs imported this way have been prefixed with lib
import_pkgconfig_target(TARGET_NAME libssl PKGCONFIG_TARGET openssl)
import_pkgconfig_target(TARGET_NAME libfuse PKGCONFIG_TARGET fuse)
# openssl is required for optional tools only, and doesn't need to be enforced
# FIXME: remove dependency to openssl by implementing own SHA hashes in libappimage_hashlib
import_pkgconfig_target(TARGET_NAME libssl PKGCONFIG_TARGET openssl OPTIONAL)


if(USE_CCACHE)
Expand Down
20 changes: 20 additions & 0 deletions cmake/toolchains/aarch64-linux-gnu.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# toolchain file that can be used for cross-compiling AppImageKit using the respective AppImageBuild container

set(CMAKE_SYSTEM_NAME Linux CACHE STRING "" FORCE)
set(CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "" FORCE)

set(triple aarch64-linux-gnu CACHE STRING "" FORCE)

set(CMAKE_C_COMPILER "${triple}-gcc" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER "${triple}-g++" CACHE STRING "" FORCE)

set(TOOLS_PREFIX "${triple}-" CACHE STRING "" FORCE)

set(DEPENDENCIES_CFLAGS "-I/deps/include" CACHE STRING "" FORCE)
set(DEPENDENCIES_CPPFLAGS "${DEPENDENCIES_CFLAGS}" CACHE STRING "" FORCE)
set(DEPENDENCIES_LDFLAGS "-L/deps/lib/" CACHE STRING "" FORCE)

# host = target system
# build = build system
# both must be specified
set(EXTRA_CONFIGURE_FLAGS "--host=${triple}" "--build=x86_64-pc-linux-gnu" "--target=${triple}" CACHE STRING "" FORCE)
20 changes: 20 additions & 0 deletions cmake/toolchains/arm-linux-gnueabihf.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# toolchain file that can be used for cross-compiling AppImageKit using the respective AppImageBuild container

set(CMAKE_SYSTEM_NAME Linux CACHE STRING "" FORCE)
set(CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "" FORCE)

set(triple arm-linux-gnueabihf CACHE STRING "" FORCE)

set(CMAKE_C_COMPILER "${triple}-gcc" CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER "${triple}-g++" CACHE STRING "" FORCE)

set(TOOLS_PREFIX "${triple}-" CACHE STRING "" FORCE)

set(DEPENDENCIES_CFLAGS "-I/deps/include" CACHE STRING "" FORCE)
set(DEPENDENCIES_CPPFLAGS "${DEPENDENCIES_CFLAGS}" CACHE STRING "" FORCE)
set(DEPENDENCIES_LDFLAGS "-L/deps/lib/" CACHE STRING "" FORCE)

# host = target system
# build = build system
# both must be specified
set(EXTRA_CONFIGURE_FLAGS "--host=${triple}" "--build=x86_64-pc-linux-gnu" "--target=${triple}" CACHE STRING "" FORCE)
2 changes: 1 addition & 1 deletion lib/libappimage
45 changes: 28 additions & 17 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,28 +73,32 @@ target_compile_definitions(AppRun
add_sanitizers(AppRun)


add_executable(validate validate.c)
if (NOT TARGET libssl)
message(WARNING "Could not find suitable libssl, skipping build of validate and digest")
else()
add_executable(validate validate.c)

target_link_libraries(validate
libappimage_shared
libglib
libssl
)
target_link_libraries(validate
libappimage_shared
libglib
libssl
)

target_include_directories(validate
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
INTERFACE $<INSTALL_INTERFACE:include/
)
target_include_directories(validate
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/>
INTERFACE $<INSTALL_INTERFACE:include/
)


add_executable(digest digest.c)
add_executable(digest digest.c)

target_link_libraries(digest
libappimage_shared
libssl
)
target_link_libraries(digest
libappimage_shared
libssl
)

add_sanitizers(digest)
add_sanitizers(digest)
endif()


# digest_md5 demo application
Expand Down Expand Up @@ -127,8 +131,15 @@ else()
)
endif()

set(optional_targets "")
foreach(target validate digest)
if(TARGET ${target})
list(APPEND optional_targets ${target})
endif()
endforeach()

install(
TARGETS AppRun appimagetool digest validate
TARGETS AppRun appimagetool ${optional_targets}
RUNTIME DESTINATION bin COMPONENT applications
LIBRARY DESTINATION lib COMPONENT applications
ARCHIVE DESTINATION lib/static COMPONENT applications
Expand Down
8 changes: 4 additions & 4 deletions src/build-runtime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ endif()
# therefore, we generate 3 suitable files containing blank bytes in the right sizes
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/16_blank_bytes
COMMAND printf '\\0%.0s' {0..15} > ${CMAKE_CURRENT_BINARY_DIR}/16_blank_bytes
COMMAND dd if=/dev/zero bs=1 count=16 of=${CMAKE_CURRENT_BINARY_DIR}/16_blank_bytes
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/1024_blank_bytes
COMMAND printf '\\0%.0s' {0..1023} > ${CMAKE_CURRENT_BINARY_DIR}/1024_blank_bytes
COMMAND dd if=/dev/zero bs=1 count=1024 of=${CMAKE_CURRENT_BINARY_DIR}/1024_blank_bytes
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/8192_blank_bytes
COMMAND printf '\\0%.0s' {0..8191} > ${CMAKE_CURRENT_BINARY_DIR}/8192_blank_bytes
COMMAND dd if=/dev/zero bs=1 count=8192 of=${CMAKE_CURRENT_BINARY_DIR}/8192_blank_bytes
)

# compile first raw object (not linked yet) into which the sections will be embedded
Expand Down Expand Up @@ -127,7 +127,7 @@ if(APPIMAGEKIT_EMBED_MAGIC_BYTES)
add_custom_command(
TARGET runtime
POST_BUILD
COMMAND printf '\\x41\\x49\\x02' | dd of=runtime bs=1 seek=8 count=3 conv=notrunc
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/embed-magic-bytes-in-file.sh ${CMAKE_CURRENT_BINARY_DIR}/runtime
)
endif()

Expand Down
8 changes: 8 additions & 0 deletions src/embed-magic-bytes-in-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /bin/bash

if [ "$1" == "" ]; then
echo "Usage: bash $0 <file>"
exit 2
fi

echo -ne 'AI\x02' | dd of="$1" bs=1 count=3 seek=8 conv=notrunc
2 changes: 1 addition & 1 deletion travis/build-appimage.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ cd out/

./appimagetool.AppDir/AppRun ./appimagetool.AppDir/ -s -v \
-u "gh-releases-zsync|AppImage|AppImageKit|continuous|appimagetool-$ARCH.AppImage.zsync" \
appimagetool-"$ARCH".AppImage || true
appimagetool-"$ARCH".AppImage
3 changes: 3 additions & 0 deletions travis/build-binaries.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ cd /AppImageKit

./build.sh "$@"

# make sure the prebuilt libraries in the container will be found
export LD_LIBRARY_PATH=/deps/lib:"$LD_LIBRARY_PATH"

./test-appimagetool.sh build/install_prefix/usr/bin/appimagetool
Empty file modified travis/test-appimage.sh
100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions travis/travis-build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ cd build/

# test AppImages
[ "$ARCH" == "i686" ] && sudo apt-get update && sudo apt-get install -y gcc-multilib lib32z1 libfuse2 libfuse2:i386 libglib2.0-0:i386 libcairo2:i386
bash -x ../travis/test-appimage.sh
[ "$ARCH" != "armhf" ] && [ "$ARCH" != "aarch64" ] && bash -x ../travis/test-appimage.sh

# install more tools
# (vim-common contains xxd)
Expand All @@ -68,10 +68,11 @@ sudo chown -R travis.travis .

# remove binaries from output directory
ls -al out/
rm -r out/{appimagetool,validate,digest,mksquashfs,*.AppDir}
rm -r out/{appimagetool,mksquashfs,*.AppDir}
rm -r out/{validate,digest} || true

# inspect runtime
xxd out/runtime | head -n 1
xxd out/runtime | head -n 1 | grep "4149 0200"
# fix filename for upload
mv out/runtime out/runtime-"$ARCH"

Expand Down