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

Add Darwin-arm64 support for the nodetime pkg #873

Closed
ilgooz opened this issue Mar 16, 2021 · 18 comments
Closed

Add Darwin-arm64 support for the nodetime pkg #873

ilgooz opened this issue Mar 16, 2021 · 18 comments
Assignees
Labels
type:bug Something isn't working

Comments

@ilgooz
Copy link
Member

ilgooz commented Mar 16, 2021

Right now only x64 is supported.
https://github.com/tendermint/starport/blob/fd2abefd165325180efe43e585ff4c0bbd84090e/scripts/data/gen-nodetime/package.json#L9

The script needs to be updated to place the gzipped tarbal and an ARM target needs to be added here for conditional builds.

Also see zeit/pkg#targets.

This issue needs to be resolved in order to Starport's ARM releases work.

nodetime pkg is used to build js clients from proto. Please add the following to your config.yml and run starport build. Command should successfully get executed on ARM once it is supported, right now it should be failing.

client:
  vuex:
    path: "js"

@faddat would you like to take this one?

@ilgooz ilgooz added the type:bug Something isn't working label Mar 16, 2021
@faddat
Copy link
Contributor

faddat commented Mar 16, 2021

yes, I would :)

@faddat
Copy link
Contributor

faddat commented Mar 16, 2021

There is now an additonal question:

who has a very new macbook, with the M1 cpu?

@faddat
Copy link
Contributor

faddat commented Mar 16, 2021

Working on this here:

#874

@faddat
Copy link
Contributor

faddat commented Mar 16, 2021

nodejs (itself) takes a very long time to compile on rpi :P

@ilgooz
Copy link
Member Author

ilgooz commented Mar 17, 2021

Oh, why do we compile it on a Pi? Zeit pkg should be able to do it on an AMD machine.

@faddat
Copy link
Contributor

faddat commented Mar 17, 2021

Got it. Will work from my mac in that case.

@faddat
Copy link
Contributor

faddat commented Mar 17, 2021

Oh, why do we compile it on a Pi? Zeit pkg should be able to do it on an AMD machine.

This requires a cross-compile setup. We can have one, but it takes a minute, unless you know something I do not. I've got linux-arm64 complete, but still need to get finished with darwin-arm64.

There aren't pre-built packages for linux-arm64 and darwin-arm64 the way there are for linux-x64 and darwin-x64.

@faddat
Copy link
Contributor

faddat commented Mar 17, 2021

We end up in a funny spot.

Few systems will be able to build for all targets.

For now I am going to take out the macos-arm64 target and if anyone has an m1 cpu they can do the build, and push the resulting binary.

I think that we now have Linux arm 64 support

Otherwise, the solution really looks like building a cross compile tool chain and I've built those....

It takes time.

of course since we want the entire thing to be able to built from source by anybody, anywhere at any time, eventually we will need to bake in a cross compile toolchain.


> nodetime@1.0.0 build
> ./node_modules/pkg/lib-es5/bin.js --debug -t node14-linux-x64,node14-macos-x64,node14-macos-arm64 -o nodetime .

> pkg@4.4.9
> Fetching base Node.js binaries to PKG_CACHE_PATH
  fetched-v14.4.0-macos-arm64  [                    ] 0%
> Error! 404 Not Found
  https://github.com/zeit/pkg-fetch/releases/download/v2.6/uploaded-v2.6-node-v14.4.0-macos-arm64
> Asset not found by direct link:
  {"tag":"v2.6","name":"uploaded-v2.6-node-v14.4.0-macos-arm64"}
> Not found in GitHub releases:
  {"tag":"v2.6","name":"uploaded-v2.6-node-v14.4.0-macos-arm64"}
> Building base binary from source:
  built-v14.4.0-macos-arm64
> Error! Not able to build for 'arm64' here, only for 'x64'

@faddat
Copy link
Contributor

faddat commented Mar 17, 2021

@ilgooz let me know please if I'm missing something that seems obvious to you.

From where I'm standing, being able to build for all targets from a Mac, for example, will require the creation of a cross compile tool chain, and the addition of a script for that to the repository.

@faddat
Copy link
Contributor

faddat commented Mar 17, 2021

Success! (for linux-arm64 only)

[root@alarm starport]# starport app github.com/fivesixnine/splash

⭐️ Successfully created a Cosmos app 'splash'.
👉 Get started with the following commands:

 % cd splash
 % starport serve

NOTE: add --verbose flag for verbose (detailed) output.

@faddat faddat changed the title Add ARM support for the nodetime pkg Add Darwin-arm64 support for the nodetime pkg Mar 17, 2021
@faddat
Copy link
Contributor

faddat commented Mar 17, 2021

Changed the topic as we should still try to cover the M1 cpus

@fadeev
Copy link
Contributor

fadeev commented Apr 12, 2021

@faddat please, reopen, if you plan to work on this.

@fadeev fadeev closed this as completed Apr 12, 2021
@faddat
Copy link
Contributor

faddat commented Apr 12, 2021

I would love to but I need access to an m1 CPU.

I just built my new machine and it is decidedly not an Apple thing.

@faddat
Copy link
Contributor

faddat commented Apr 12, 2021

@fadeev silly of me not to mention that I support the barter protocol.

Can address this / look into:

cosmos/gaia#803

For approx this: 43,990,000 Vietnamese dong equals 1,908.13 United States Dollar

https://cellphones.com.vn/macbook-pro-2020-13-inch-touch-bar-m1-16gb-512gb.html

Or this: 28,900,000 Vietnamese dong equals 1,253.68 United States Dollar

https://cellphones.com.vn/mac-mini-2020-m1-16gb-512gb.html?gclid=Cj0KCQjw38-DBhDpARIsADJ3kjlv8ZGN6Yp9S4w_WnrHFL7337u5JuLJXcn-J0Pcz4_Kh-rYnBzgWEcaAmt6EALw_wcB

No idea if this is the right way to propose this; figure that the value for money exists.

@mangas
Copy link

mangas commented May 9, 2021

Hey @ilgooz I can help with this one but I need a little help on the node side. Where are these gz coming from? Do I need to add it manually or is there a script that downloads them?

Please see the follow draft PR to make sure I didn't miss the necessary changes #1118

It looks like node 14 is not available as a package and I'm not sure it can be built for mac arm since it's only officially supported since version 16. Would upgrading be an option?

------ Progress --------
Replacing the build line with the following seems to try and compile nodejs from scratch and fails, I will investigate this further as I find some time.

"build": "./node_modules/pkg/lib-es5/bin.js --debug -t latest -o nodetime2 ."
nodetime@1.0.0 build
> ./node_modules/pkg/lib-es5/bin.js --debug -t latest -o nodetime2 .

> pkg@4.4.9
> Fetching base Node.js binaries to PKG_CACHE_PATH
  fetched-v14.4.0-macos-arm64  [                    ] 0%
> Error! 404 Not Found
  https://github.com/zeit/pkg-fetch/releases/download/v2.6/uploaded-v2.6-node-v14.4.0-macos-arm64
> Asset not found by direct link:
  {"tag":"v2.6","name":"uploaded-v2.6-node-v14.4.0-macos-arm64"}
> Not found in GitHub releases:
  {"tag":"v2.6","name":"uploaded-v2.6-node-v14.4.0-macos-arm64"}
> Building base binary from source:
  built-v14.4.0-macos-arm64
> Cloning Node.js repository from GitHub...
  git                          [====================] 100%
> Checking out v14.4.0
> Applying patches
> Compiling Node.js from sources...
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
Node.js configure: Found Python 2.7.16...
Error running GYP
> Error! Error: ./configure failed with code 1
    at ChildProcess.<anonymous> (/Users/fa/git/starport/scripts/data/gen-nodetime/node_modules/pkg-fetch/lib-es5/spawn.js:68:23)
    at ChildProcess.emit (node:events:365:28)
    at maybeClose (node:internal/child_process:1067:16)
    at Socket.<anonymous> (node:internal/child_process:453:11)
    at Socket.emit (node:events:365:28)
    at Pipe.<anonymous> (node:net:661:12)

Downloading node16 arm64 from here and adding it to starport/pkg/nodetime/nodetime-darwin-arm64.tar.gz basically works with make install

I see what went wrong here ^^

Bumping pkg version to "pkg": "^5.1.0" solved the problem.

@ilgooz
Copy link
Member Author

ilgooz commented May 20, 2021

See #1116 for more info.

@faddat
Copy link
Contributor

faddat commented May 25, 2021

#1187 continues this.

It is getting close, down to a single typescript error.

@ilgooz
Copy link
Member Author

ilgooz commented Mar 1, 2022

Closing in favor of #2130.

@ilgooz ilgooz closed this as completed Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants