Skip to content

Commit

Permalink
fix arm64 bit builds
Browse files Browse the repository at this point in the history
  • Loading branch information
techknowlogick authored Nov 22, 2024
1 parent ff1a00e commit 83f8343
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions docker/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,13 @@ for TARGET in $TARGETS; do
ln -s /usr/local/go/pkg/linux_arm-5 /usr/local/go/pkg/linux_arm
fi
echo "Compiling for linux/arm-5..."
XGOOS="linux" XGOARCH="arm-5" GOCACHE=/gocache/linux/arm-5 CC=arm-linux-gnueabi-gcc CXX=aarch64-linux-gnu-g++ HOST=arm-linux-gnueabi-gcc PREFIX=/usr/aarch64-linux-gnu CFLAGS="-march=armv5t" CXXFLAGS="-march=armv5t" do_build
export PKG_CONFIG_PATH=/usr/aarch64-linux-gnu/lib/pkgconfig
XGOOS="linux" XGOARCH="arm-5" GOCACHE=/gocache/linux/arm-5 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnu-g++ HOST=arm-linux-gnueabi-gcc PREFIX=/usr/arm-linux-gnu CFLAGS="-march=armv5t" CXXFLAGS="-march=armv5t" do_build
export PKG_CONFIG_PATH=/usr/arm-linux-gnu/lib/pkgconfig

if [[ "$USEMODULES" == false ]]; then
GOCACHE=/gocache/linux/arm-5 CC=arm-linux-gnueabi-gcc CXX=aarch64-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=1 CGO_CFLAGS="-march=armv5t" CGO_CXXFLAGS="-march=armv5t" go get $V $X "${T[@]}" -d "$PACK_RELPATH"
GOCACHE=/gocache/linux/arm-5 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=1 CGO_CFLAGS="-march=armv5t" CGO_CXXFLAGS="-march=armv5t" go get $V $X "${T[@]}" -d "$PACK_RELPATH"
fi
GOCACHE=/gocache/linux/arm-5 CC=arm-linux-gnueabi-gcc CXX=aarch64-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=1 CGO_CFLAGS="-march=armv5t" CGO_CXXFLAGS="-march=armv5t" $GOBIN build $V $X $TP $BV "${MOD[@]}" "${T[@]}" "${LDF[@]}" "${GC[@]}" "${BM[@]}" -o "/build/$NAME-linux-arm-5$(extension linux)" "$PACK_RELPATH"
GOCACHE=/gocache/linux/arm-5 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=5 CGO_ENABLED=1 CGO_CFLAGS="-march=armv5t" CGO_CXXFLAGS="-march=armv5t" $GOBIN build $V $X $TP $BV "${MOD[@]}" "${T[@]}" "${LDF[@]}" "${GC[@]}" "${BM[@]}" -o "/build/$NAME-linux-arm-5$(extension linux)" "$PACK_RELPATH"
if [ "$GO_VERSION_MAJOR" -gt 1 ] || { [ "$GO_VERSION_MAJOR" == 1 ] && [ "$GO_VERSION_MINOR" -ge 15 ]; }; then
rm /usr/local/go/pkg/linux_arm
fi
Expand All @@ -274,13 +274,13 @@ for TARGET in $TARGETS; do
ln -s /usr/local/go/pkg/linux_arm-6 /usr/local/go/pkg/linux_arm

echo "Compiling for linux/arm-6..."
XGOOS="linux" XGOARCH="arm-6" GOCACHE=/gocache/linux/arm-6 CC=arm-linux-gnueabi-gcc CXX=aarch64-linux-gnu-g++ HOST=arm-linux-gnueabi-gcc PREFIX=/usr/aarch64-linux-gnu CFLAGS="-march=armv6" CXXFLAGS="-march=armv6" do_build
export PKG_CONFIG_PATH=/usr/aarch64-linux-gnu/lib/pkgconfig
XGOOS="linux" XGOARCH="arm-6" GOCACHE=/gocache/linux/arm-6 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnu-g++ HOST=arm-linux-gnueabi-gcc PREFIX=/usr/arm-linux-gnu CFLAGS="-march=armv6" CXXFLAGS="-march=armv6" do_build
export PKG_CONFIG_PATH=/usr/arm-linux-gnu/lib/pkgconfig

if [[ "$USEMODULES" == false ]]; then
GOCACHE=/gocache/linux/arm-6 CC=arm-linux-gnueabi-gcc CXX=aarch64-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 CGO_CFLAGS="-march=armv6" CGO_CXXFLAGS="-march=armv6" go get $V $X "${T[@]}" -d "$PACK_RELPATH"
GOCACHE=/gocache/linux/arm-6 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 CGO_CFLAGS="-march=armv6" CGO_CXXFLAGS="-march=armv6" go get $V $X "${T[@]}" -d "$PACK_RELPATH"
fi
GOCACHE=/gocache/linux/arm-6 CC=arm-linux-gnueabi-gcc CXX=aarch64-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 CGO_CFLAGS="-march=armv6" CGO_CXXFLAGS="-march=armv6" $GOBIN build $V $X $TP $BV "${MOD[@]}" "${T[@]}" "${LDF[@]}" "${GC[@]}" "${BM[@]}" -o "/build/$NAME-linux-arm-6$(extension linux)" "$PACK_RELPATH"
GOCACHE=/gocache/linux/arm-6 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 CGO_CFLAGS="-march=armv6" CGO_CXXFLAGS="-march=armv6" $GOBIN build $V $X $TP $BV "${MOD[@]}" "${T[@]}" "${LDF[@]}" "${GC[@]}" "${BM[@]}" -o "/build/$NAME-linux-arm-6$(extension linux)" "$PACK_RELPATH"

rm /usr/local/go/pkg/linux_arm
fi
Expand All @@ -289,26 +289,26 @@ for TARGET in $TARGETS; do
ln -s /usr/local/go/pkg/linux_arm-7 /usr/local/go/pkg/linux_arm

echo "Compiling for linux/arm-7..."
XGOOS="linux" XGOARCH="arm-7" GOCACHE=/gocache/linux/arm-7 CC=arm-linux-gnueabi-gcc CXX=aarch64-linux-gnu-g++ HOST=arm-linux-gnueabi-gcc PREFIX=/usr/aarch64-linux-gnu CFLAGS="-march=armv7-a -fPIC" CXXFLAGS="-march=armv7-a -fPIC" do_build
export PKG_CONFIG_PATH=/usr/aarch64-linux-gnu/lib/pkgconfig
XGOOS="linux" XGOARCH="arm-7" GOCACHE=/gocache/linux/arm-7 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnu-g++ HOST=arm-linux-gnueabi-gcc PREFIX=/usr/arm-linux-gnu CFLAGS="-march=armv7-a -fPIC" CXXFLAGS="-march=armv7-a -fPIC" do_build
export PKG_CONFIG_PATH=/usr/arm-linux-gnu/lib/pkgconfig

if [[ "$USEMODULES" == false ]]; then
GOCACHE=/gocache/linux/arm-7 CC=arm-linux-gnueabi-gcc CXX=aarch64-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="-march=armv7-a -fPIC" CGO_CXXFLAGS="-march=armv7-a -fPIC" go get $V $X "${T[@]}" -d "$PACK_RELPATH"
GOCACHE=/gocache/linux/arm-7 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="-march=armv7-a -fPIC" CGO_CXXFLAGS="-march=armv7-a -fPIC" go get $V $X "${T[@]}" -d "$PACK_RELPATH"
fi
GOCACHE=/gocache/linux/arm-7 CC=arm-linux-gnueabi-gcc CXX=aarch64-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="-march=armv7-a -fPIC" CGO_CXXFLAGS="-march=armv7-a -fPIC" $GOBIN build $V $X $TP $BV "${MOD[@]}" "${T[@]}" "${LDF[@]}" "${GC[@]}" "${BM[@]}" -o "/build/$NAME-linux-arm-7$(extension linux)" "$PACK_RELPATH"
GOCACHE=/gocache/linux/arm-7 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnu-g++ GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=1 CGO_CFLAGS="-march=armv7-a -fPIC" CGO_CXXFLAGS="-march=armv7-a -fPIC" $GOBIN build $V $X $TP $BV "${MOD[@]}" "${T[@]}" "${LDF[@]}" "${GC[@]}" "${BM[@]}" -o "/build/$NAME-linux-arm-7$(extension linux)" "$PACK_RELPATH"

