NerdLang / nerd

🔱 Javascript's God Mode. No VM. No Bytecode. No GC. Just native binaries.
https://nectarjs.com
MIT License
3.58k stars 126 forks source link

Does it work on macos? #22

Closed p3k closed 6 years ago

p3k commented 6 years ago

I am confused how to compile or run anything with NectarJS on macos 10.13.2 (17C88)…

# nectar -v
NectarJS Client v0.0.53

# nectar example.js
[!] Bad target

[*] Available targets :
-> win-x86-32
-> win-x86-64
-> linux-x86-32
-> linux-x86-64
-> linux-arm32v7
-> arduino-uno
-> arduino-mega1280
-> arduino-mega2560
-> wasm
-> wast
-> asm-js

# cat project.json
{"main": "example.js", "out": "example.asm.js", "target":"asm-js", "preset":"speed"}

# nectar --target asm-js example.js
Missing project.json

Note: I am using MacPorts, could this affect compilation?

# port select --summary
Name        Selected           Options
====        ========           =======
gcc         mp-gcc49           none
llvm        mp-llvm-3.5        none
adrien-thierry commented 6 years ago

It works, I have to add compile option for MacOS

p3k commented 6 years ago

um, in the meantime i tried it on a linux machine with similar problems:

# uname -morp && lsb_release -d
4.4.0-112-generic x86_64 x86_64 GNU/Linux
Description:    Ubuntu 16.04.3 LTS

# nectar --example
[+] Copy of arduino.js done
[+] Copy of bad.js done
[+] Copy of bool.js done
[+] Copy of c/test.c done
[+] Copy of c_interface.js done
[+] Copy of child_process.js done
[+] Copy of fibo.js done
[+] Copy of fiboit.js done
[+] Copy of fs.js done
[+] Copy of http_demo.js done
[+] Copy of log.ts done
[+] Copy of loop.js done
[+] Copy of example.js done
[+] Copy of object.js done
[+] Copy of operation.js done
[+] Copy of print.py done
[+] Copy of protoclass.js done
[+] Copy of require.js done
[+] Copy of source.js done
[+] Copy of string.js done

# nectar example.js
Missing project.json

# cat project.json 
{"main": "example.js", "out": "example-linux-x86-64.bin", "target":"linux-x86-64", "preset":"speed"}

# nectar example.js
Missing project.json

shouldn’t this work?

adrien-thierry commented 6 years ago

It should, I've just tried on my debian and it works well

p3k commented 6 years ago

i see. any suggestions what i could try to make it work for me, too? could i check / provide any configuration settings or the like?

adrien-thierry commented 6 years ago

Could you give me your NodeJS version ?

p3k commented 6 years ago
# node -v
v8.9.4
ilearnio commented 6 years ago

This project looks promising! But I can't test it. When can we expect it to work on macOS?

ilearnio commented 6 years ago

I also have the same error "Missing project.json" even though I have it. See video http://take.ms/Jhh71

adrien-thierry commented 6 years ago

Thank you ilearnio, we will work soon on MacOS compatibilty

adrien-thierry commented 6 years ago

Mac OS X compilation is now supported

glockjt commented 6 years ago

Just tried running the example on mac and getting this error

{ Error: Command failed: ./file-mac-osx.bin
dyld: Symbol not found: __ZTTNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE
  Referenced from: /Users/jglock/personal-repo/test-nectarjs/./file-mac-osx.bin
  Expected in: /usr/lib/libstdc++.6.0.9.dylib
 in /Users/jglock/personal-repo/test-nectarjs/./file-mac-osx.bin

    at ChildProcess.exithandler (child_process.js:275:12)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:557:12)
  killed: false,
  code: null,
  signal: 'SIGABRT',
  cmd: './file-mac-osx.bin' }

any help would be greatly appreciated!

adrien-thierry commented 6 years ago

Hi,

Could you try again ?

glockjt commented 6 years ago

Worked. What fixed it?

adrien-thierry commented 6 years ago

Static linking

I tried to optimize binary size by linking parts of libs, but I need to take more time