openwrt / actions-shared-workflows

4 stars 12 forks source link

CI: switch to macOS 14 (Sonoma) #11

Closed hauke closed 2 months ago

hauke commented 4 months ago

This switches the build to MacOS 14.

I did a test run here: https://github.com/hauke/openwrt/actions/runs/8318176338/job/22759803760

Ansuel commented 4 months ago

Mhhh why we need to target macos 14? Also I assume there would be difference with macos 12 and macos14 ?

hauke commented 3 months ago

github will switch to the macos-14 image between April and June. Currently it is not automatically working. The macos-14 image is using a M1 aarch64 CPU, which is nice.

Someone reported problems with old macos 12 in https://github.com/openwrt/openwrt/pull/14802 and I wanted to try something recent.

httpstorm commented 3 months ago

Thanks @hauke , my last build of OpenWRT main used macOS Sonoma 14.4,, Xcode 15.2. This went smooth, however with Xcode 15.3 I observed build errors in toolchain/gcc/initial and toolchain/gcc/final. I can switch back to 15.2 to compile these, then the reset builds without any issues with 15.3. See https://github.com/openwrt/openwrt/pull/14802#issuecomment-2002528031

PR toolchain/gcc: fix build errors on macOS with Xcode 15.3

Edit: x64 fails on main, but I was able to build it in September 2023. Fixed by 0cb3e86 kernel: fix build issue on macOS

hauke commented 3 months ago

Thanks @hauke , my last build of OpenWRT main used macOS Sonoma 14.4,, Xcode 15.2. This went smooth, however with Xcode 15.3 I observed build errors in toolchain/gcc/initial and toolchain/gcc/final. I can switch back to 15.2 to compile these, then the reset builds without any issues with 15.3. See openwrt/openwrt#14802 (comment)

PR toolchain/gcc: fix build errors on macOS with Xcode 15.3

The github macos 14 builder are still using xcode 15.0.1, see https://github.com/actions/runner-images/blob/main/images/macos/toolsets/toolset-14.json#L3 I will wait till the CI passed on you PR and then probably merge it.

robimarko commented 3 months ago

@hauke I merged the GCC fixes, guess its probably good idea to merge this as well?

mpratt14 commented 3 months ago

me being very picky... the link in the commit message should be a tagged line before sign off

Link: https://...

httpstorm commented 3 months ago

Also to my knowledge, /opt/homebrew is used on Apple Silicon, while /usr/local is used on Intel. Mine is an Intel variant on 14.4.1 still using /usr/local. If the runners use Apple Silicon, the change to /opt/homebrew should be ok.

robimarko commented 2 months ago

Yeah, considering GH changed their latest to macOS 14 I will close this

BKPepe commented 2 months ago

Hmm, but I think other Hauke's commits should be merged.

robimarko commented 2 months ago

Ahh yes, good catch

robimarko commented 2 months ago

I merged everything as hardcoding macOS 14 wont hurt

BKPepe commented 2 months ago

Okay, great! :) Let's see if it helps, thanks.

httpstorm commented 2 months ago

@robimarko @BKPepe After hijacking a macOS 14 runner to run commands manually some time ago, I can confirm, the paths are correct for it, since it is indeed ARM based. The old macOS 12 x64 runner took 4 hours to complete a full build on my first attempt and then nearly six on the second (could be due to throttling). The new runner is way faster. I didn't have the opportunity to run a full build there yet, because I used 20 hours in two days to set up my environment for building OpenWRT. So I gave it some rest. If you like I can try a full build and share the results?

robimarko commented 2 months ago

@httpstorm Sure, if you have time

httpstorm commented 2 months ago

@robimarko With the ARM based macOS runners, I'm getting the following error. Note that I'm running commands on the runner manually, and it might be that I have not set my environment properly. If it build correctly on the OpenWRT CI, then it's definitely my environment.

make package/libs/toolchain/{clean,compile} -j 1 V=s
…
install -d -m0755 /Volumes/OpenWrt/openwrt/bin/targets/x86/64/packages
/Volumes/OpenWrt/openwrt/staging_dir/host/bin/fakeroot /Volumes/OpenWrt/openwrt/staging_dir/host/bin/bash /Volumes/OpenWrt/openwrt/scripts/ipkg-build -m "" /Volumes/OpenWrt/openwrt/build_dir/target-x86_64_musl/toolchain/ipkg-x86_64/libgcc /Volumes/OpenWrt/openwrt/bin/targets/x86/64/packages
dyld[21467]: terminating because inserted dylib '/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot.dylib' could not be loaded: tried: '/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/System/Volumes/Preboot/Cryptexes/OS/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot.dylib' (no such file), '/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot-0.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/System/Volumes/Preboot/Cryptexes/OS/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot-0.dylib' (no such file), '/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot-0.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e'))
dyld[21467]: tried: '/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/System/Volumes/Preboot/Cryptexes/OS/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot.dylib' (no such file), '/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot-0.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e')), '/System/Volumes/Preboot/Cryptexes/OS/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot-0.dylib' (no such file), '/Volumes/OpenWrt/openwrt/staging_dir/host/lib/libfakeroot-0.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e'))
/Volumes/OpenWrt/openwrt/scripts/ipkg-build: line 150: 21467 Abort trap: 6           mkdir "$tmp_dir"
make[2]: *** [Makefile:750: /Volumes/OpenWrt/openwrt/bin/targets/x86/64/packages/libgcc1_13.2.0-r4_x86_64.ipk] Error 134

.config x64.2024-04-28.02-libs-toolchain.txt

Here is my environment https://github.com/httpstorm/runner-test Once I start the reverse-shell action, I get a shell and I run the following commands:

./openwrt
git clone https://github.com/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a

make defconfig
rm .config
wget https://httpstorm.com/share/.openwrt/test/2024-03-12_xcode-15.3/x64.2024-04-28.01-config.tgz
tar xvfz x64.2024-04-28.01-config.tgz
make -j 6
robimarko commented 2 months ago

@httpstorm Hm, how does the CI tool build pass then?

httpstorm commented 2 months ago

@robimarko If the CI builds past that it means it works there, thank you for confirming. This implies my environment is not configured correctly: it is based on the setup of my Intel MacBook. So it works on Intel based runners. I'll have to follow the OpenWRT recipe and fix it.

robimarko commented 2 months ago

@httpstorm Yeah, CI builds have been passing just fine since this was merged.

I will probably get an M1 Macbook at work to run build periodically and test whether it works as its not feasible to rent on Scaleway everytime.