Ish: node/npm needs SSE

Created on 14 Nov 2018  Ā·  57Comments  Ā·  Source: ish-app/ish

Running npm or node returns 'Bad system call'

compatibility emulator

Most helpful comment

Lurker here. To all of the folks replying with "Any update? What's next? What's the priority?", please don't. It's disrespectful to the community and the owner of this project to hammer issues with rhetorical questions.

This is an open source project and the issue is clearly up for grabs (see "No one assigned" on the assignees space). If you're interested in seeing node support added, subscribe to the issue and either (a) do it yourself or (b) wait for someone else to do it.

All 57 comments

If someone (me) wanted to push this forward. Is there a recommended place to start debugging what’s needed here?

You can try to run the program with strace logging enabled (on by default in Xcode, meson configure -Dlog=strace if you're running ish standalone), and find out what system call it's attempting to use. My hunch is that you'll find it's trying to call epoll_create, which is the entry point to an entire unimplemented subsystem that will have to be implemented before node can get anywhere at all. If you're feeling up to the task, a decent starting point would be the implementations of select and poll.

Spent some time looking into this... it’s just a little too much outside my current ability I’m sad to say šŸ˜ž

Wish I could help anyhow; however, my expertise is limited to software design (iXD, UI, UX, PM, ...)

Sent with GitHawk

No longer a bad system call:
```
Device:~# node
Illegal instruction
Device:~# dmesg
FIXME socketcall 16
13 page fault on 0x50 at 0x567336fd
unknown ioctl 5451
unknown ioctl 5451
unknown ioctl 5451
19 illegal instruction at 0x56cc250f: f2 0f 10 02 b2 00 66 0f

what's the next for this?

SSE2 instructions. If you want to work on it, feel free.

is it a priority? it would be amazing to be able to run node so I can build my project and run it

Any update on this?

no

Lurker here. To all of the folks replying with "Any update? What's next? What's the priority?", please don't. It's disrespectful to the community and the owner of this project to hammer issues with rhetorical questions.

This is an open source project and the issue is clearly up for grabs (see "No one assigned" on the assignees space). If you're interested in seeing node support added, subscribe to the issue and either (a) do it yourself or (b) wait for someone else to do it.

A. No one means any disrespect, if anything we cared enough to search for the repo and look for bugs...
B. If I or anyone had a clue how to do that we probably would, but we don’t,
C. It’s important to be able to run JavaScript on iPad because it will open a whole ne world, and as you can see from the poll you made on the main page, most people use JavaScript html and so on

Please see it as a plea to push it up the priority ladder instead of a disrespectful comment.

What's the poll I made on the main page?

I'm sorry if i was disrespectful, it wasn't my intention.

to get node to work, don't we need to implement SSE2 which is pretty big?

Yeah

Would it make sense to abuse JavaScriptCore somehow (not that I know how) to add node support for those who wants it?

I see how this can be problematic for those who doesn't care about nodes at all in iOS (such as myself)

No, JavaScriptCore isn't a good substitute for Node. They're completely different programs, with different supported features.

is it a priority? it would be amazing to be able to run node so I can build my project and run it

btw Rescript (free on Apple's App Store) has a full and working environment in NodeJS

That's pretty cool, I haven't seen it before. I bet it's really slow though.

i tried it one time on my iPad (6th) it was pretty good, don't know if it's what he wants

Their sample project is super fast!

is it a priority? it would be amazing to be able to run node so I can build my project and run it

btw Rescript (free on Apple's App Store) has a full and working environment in NodeJS

Also Play.js but is paid.

I don’t know enough to know how much work getting support for node would be. But is there a bounty amount that would make it worth someone’s time?

Rescript looks nice, but what I really need is Gulp, which can be installed as a node module via npm.

Howdy,

I have created a bounty for this issue https://www.bountysource.com/issues/66159647-npm-node-support

@Rexogamer no not really

Apparently, there is hope for this if you want to run a really old version of node.

https://github.com/nodejs/node/issues/8926

Although, compiling from source in iSH for really big programs crashes, so take it with a grain of salt.

Crashing when compiling large programs is something I've noticed too, I suspect it's because of memory leaks. Filed issue #464 for that.

Couldn’t somebody just recompile node.js to not use SSE2 instructions in the compiler flags?

Is it node.js, V8, or both that would need the compiler flags changed?

The V8 JIT made SSE2 mandatory 6 years ago. https://github.com/v8/v8/blame/4b9b23521e6fd42373ebbcb20ebe03bf445494f9/src/ia32/assembler-ia32.cc#L129

As mentioned above, you could try compiling node 0.10.x, which uses a version of V8 from before this requirement.

Gotcha. Fabrice Bellard’s QuickJS may almost be an alternative.

Does Linux’s epoll work with iSH yet or no?

Yes. quickjs is in the alpine testing repo, it probably works fine.

Is there a list of what SSE2 instructions the V8 JIT requires? We could compare them to what is already implemented to break this ticket into ā€œactionable itemsā€.

Not all of those are used, but they're all available. There's no list of which ones are actually used.

Do we have a list of what SSE/SSE2 is already implemented in iSH?

Regards,

Brandon


From: Theodore Dubois notifications@github.com
Sent: Sunday, October 27, 2019 12:40 PM
To: tbodt/ish
Cc: Brandon Ros; Comment
Subject: Re: [tbodt/ish] node/npm needs SSE (#90)

Not all of those are used, but they're all available. There's no list of which ones are actually used.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/tbodt/ish/issues/90?email_source=notifications&email_token=ACEJBFTKQSXX42FRGOBK7Q3QQXABDA5CNFSM4GDXFRO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECLCS5Y#issuecomment-546711927, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACEJBFUV6DYSR2ZE7SG6TSDQQXABDANCNFSM4GDXFROQ.

cc @MatthewMerrill

I don't have a canonical list (I should make one though). If you search for " V" (including the space) in https://github.com/tbodt/ish/blob/master/emu/decode.h that includes all the SSE stuff.

There's also https://github.com/tbodt/ish/tree/master/tests/e2e/sse2 but that's lagging behind quite a bit.

Is there any way to capitalize on the TCG portions of QEMU for these instructions?

No

@texasbruce in open source, if you want something done, you do it yourself

Sorry didn't see you were a sponsor. But not in this case, my sponsor page is just a way for you to express your appreciation.

Could SpiderNode be a workaround to this issue? SpiderNode is basically Node.js decoupled from V8 to SpiderMonkey.

Edit: Just realized that SpiderNode is dead, and also compiling from source is not easy on iSH.

@tbodt I've tried to run nodejs using https://github.com/ish-app/ish/commit/55816c8be60b85f650772a2ce0e6721ec4e8feab changes.

Now it's able to run nodejs but it can't close the process.

How to reproduce:

apk add nodejs
echo "console.log(123);" > index.js
node index.js

It prints 123 and gets stuck after that.

That's for the same reason as #472 AFAICT

I think this is pretty much done now.

Do you get the bounty?

I think so

what are you going to do with your newfound wealth

@tbodt if so, I missed there was a bounty. Happy to contribute to the windfall from this

@mattapperson You may do so at https://www.bountysource.com/issues/66159647-node-npm-needs-sse (except maybe not now since the issue is closed, I have no idea how bountysource works)

Yea it's closed now, won't let me add to the bounty. Before you claim the next one let me know? ill just back that one

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sirredbeard picture sirredbeard  Ā·  3Comments

anzhi0708 picture anzhi0708  Ā·  5Comments

tommythorn picture tommythorn  Ā·  4Comments

fernandotcl picture fernandotcl  Ā·  6Comments

wsjyhaozi picture wsjyhaozi  Ā·  4Comments