Closed heinthanth closed 2 years ago
Hum ... quite interesting ... need to figure out ... ( It's like proxyexe causing it ... proxyexe need to be compiled as arm )
Yes ... I compiled choosenim with ARM nim ( installed manually from source ) and this work!
the problem here is embedded proxyexe
is x86 binary. That's why binaries in ~/.nimble/bin
are x86 although actually compiled toolchain in ~/.choosenim/toolchains/version/bin/
are arm64. So, we need to fetch cliparams.nim
, common.nim
, proxyexe.nim
and re-compile proxyexe
with recently built arm nim binary ( if first installed ).
So, instead, I'm try to cross-compile choosenim from intel to M1. Cross-compilation work. But analytics is not working.
Analytics not working on M1. Seems like segment fault from objc_msgSend
. So, now, have to
I've submitted an issue to puppy here https://github.com/treeform/puppy/issues/59.
Force pushed ... since I think I messed up. Everything is working file on both intel and m1 mac. I'll wait for Puppy https://github.com/treeform/puppy/pull/61 to be merged.
For now, I will close this PR. Since I'm not OK with travis ( ran out of credit - accidentally enable Consume paid credits for OSS ), I'll continue and reopen soon! Thanks @dom96 for your encouragement. Btw, can you fix travis first? it's seems broken.
This is a cool approach, thank you!
the problem here is embedded proxyexe is x86 binary. That's why binaries in ~/.nimble/bin are x86 although actually compiled toolchain in ~/.choosenim/toolchains/version/bin/ are arm64.
Why is this a problem btw? all that matters is that the Nim binaries are arm64, no?
No ... proxyexe is x86 and if we run nim c something.nim, something also become x86.
proxyexe just executes the arm64 Nim though, or am I missing something? why would proxyexe being arm64 matter in what nim c ...
produces?
I've demo here:
I create a simple proxy which invoke my arm64 nim binary.
Here, I have two nim binaries. I compiled proxy.nim with x86 nim.
So, proxy binary become x86.
Then, I tried to compile test.nim
with proxy binary ( which, in turn, invoke arm64 nim binary ). But test binary become x86.
I think, test.nim also become x86 since the parent process which invoke C compile is x86. Don't know much about nim internal stuffs ( how nim invoke c compiler ).
But when I compile test.nim with my nim arm64 binary, it become ARM.
I think choosenim has two options:
If we want, we can discord too. We're friends on discord.
On M1 macs, since we don't have arm binaries for choosenim, we can use x86 choosenim to download and invoke compiler. By default choosenim under rosetta build x86 nim. But passing arch -arm64 will build arm64 nim binary. This add improvement to #149.