Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Create native executable for macos #973

Closed
mikeptweet opened this issue Dec 6, 2022 · 1 comment
Closed

Create native executable for macos #973

mikeptweet opened this issue Dec 6, 2022 · 1 comment

Comments

@mikeptweet
Copy link

Is it possible to create a native executable using this SDK? I want to create a simple websocket client in Javascript that runs in a mac terminal.

@phoddie
Copy link
Collaborator

phoddie commented Dec 6, 2022

Welcome!

The Moddable SDK is primarily for building executables for microcontrollers, not computers. We do build and run executables on computers for our simulator (mcsim) and for many of our tools (mcconfig is written in JavaScript and executed by our XS JavaScript engine). We have limited support for building command line tools.

A good place to start is the the JavaScript REPL example at $MODDABLE/examples/js/repl. To run that on macOS, set-up the Moddable SDK and then:

cd $MODDABLE/examples/js/repl
mcconfig -m -p x-cli-mac
repl

Note a couple things:

  • The build target is "x-cli-mac" instead of "mac" or "sim" to indicate that this will run on the command line
  • This is a release build (no "-d") to avoid having debugger output in the REPL
  • On some versions of macOS you may need to remove -lpng16 from the the x-cli-mac makefile or you will get a linker error (yes, we should fix that)

When it starts up, you should see something like:

Moddable JavaScript REPL v0.0.5
  XS engine v13.2.0
  ? for help

> 

Use .help to see the list of installed commands. You can use the CLI class to add commands to the REPL.

Here's the bad news: the REPL does not currently support network operations. Adding that is possible, but not trivial. The REPL does support network operations on embedded devices, like the ESP32 MCU. There is an outstanding PR from @cmidgley that might be helpful here.

@Moddable-OpenSource Moddable-OpenSource locked and limited conversation to collaborators Dec 6, 2022
@phoddie phoddie converted this issue into discussion #974 Dec 6, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants