GithubHelp home page GithubHelp logo

jxcore / jxcore-addon Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 4.0 201 KB

JXcore native addon sample with multiple JavaScript engine support

License: MIT License

C++ 54.91% Python 34.49% JavaScript 10.60%

jxcore-addon's Introduction

Evented I/O for (Chakra, SpiderMonkey, V8, and..) JavaScript

JXcore extends Node.JS™ with additional features for developing mobile and embedded applications using JavaScript and leveraging the Node ecosystem.

Master build status: Build Status

Important Notice:

Nubisa halting active development on JXcore platform

You may alternatively try https://github.com/janeasystems/nodejs-mobile

Features include

  • Support for core Node.JS features
  • Embeddable Interface
  • Publish to Mobile Platforms (Android, iOS ..)
  • Supports Multiple JavaScript Engines
  • Multi-threading Capabilities
  • Process Configuration & Monitor
  • In-memory File System
  • Application Packaging
  • Support for the latest JavaScript features (ES6, ASM.JS ...)
  • Support for Universal Windows Platform (uwp) api

Which architectures are supported

  • ARMV7, ARMV7a, ARMv8 (64 bit**)
  • MIPS
  • ia32, X64

Coming soon;

  • Power7, Power8, MIPS (64 bit)

Which platforms are supported

  • Android 2.3+
  • CyanogenMod 10+
  • iOS 6+
  • Windows XP+
  • Various Linux Distributions (Debian, Fedora, Suse, OpenWRT, Gentoo ...)
  • BSD
  • OSX

Test environment

  • Ubuntu 14 LTS VM
  • Debian 7 VM, Ci20(mips), RP B+(arm), RP 2(arm), VM(osuosl - power8)
  • Udoo (arm + arduino)
  • FreeBSD 10 VM
  • Windows 7 x64, 8.1 x64
  • OSX 10.9, 10.10
  • Android 2.3 Samsung ACE
  • Android 3.x Samsung Galaxy Tab2
  • Android 4.x Huawei G510 /LG G2 / HTC 820(armv8) / Dell Venue 7 / Ci20(mips)
  • Android 5.x Nexus 5 / Nexus 6 / S6
  • Cyanogen 11+ one plus one
  • iOS 6.x iPhone 4s
  • iOS 7.x iPad Mini 2nd, IPhone 5s
  • iOS 8.x iPhone 6
  • OpenWRT VM, Yun(mips)

Roadmap

See Roadmap document.

To build:

See How to Compile document.

To install:

If you don't want to build JXcore by yourself, you can use pre-compiled binaries. See Installation document.

Start hacking the native core:

Macro API is available from here

To run the tests:

See Testing document.

JXcore Contributors

Our hardworking contributors are available from here
Would you like to be one of them? Fork, Hack, and send a Pull Request.

Node.JS authors list:

List of Node.JS contributors can be found from here

** compatibility mode

jxcore-addon's People

Contributors

obastemur avatar plika avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jxcore-addon's Issues

V8: running the sample fails

Building and running the sample against JXcore SM build works ok.

However for V8 (the latest build from jxcore master) jx test.js generates this output:

dyld: lazy symbol binding failed: Symbol not found: __ZN5MozJS5Value17SetStaticFunctionEPKcPFbP9JSContextjPN2JS5ValueEEt
  Referenced from: /Users/nubisa_krzs/Documents/temp/_obastemur/jxcore-addon/build/Release/binding.node
  Expected in: dynamic lookup

dyld: Symbol not found: __ZN5MozJS5Value17SetStaticFunctionEPKcPFbP9JSContextjPN2JS5ValueEEt
  Referenced from: /Users/nubisa_krzs/Documents/temp/_obastemur/jxcore-addon/build/Release/binding.node
  Expected in: dynamic lookup

Trace/BPT trap: 5

SM: Installing jxcore-addon fails on Ubuntu and RedHat

Once I type jx install (SM) in addon's directory, I get :

/home/azureuser/.node-gyp/jxb304/src/jscpucfg.h:101:3: 
error: #error "Cannot determine endianness of your platform. Please add support to jscpucfg.h."
make: *** [Release/obj.target/binding/binding.o] Error 1

Fails on Ubuntu and RedHat.
Works on OSX and Suse.