rm /usr/local/go/pkg/linux_arm
fi
if { [ "$XGOOS" == "." ] || [ "$XGOOS" == "linux" ]; } && { [ "$XGOARCH" == "." ] || [ "$XGOARCH" == "arm64" ]; }; then
echo "Compiling for linux/arm64..."
mkdir -p /gocache/linux/arm64
XGOOS="linux" XGOARCH="arm64" GOCACHE=/gocache/linux/arm64 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabihf-g++ PREFIX=/usr/arm-linux-gnueabi-gcc/ do_build
export PKG_CONFIG_PATH=/usr/arm-linux-gnueabi-gcc/lib/pkgconfig
XGOOS="linux" XGOARCH="arm64" GOCACHE=/gocache/linux/arm64 CC=aarch64-linux-gnueabi-gcc CXX=aarch64-linux-gnueabihf-g++ PREFIX=/usr/aarch64-linux-gnueabi-gcc/ do_build
export PKG_CONFIG_PATH=/usr/aarch64-linux-gnueabi-gcc/lib/pkgconfig

if [[ "$USEMODULES" == false ]]; then
GOCACHE=/gocache/linux/arm64 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabihf-g++ GOOS=linux GOARCH=arm CGO_ENABLED=1 go get $V $X "${T[@]}" -d "$PACK_RELPATH"
GOCACHE=/gocache/linux/arm64 CC=aarch64-linux-gnueabi-gcc CXX=aarch64-linux-gnueabihf-g++ GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go get $V $X "${T[@]}" -d "$PACK_RELPATH"
fi
GOCACHE=/gocache/linux/arm64 CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabihf-g++ GOOS=linux GOARCH=arm CGO_ENABLED=1 $GOBIN build $V $X $TP $BV "${MOD[@]}" "${T[@]}" "${LDF[@]}" "${GC[@]}" "${BM[@]}" -o "/build/$NAME-linux-arm64$(extension linux)" "$PACK_RELPATH"
GOCACHE=/gocache/linux/arm64 CC=aarch64-linux-gnueabi-gcc CXX=aarch64-linux-gnueabihf-g++ GOOS=linux GOARCH=arm64 CGO_ENABLED=1 $GOBIN build $V $X $TP $BV "${MOD[@]}" "${T[@]}" "${LDF[@]}" "${GC[@]}" "${BM[@]}" -o "/build/$NAME-linux-arm64$(extension linux)" "$PACK_RELPATH"
fi
if { [ "$XGOOS" == "." ] || [ "$XGOOS" == "linux" ]; } && { [ "$XGOARCH" == "." ] || [ "$XGOARCH" == "mips64" ]; }; then
echo "Compiling for linux/mips64..."
Expand Down

6 comments on commit 83f8343

@pat-s
Copy link
Collaborator

@pat-s pat-s commented on 83f8343 Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@techknowlogick
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I changed this because 32bit binaries are being built when aarch64 should be produced.

@techknowlogick
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see my mistake. One sec while I update this

@techknowlogick
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or, hm... that might not be it.

@techknowlogick
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed something that hopefully fixes it

@pat-s
Copy link
Collaborator

@pat-s pat-s commented on 83f8343 Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it did - thanks a lot! Also for ensuring 64-bit - important, of course!

Please sign in to comment.