wimdeblauwe / ttcli

CLI to create a Spring Boot with Thymeleaf project
Apache License 2.0
86 stars 6 forks source link

Support native builds on Apple silicon #29

Closed hmaag closed 9 months ago

hmaag commented 1 year ago

Hey Wim!

This tool is great! Just wanted to flag an issue in case it helps others who might come across it.

Installation via brew worked great, but when when attempting to run ttcli init I received the following: zsh: bad CPU type in executable: ttcli

I'm on a new M2 Pro chip (first Mac in years), and Google leads me to believe this is a somewhat common issue. The commonly suggested fix I came across was to install Rosetta 2. This doable via the CLI: softwareupdate --install-rosetta

After running that installation the original ttcli init command worked great.

Not sure if this is anything you're able to address on your end, but hope it helps other folks who might be new to Apple's ARM chips like myself.

Really enjoying Taming Thymeleaf -- thanks for putting out such a great book!

wimdeblauwe commented 1 year ago

Thanks for letting me know, I still have an Intel mac, but I'll see what I can do. Glad you have found a workaround for now.

wimdeblauwe commented 1 year ago

Seems there is no GitHub-hosted runner available to build for Apple silicon at present. See https://github.com/github/roadmap/issues/528 which is currently scheduled for Q4 2023.

TomBeckett commented 1 year ago

@wimdeblauwe GitHub runners are now available 🎉

wimdeblauwe commented 1 year ago

Seems it is not yet available for free for public projects: https://github.com/actions/runner-images/issues/8439#issuecomment-1755601587

Op wo 25 okt. 2023 om 21:40 schreef Tom Beckett @.***>

@wimdeblauwe https://github.com/wimdeblauwe GitHub runners are now available 🎉

— Reply to this email directly, view it on GitHub https://github.com/wimdeblauwe/ttcli/issues/29#issuecomment-1779936820, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIQNL37SW7UWDY226QDNVLYBFTKHAVCNFSM6AAAAAAXYOSINCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZZHEZTMOBSGA . You are receiving this because you were mentioned.Message ID: @.***>

kgantchev commented 10 months ago

Seems it is not yet available for free for public projects:

You can use the FlyCI's M1 and M2 runners. Our runners are on average 2x faster and 2x cheaper than GitHub's AND we have a free tier for OSS projects (see below).

Install Instructrions

Easily replace your M1 runners:

jobs:
 ci:
-    runs-on: macos-latest
+    runs-on: flyci-macos-large-latest-m1
   steps:
   - name: 👀 Checkout repo
     uses: actions/checkout@v4

Or try the M2 runners:

jobs:
  ci:
-    runs-on: macos-latest
+    runs-on: flyci-macos-large-latest-m2
    steps:
      - name: 👀 Checkout repo
        uses: actions/checkout@v4

Pricing

Processor vCPU RAM (GB) Storage Label Price on FlyCI Price on GitHub
M1 4 7 28 GB flyci-macos-large-latest-m1 $0.06 -
M1 8 14 28 GB flyci-macos-xlarge-latest-m1 $0.12 $0.16
M2 4 7 28 GB flyci-macos-large-latest-m2 $0.08 -
M2 8 14 28 GB flyci-macos-xlarge-latest-m2 $0.16 -

500 mins/month Free for Public Repos

If your repo is public, then FlyCI offers 500 mins/month of free M1 runner usage with the flyci-macos-large-latest-m1 runner.

Best Regards, Kiril Gantchev CEO and co-founder of FlyCI

ChristianHuff-DEV commented 10 months ago

I just installed 1.1.0 using brew on an M1 and I'm getting the following error:

christian@mac modern-frontends-with-htmx % ttcli init
The current machine does not support all of the following CPU features that are required by the image: [CX8, CMOV, FXSR, MMX, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, POPCNT, LZCNT, AVX, AVX2, BMI1, BMI2, FMA].
Please rebuild the executable with an appropriate setting of the -march option.

Installing Rosetta 2 did not solve the issue. I ended up building it myself but it would be great if you could provide it through brew.

wimdeblauwe commented 9 months ago

I created a test build for Apple silicon since that is now officially supported on GitHub : https://github.com/wimdeblauwe/ttcli/actions/runs/7731468595

Could somebody that has such a device try the build to see if it works?

ChristianHuff-DEV commented 9 months ago

I created a test build for Apple silicon since that is now officially supported on GitHub : https://github.com/wimdeblauwe/ttcli/actions/runs/7731468595

Could somebody that has such a device try the build to see if it works?

Looks good (M1 running macOs Sonoma 14.2.1):

christian@MacBook Temp % ./ttcli init
? Group:  com.test
? Artifact:  test-project
? Project Name:  Test Project
? Select Spring Boot version 3.2.2
? Select live reload implementation: npm-based-with-tailwind-css
? Web dependencies alpinejs,htmx
? Tailwind dependencies forms
🍃 Generating Spring Boot project
🛠️  Using node v18.14.0 with npm 9.3.1
🔨 Installing npm dependencies
👷‍♂️ Adding npm build scripts
👷🏻‍♀️ Updating Maven pom.xml
🔨 Installing npm dependencies
✅ Done generating project at /Users/christian/Temp/./test-project

See HELP.md in the generated project for additional information.

There is one error in the logs. But it seemingly had no negative impact. I can open and start the generated project using IntelliJ without any issues.

ttcli.log

wimdeblauwe commented 9 months ago

Ok, thanks for testing @ChristianHuff-DEV !

wimdeblauwe commented 9 months ago

Version 1.1.1 is now released with native Apple silicon (M1/M2/M3) builds. You can download it from the releases, or use homebrew.