dyld lazy symbol binding fails

I am trying to get the basic examples for JXCore addons to work on Max OS X v10.10.2. I have tried both the example posted on github ( https://github.com/jxcore/jxcore-addon ) and the first example posted here ( http://jxcore.com/docs/addons.html ). In both cases I receive 5 warnings after running 'jx install', but the build/Release/binding.node dylib is generated. When I separately run 'node-gyp configure' and 'node-gyp build', the example on github does not compile on account of some errors, while the example in the jxcore docs compiles without even warnings.

However, in both cases there is a problem with exported symbols, e.g.:

dyld: lazy symbol binding failed: Symbol not found: __ZN5MozJS5Value11FromIntegerEP9JSContexti

While the binding.node file does contain the following symbols (among many others):

__ZN4node7commons21getInstanceByThreadIdEi__ZN5MozJS12EngineHelper12CreateObjectEP9JSContextPKcPNS_5ValueE__ZN5MozJS14ThrowExceptionC1ENS_9Exception5ErrorE__ZN5MozJS5Value11FromIntegerEP9JSContexti__ZN5MozJS5Value11SetPropertyEPKcN2JS6HandleINS3_5ValueEEE__ZN5MozJS5Value17SetStaticFunctionEPKcPFbP9JSContextjPN2JS5ValueEEt

the symbol in question is indeed undefined (as confirmed by nm).

In the case of the example on the documentation page I have had similar results, with the difference that the undefined symbol referred to String::NewSymbol() and String::New().

Based on this experience, I have tried modifying the binding.gyp files a bit, by adding: 'OTHER_LDFLAGS': ['-ljx']
(hoping that libjx.dylib would contain the missing symbols)

In this case, the example on the docs page still fails with the same linker problem, while the example on github yields

TypeError: binding.sum is not a function (/Users/csapoadam/Documents/Development/Cpp/JXCore/AddonOnlineExample/test.js 3:25)
at (/Users/csapoadam/Documents/Development/Cpp/JXCore/AddonOnlineExample/test.js:3:26)

I've previously installed both the static, dynamic libraries for JXCore, as well as the executable version (all for the SpiderMonkey engine). Basic examples for embedded JXCore in C++ are running without a problem.

Thank you in advance.

Building jxcore-addon on Windows fails with unresolved external symbol errors

I am having problems with the basic example given here ( https://github.com/jxcore/jxcore-addon ) on Windows 7. I download the precompiled jx binary and put it on the path, then I extract the addon-master folder, and run 'jx install' inside it. Regardless of whether I try using the jx executable built for SpiderMonkey or V8, I get the linker errors. In the case of SM, the linker is missing 27 symbols, while in the case of V8, 20 symbols.

Here is an example:

scr

I have tried adding jx.lib to the path, as well as to the same folder with the addon sources, with no success.

Requiring jxcore addon from "embedded" C++ mechanism works on Mac but not on Windows

I am trying to run embedded javascript code within a C++ program (like in the project here https://github.com/obastemur/JXcoreWindowsEmbedded ). This works fine on both Mac and Windows unless the code uses require to import a previously compiled jxcore addon - in which case it only works on Mac (but not Windows).

For example, if I have a .js file that has:

var binding = require('./build/Release/binding');
console.log("1 + 2 = " + binding.sum(1,2));

(where binding is the addon I created), and run this through the jx interpreter, then I have the desired result. But if in C++, I do:

std::stringstream ss;
ss << "console.log("Adding 1 and 2 together "); \n";
ss << "var binding0 = process.requireGlobal('./build/Release/testadd'); \n";
ss << "var binding1 = process.requireGlobal('./build/Release/binding'); \n";
ss << "console.log(binding1.sum(1,2)); \n";
JX_Evaluate(ss.str().c_str(), "myscript", &result);

I get an invalid memory access error during runtime. Note that testadd.js is a simple js script that adds the two numbers together without using the binding addon. Thus, the above example only fails when requiring the addon. If I require the addon in the separate script (for example, inside testadd.js), the code still fails. The error message is as follows:

Error: invalid access to memory location
c:\users\adam\desktop\development\maxwhere-tests\build\release\binding.node (nat
ive:jxcore_js_object 3:11)
at (native:jxcore_js_object:3:12)
at process.dlopen (node.js:638:17)
at Module.prototype.load (module.js:347:7)
at Module._load (module.js:314:5)
at Module.prototype.require (module.js:379:10)
at require (module.js:397:12)
at myscript:3:16

Do you know what causes this? I am using the SM version on Windows7 (compiled with VS2012). The same example works on Mac.

Can't build on Windows

Hi, I'm trying to build this on windows without success. One possible problem is that I'm trying to force Visual Studio 2013 with --msvs_version=2013 and it seems to use the correct MSBuild (C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe) but it then uses the 2010 linker (C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe). I've just re-synced jxcore and re-downloaded jxb300. I'm building ia32 on a 64-bit machine. The error is LNK2001: unresolved external symbol "public: static class node::commons * __cdecl node::commons::getInstanceByThreadId(int)" (?getInstanceByThreadId@commons@node@@SAPAV12@H@Z)
This is the full output:

> jx.exe install --verbose --msvs_version=2013 --arch=ia32
npm info it worked if it ends with ok
npm verb cli [ 'C:\\Users\\zamb3zi\\Documents\\devel\\bin\\jx.exe',
npm verb cli   'C:\\Users\\zamb3zi\\.jx\\npm',
npm verb cli   'install',
npm verb cli   '--verbose',
npm verb cli   '--msvs_version=2013',
npm verb cli   '--arch=ia32' ]
npm info using [email protected]
npm info using [email protected]
npm info using jxcore@v Beta-0.3.0.1
npm WARN invalid config local-address=undefined
npm WARN package.json [email protected] No repository field.
npm verb readDependencies using package.json deps
npm verb install where, deps [ 'C:\\GitHub\\jxcore-addon', [] ]
npm info preinstall [email protected]
npm verb readDependencies using package.json deps
npm info build C:\GitHub\jxcore-addon
npm verb linkStuff [ false, false, false, 'C:\\GitHub' ]
npm info linkStuff [email protected]
npm verb linkBins [email protected]
npm verb linkMans [email protected]
npm verb rebuildBundles [email protected]
npm info install [email protected]


> [email protected] install C:\GitHub\jxcore-addon
> node-gyp configure build

-
C:\GitHub\jxcore-addon>jx "C:\Users\zamb3zi\.jx\npm\bin\node-gyp-bin\\..\..\node_mo
dules\node-gyp\bin\node-gyp.js" configure build
gyp info it worked if it ends with ok
gyp verb cli [ 'jx',
gyp verb cli   'C:\\Users\\zamb3zi\\.jx\\npm\\node_modules\\node-gyp\\bin\\node-gyp
.js',
gyp verb cli   'configure',
gyp verb cli   'build' ]
gyp info using [email protected]
gyp info using [email protected] | win32 | ia32
gyp verb command configure []
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Anaconda\python.EXE
gyp verb check python version `python -c "import platform; print(platform.python
_version());"` returned: "2.7.5\r\n"
gyp verb get node dir no --target version specified, falling back to host node v
ersion: v0.10.38
gyp verb command install [ 'v0.10.38' ]
gyp verb install input version string "v0.10.38"
gyp verb install installing version: jxb300
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: jxb300
gyp verb build dir attempting to create "build" dir: C:\GitHub\jxcore-addon\buil
d
gyp verb build dir "build" dir needed to be created? null
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: C:\GitHub\jxcore-addon\build
\config.gypi
gyp verb config.gypi checking for gypi file: C:\GitHub\jxcore-addon\config.gypi
gyp verb common.gypi checking for gypi file: C:\GitHub\jxcore-addon\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn python
gyp info spawn args [ 'C:\\Users\\zamb3zi\\.jx\\npm\\node_modules\\node-gyp\\gyp\\g
yp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\GitHub\\jxcore-addon\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\zamb3zi\\.jx\\npm\\node_modules\\node-gyp\\addon.
gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\zamb3zi\\.node-gyp\\jxb300\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\zamb3zi\\.node-gyp\\jxb300',
gyp info spawn args   '-Dmodule_root_dir=C:\\GitHub\\jxcore-addon',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\GitHub\\jxcore-addon\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture ia32
gyp verb node dev dir C:\Users\zamb3zi\.node-gyp\jxb300
gyp verb found first Solution file build/binding.sln
gyp verb could not find "msbuild.exe" in PATH - finding location in registry
gyp verb "Release" dir needed to be created? null
verb copying "node.lib" for ia32 C:\Users\zamb3zi\.node-gyp\jxb300\Release\node.lib

gyp info spawn C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=Win32' ]
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
Build started 27/05/2015 16:36:49.
Project "C:\GitHub\jxcore-addon\build\binding.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|Win32".
Project "C:\GitHub\jxcore-addon\build\binding.sln" (1) is building "C:\GitHub\j
xcore-addon\build\binding.vcxproj" (2) on node 1 (default targets).
InitializeBuildStatus:
  Touching "Release\obj\binding\binding.unsuccessfulbuild".
ClCompile:
  All outputs are up-to-date.
Link:
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREP
  ORT:QUEUE /OUT:"C:\GitHub\jxcore-addon\build\Release\binding.node" /INCREMENT
  AL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib adv
  api32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib DelayImp.lib
   "C:\Users\zamb3zi\.node-gyp\jxb300\Release\node.lib" /MANIFEST /ManifestFile:"R
  elease\obj\binding\binding.node.intermediate.manifest" /MANIFESTUAC:"level='a
  sInvoker' uiAccess='false'" /DEBUG /PDB:"C:\GitHub\jxcore-addon\build\Release
  \binding.pdb" /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHIN
  E:X86 /DLL Release\obj\binding\binding.obj
     Creating library C:\GitHub\jxcore-addon\build\Release\binding.lib and obje
  ct C:\GitHub\jxcore-addon\build\Release\binding.exp
binding.obj : error LNK2001: unresolved external symbol "public: static class n
ode::commons * __cdecl node::commons::getInstanceByThreadId(int)" (?getInstance
ByThreadId@commons@node@@SAPAV12@H@Z) [C:\GitHub\jxcore-addon\build\binding.vcx
proj]
C:\GitHub\jxcore-addon\build\Release\binding.node : fatal error LNK1120: 1 unre
solved externals [C:\GitHub\jxcore-addon\build\binding.vcxproj]
Done Building Project "C:\GitHub\jxcore-addon\build\binding.vcxproj" (default t
argets) -- FAILED.

Done Building Project "C:\GitHub\jxcore-addon\build\binding.sln" (default targe
ts) -- FAILED.


Build FAILED.

"C:\GitHub\jxcore-addon\build\binding.sln" (default target) (1) ->
"C:\GitHub\jxcore-addon\build\binding.vcxproj" (default target) (2) ->
(Link target) ->
  binding.obj : error LNK2001: unresolved external symbol "public: static class
 node::commons * __cdecl node::commons::getInstanceByThreadId(int)" (?getInstan
ceByThreadId@commons@node@@SAPAV12@H@Z) [C:\GitHub\jxcore-addon\build\binding.v
cxproj]
  C:\GitHub\jxcore-addon\build\Release\binding.node : fatal error LNK1120: 1 un
resolved externals [C:\GitHub\jxcore-addon\build\binding.vcxproj]
/
    0 Warning(s)
    2 Error(s)

Time Elapsed 00:00:02.40
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail
ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\zamb3zi\.jx\npm\node_modules\no
de-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:85:15)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:815:
12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "jx" "C:\\Users\\zamb3zi\\.jx\\npm\\node_modules\\node-gyp\\bin\\n
ode-gyp.js" "configure" "build"
gyp ERR! cwd C:\GitHub\jxcore-addon
gyp ERR! node -v v0.10.38
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
-
npm verb unsafe-perm in lifecycle true
npm info [email protected] Failed to exec install script
npm ERR! [email protected] install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the jxcore-addon package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls jxcore-addon
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Users\\zamb3zi\\Documents\\devel\\bin\\jx.exe" "C:\\Users\\Jo
hn\\.jx\\npm" "install" "--verbose" "--msvs_version=2013" "--arch=ia32"
npm ERR! cwd C:\GitHub\jxcore-addon
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.14
npm ERR! code ELIFECYCLE
npm verb exit [ 1, true ]
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\GitHub\jxcore-addon\npm-debug.log
npm ERR! not ok code 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.