Skip to content
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

Build toolchains on macOS (continued) #91 #105

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
243 changes: 191 additions & 52 deletions .circleci/config.yml

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Toolchain Releases

## v1.7.0

This release bumps GCC from 11.3 to 12.2.

* Tool versions
* GCC 12.2 (https://gcc.gnu.org/gcc-12/changes.html#12.2)

## v1.6.2

This release adds a riscv64 glibc toolchain since that has more support than
muslc in the RISC-V community at the moment.

* Changes
* Removes Python scripting support in gdb (fixes toolchain compilation and
probably not used)
* Remove the static toolchain option since it was being ignored on MacOS. On
Linux, it disabled LTO. LTO is included on all platforms now (the default).
* Fixes runtime dependency on libzstd another way by forcibly turning it off
with a Crosstool-NG option rather than adding a configure flag. This is
possible now. Previously the option was hidden due to the static toolchain
option.
* Let gcc determine the correct option for SJLJ (setjmp/longjmp). The note
where it doesn't work doesn't apply to Nerves platforms.

## v1.6.1

This release adds musl libc toolchains for aarch64 and armv7.
Expand Down
6 changes: 6 additions & 0 deletions build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ for CONFIG in $CONFIGS; do
cd $CONFIG
mix deps.get
mix nerves.artifact --path ../
echo "Done building $CONFIG"
# TMP
echo "df -h:"
df -h
echo "ls -lh *"
ls -lh *
cd ../
done

Expand Down
2 changes: 1 addition & 1 deletion nerves_toolchain_aarch64_nerves_linux_gnu/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
1 change: 0 additions & 1 deletion nerves_toolchain_aarch64_nerves_linux_gnu/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ CT_ARCH_64=y
CT_KERNEL_LINUX=y
CT_LINUX_V_4_19=y
CT_LIBC_GLIBC=y
CT_GCC_V_11=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
2 changes: 1 addition & 1 deletion nerves_toolchain_aarch64_nerves_linux_musl/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
1 change: 0 additions & 1 deletion nerves_toolchain_aarch64_nerves_linux_musl/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ CT_ARCH_64=y
CT_KERNEL_LINUX=y
CT_LINUX_V_4_19=y
CT_LIBC_MUSL=y
CT_GCC_V_11=y
2 changes: 1 addition & 1 deletion nerves_toolchain_armv5_nerves_linux_musleabi/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
1 change: 0 additions & 1 deletion nerves_toolchain_armv5_nerves_linux_musleabi/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ CT_ARCH_ARCH="armv5te"
CT_KERNEL_LINUX=y
CT_LINUX_V_4_19=y
CT_LIBC_MUSL=y
CT_GCC_V_11=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
2 changes: 1 addition & 1 deletion nerves_toolchain_armv6_nerves_linux_gnueabihf/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
1 change: 0 additions & 1 deletion nerves_toolchain_armv6_nerves_linux_gnueabihf/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ CT_ARCH_FLOAT_HW=y
CT_KERNEL_LINUX=y
CT_LINUX_V_4_19=y
CT_LIBC_GLIBC=y
CT_GCC_V_11=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
2 changes: 1 addition & 1 deletion nerves_toolchain_armv7_nerves_linux_gnueabihf/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
1 change: 0 additions & 1 deletion nerves_toolchain_armv7_nerves_linux_gnueabihf/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ CT_ARCH_FPU="vfpv3-d16"
CT_ARCH_FLOAT_HW=y
CT_KERNEL_LINUX=y
CT_LINUX_V_4_19=y
CT_GCC_V_11=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
2 changes: 1 addition & 1 deletion nerves_toolchain_armv7_nerves_linux_musleabihf/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
1 change: 0 additions & 1 deletion nerves_toolchain_armv7_nerves_linux_musleabihf/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ CT_ARCH_FLOAT_HW=y
CT_KERNEL_LINUX=y
CT_LINUX_V_4_19=y
CT_LIBC_MUSL=y
CT_GCC_V_11=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
36 changes: 27 additions & 9 deletions nerves_toolchain_ctng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@ gcc_tuple_underscores()

build_gcc()
{
if [[ $BUILD_OS = "freebsd" ]]; then
SED=/usr/local/bin/gsed
elif [[ $BUILD_OS = "darwin" ]]; then
SED=$HOMEBREW_PREFIX/bin/gsed
else
SED="sed"
fi

# Build and install ct-ng to the work directory
cd "$WORK_DIR"
ln -sf "$DL_DIR" dl
Expand Down Expand Up @@ -237,10 +245,9 @@ build_gcc()
./bootstrap
fi
if [[ $BUILD_OS = "freebsd" ]]; then
SED=/usr/local/bin/gsed
SED=/usr/local/bin/gsed MAKE=/usr/local/bin/gmake PATCH=/usr/local/bin/gpatch ./configure --prefix="$LOCAL_INSTALL_DIR"
gmake
gmake install
SED=/usr/local/bin/gsed MAKE=/usr/local/bin/gmake PATCH=/usr/local/bin/gpatch ./configure --prefix="$LOCAL_INSTALL_DIR"
gmake
gmake install
elif [[ $BUILD_OS = "darwin" ]]; then
# Homebrew's gcc is gcc-12
BINUTILS=$(brew --prefix binutils)
Expand All @@ -250,7 +257,6 @@ build_gcc()
gmake
gmake install
else
SED=sed
./configure --prefix="$LOCAL_INSTALL_DIR"
make
make install
Expand Down Expand Up @@ -295,6 +301,8 @@ build_gcc()
# Configure logging when on CI (see crosstool-ng's build script)
if [[ "$CI" = "true" ]]; then
echo "Modifying logging for CI"
echo "In work dir: $WORK_DIR"

$SED -i -e 's/^.*\(CT_LOG_ERROR\).*$/# \1 is not set/' \
-e 's/^.*\(CT_LOG_WARN\).*$/# \1 is not set/' \
-e 's/^.*\(CT_LOG_INFO\).*$/# \1 is not set/' \
Expand All @@ -308,6 +316,8 @@ build_gcc()
"$WORK_DIR/build/.config"
fi

echo "BEFORE DOTS"

# Start building and print dots to keep CI from killing the build due
# to console inactivity.
$PREFIX "$CTNG" $CTNG_BUILD &
Expand All @@ -316,10 +326,13 @@ build_gcc()
while ps -p $build_pid >/dev/null; do
sleep 12
printf "."
echo "DOT $(date)"
done
} &
local keepalive_pid=$!

echo "Waiting for $build_pid build to finish"

# Wait for the build to finish
wait $build_pid 2>/dev/null

Expand All @@ -338,14 +351,17 @@ build_gcc()
rm -f "$GCC_INSTALL_DIR/$TARGET_TUPLE/build.log.bz2"

# Clean up crosstool-ng's work directory if we put it in a global location
if [[ "$CI" = "true" ]]; then
echo "Not cleaning up work directory since CI build"
else
echo "Cleaning up work directory since CI build"
# if [[ "$CI" = "true" ]]; then
# echo "Not cleaning up work directory since CI build"
# else
if [[ -e "$CT_WORK_DIR" ]]; then
chmod -R u+w "$CT_WORK_DIR"
rm -fr "$CT_WORK_DIR"
fi
fi
# fi
df -h
du -hs *
}

toolchain_base_name()
Expand All @@ -359,7 +375,9 @@ save_build_info()
# Save useful information if we ever need to reproduce the toolchain
TARGET_TUPLE=$(gcc_tuple)
echo "$NERVES_TOOLCHAIN_VERSION" > "$GCC_INSTALL_DIR/$TARGET_TUPLE/nerves-toolchain.tag"
echo "running: cp $CTNG_CONFIG $GCC_INSTALL_DIR/$TARGET_TUPLE/ct-ng.defconfig"
cp "$CTNG_CONFIG" "$GCC_INSTALL_DIR/$TARGET_TUPLE/ct-ng.defconfig"
echo "running: cp $WORK_DIR/build/.config $GCC_INSTALL_DIR/$TARGET_TUPLE/ct-ng.config"
cp "$WORK_DIR/build/.config" "$GCC_INSTALL_DIR/$TARGET_TUPLE/ct-ng.config"
}

Expand Down
4 changes: 4 additions & 0 deletions nerves_toolchain_ctng/scripts/unmerge_defconfig.exs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ defmodule Unmerger do
def main([original_defconfig, fragment_defconfig, resulting_defconfig]) do
IO.puts("Unmerging #{resulting_defconfig} into #{original_defconfig} using #{fragment_defconfig}\n")
orig = load(original_defconfig)
IO.inspect(orig, label: "orig")
frag = load(fragment_defconfig)
IO.inspect(frag, label: "frag")
result = load(resulting_defconfig)
IO.inspect(result, label: "result")

desired = remove_fragments(result, frag)
IO.inspect(desired, label: "desired")

if !is_similar_enough(orig, desired) do
IO.puts("\n\nDifferences detected between the original defconfig and the resulting one!!!")
Expand Down
2 changes: 1 addition & 1 deletion nerves_toolchain_i586_nerves_linux_gnu/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
1 change: 0 additions & 1 deletion nerves_toolchain_i586_nerves_linux_gnu/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ CT_ARCH_ARCH="i586"
CT_KERNEL_LINUX=y
CT_LINUX_V_4_19=y
CT_LIBC_GLIBC=y
CT_GCC_V_11=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
2 changes: 1 addition & 1 deletion nerves_toolchain_mipsel_nerves_linux_musl/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
1 change: 0 additions & 1 deletion nerves_toolchain_mipsel_nerves_linux_musl/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ CT_ARCH_FLOAT_SW=y
CT_KERNEL_LINUX=y
CT_LINUX_V_4_19=y
CT_LIBC_MUSL=y
CT_GCC_V_11=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
2 changes: 1 addition & 1 deletion nerves_toolchain_riscv64_nerves_linux_gnu/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
2 changes: 1 addition & 1 deletion nerves_toolchain_riscv64_nerves_linux_musl/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
1 change: 0 additions & 1 deletion nerves_toolchain_riscv64_nerves_linux_musl/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ CT_ARCH_ARCH="rv64gc"
CT_KERNEL_LINUX=y
CT_LINUX_V_5_10=y
CT_LIBC_MUSL=y
CT_GCC_V_11=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
2 changes: 1 addition & 1 deletion nerves_toolchain_x86_64_nerves_linux_gnu/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
1 change: 0 additions & 1 deletion nerves_toolchain_x86_64_nerves_linux_gnu/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ CT_ARCH_X86=y
CT_ARCH_64=y
CT_KERNEL_LINUX=y
CT_LINUX_V_4_19=y
CT_GCC_V_11=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set
2 changes: 1 addition & 1 deletion nerves_toolchain_x86_64_nerves_linux_musl/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2-dev
1.7.0
1 change: 0 additions & 1 deletion nerves_toolchain_x86_64_nerves_linux_musl/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ CT_ARCH_64=y
CT_KERNEL_LINUX=y
CT_LINUX_V_4_19=y
CT_LIBC_MUSL=y
CT_GCC_V_11=y
CT_DEBUG_GDB=y
# CT_GDB_CROSS_PYTHON is not set