-
Notifications
You must be signed in to change notification settings - Fork 355
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
Use J2V8 with Node.js v8.x #334
Comments
I spent quite some time yesterday and today the last couple of hours to figure out the right way to build a(ny) Node 8.x version with the latest Android NDK (nightly). Just some minutes ago I've had the big breakthrough, and at least I got a Node.js build of a static lib that ran through till the end. Now the next step is to try and get CMake to correctly link to what was produced there ... so we are not done just yet. But at least for Node.js I think we might have something workable. I will keep posting updates as they roll in. PS: I am building for x86/ia32 Android |
Wow, didn't know it was that hard to build android with NodeJS 8.2.1. Great job! I can add you as a collaborator to my branch: or how do we work together on this? |
I think I will push my current progress as a new branch to my fork tomorrow. At the moment I am sorting out the CMake build ... I have already made some progress, but now I am stuck with some stdlib header problems. To elaborate ... the whole build is now using Clang and libc++ as the stdlib (this seems to be recommended for the newer NDK versions). If you try to build the latest Node.js with NDK+GCC you pretty early do hit a brick wall from what I (and others) experienced. The error that I am now getting after CMake has generated the makefiles and Clang starts compiling the J2V8 project are the following:
@DanAlbert @matiwinnetou @aschrijver any ideas 🤔 ? PS: might be the same problem as in android/ndk#452 |
You're missing the libandroid_support headers. I'd recommend using the cmake toolchain file that's in the NDK at $NDK/build/cmake/android.toolchain.cmake.
Starting with the not yet released r16, yes, but if you need a full C++11 (or newer) STL then it's your only option. |
@drywolf I wish I could help, this is too much outside of my area of expertise. Not only I don't have extensive c++ experience delicately saying but also no Android experience. |
@drywolf same here, though I am learning a lot. I have updated nodejs/node#14783 with latest findings, and I can do some test builds this weekend. |
@DanAlbert Thanks for the hint, I already dug through the mentioned issue to see that this is the problem. The r16 NDK I downloaded from the nightly builds (4280707), as mentioned here.
My own CMake toolchain file looks like this:
When I now point CMake to use the
(manually redirecting CMAKE_C_COMPILER & CXX compiler back to the standalone paths has no effect) Also the first two lines about @DanAlbert I would not expect to point back to the NDK resources after I have run Thanks |
I have now made it to a point where the android support headers seem to be included property (I took the relevant parts from the NDK cmake files), but now there is another error about the typedef for size_t missing:
|
I have managed to sort this out and also some linker errors after that, meaning I got a native j2v8 binary using Node.js 8.x for the first time ... but now comes the interesting part to see if this native library was correctly compiled so it can be loaded by the J2V8 AAR 🤞 |
Not quite yet, but I think I'm still on the right track:
@DanAlbert any idea about this one ? Where should this function come from when linking with the NDK ? |
Our toolchain file is not meant to work alongside a standalone toolchain. It's supposed to be used directly. Standalone toolchains are intended for interfacing with arbitrary build systems that are difficult to use with the NDK (autoconf, mostly). We support CMake, and that should Just Work (aside from any possible source compatibility issues with Android). Can you share your build script? Just following along here it sounds like you're headed down the wrong track and having to put in a lot of effort just to handle the NDK. That shouldn't be needed for a CMake project.
https://android.googlesource.com/platform/bionic/+/master/libc/libc.map.txt
|
I pushed my progress to an experimental branch, with the following additions for building with Node 8.x and the r16 NDK beta:
The
I think I get what you are saying there, but could you give me a hint how I could find out if that is the case. When I look at the build-scripts & configurations that I am using I can't see any origin for such a problem (mainly I'm looking at the API 17 level, which is below the platform level that I am creating the emulator from (android-19). @DanAlbert Thanks for helping. Up until now I could figure out most things myself. But for this specific error I might be out of ideas. |
Now I am trying to just use the NDK + toolchain.cmake file (based on your suggestion from above & this blog post) When I do that I get the following output, which is similar to what I already had seen during my previous attempts, but by setting the right variables at the CMake CLI at least now the platform and api-level seem to be alright.
What is strange about this error though (and I saw this before, but I thought it was just a irrelevant glitch in the path) is the double forward-slash between "toolchains" and "prebuilt". The PS: the point of the problem might be along these lines of the CMake scripts: https://github.com/Kitware/CMake/blob/0e9634d2c90fd748774f9238219cb1661550f233/Modules/Platform/Android/Determine-Compiler-NDK.cmake#L230-L232 |
@DanAlbert even if I manually correct this in CMake's installed script files and set "llvm" manually, I just return back to the point where I have to deal with missing include directories, exactly the same that I had to deal with from five posts ago. So the NDK toolchain file does really not seem to work any better than writing my own at this moment (quite the opposite actually). 🙁 |
Which CMake version are you using? If this isn't dead simple to do, that's a bug. I'll take a look on Monday if you can point me to some build instructions. |
I went back to the problem about After that, the linking problem about @matiwinnetou @aschrijver @irbull And now with those two issues fixed I was finally able to run a first unit-test class of J2V8 sucessfully with Node.js 8.4.0 ... Now I will run the full unit-test suite and see how it turns out (this will take some time, since running the ~2.5k tests in the emulator can be pretty slow), but I am already 300 tests in and so far everything ran just fine. 🎉 😄 🎉 @DanAlbert Now I need some 😴 |
@drywolf So you had success with 8.4.0 but not 8.2.1 with android? 8.4.0 already uses V8: 6.0 and I had some issues to compile this with Linux or OSX, this is the reason why I decided to try 8.2.1 for the moment. Were you successful to compile and build j2v8 against windows, osx and linux using 8.4.0 or you didn't try? |
That's right @matiwinnetou |
@drywolf any news on NodeJS 8.3.0 building with osx and linux? |
@matiwinnetou I put a table with the current results in the first post just now. I got 8.4.0 to compile on pretty much all platforms ... but something seems to be causing trouble on the native side for the Linux & MacOS platforms ... which leads to crashes while running the unit tests. I do not have much time to investigate much deeper until the weekend. |
The problems running the tests on Linux & MacOS seem to all have the same origin, which I was not able to figure out yet. |
@drywolf Sadly I never debugged with gdb sorry. So far it was not necessary, I was getting away with console.log... |
@drywolf : you 岩! |
@drywolf - from your matrix above, I understand you were able to build J2V8 with Node.js 8.4 on Windows. Care to share how you accomplished that? Even after pulling latest J2V8 sources from master, as advised elsewhere, I run into the error Build log extract:
|
@hurol02 I think the most recent parts that I added to get node 8.4.x to compile are not yet available in the repo, since I didn't want to put it on unless I could figure out the crashes on linux (see above). I will have another look over the course of the weekend and at least make the updated win32 build available under an experimental branch. As for the log above, the error PS: I just had a look at my fork, there is a branch already there that should contain the most essential commits to get 8.4.x running™ |
@drywolf Your quick update on the situation of the win32 build with Node.js 8.4 is much appreciated. VS is not available to me, so I am using Visual C++ build tools 2015 (MSBuild v14.0.25420.1) on Windows 7 64-bits... FYI, I had also tried the 32-bit build with the exact same outcome (same error on solution configuration "Release|x86"). I think somehow it is looking for a match with "Release|x64" or "Release|x32" instead, intuited from the "solution configuration file" contents. I am not familiar with Visual Studio nor MSBuild, so I am guessing: x86 must be characteristic of the Intel processor architecture, say as opposed to ARM, rather than the word length, and something looks misplaced in the parametrization of MSBuild, that perhaps passed the processor architecture keyword in place of its word length. I briefly tried to find my way through the proprietary Python build to confirm the hypothesis and perhaps fix it, but it is somewhat involved and - under pressure to find an alternate solution for my project needs - I could not spare the time to go deep, not knowing if that could be just the first of a possibly long series of issues. |
Windows x86 64-bits build from that experimental branch failed as well. BTW, for those who might want to try that as well, the build config defaults to using NodeJS 7.4.0, even in that branch. To get it to use 8.4.0 instead, you need to edit the file build_system\build_settings.py and change the NodeJS settings there as follows:
|
Hello, @drywolf, @matiwinnetou and other experts! How did you build J2V8 on Node.js 8x? I experimented with Windows and Ubuntu on different versions of Node.js from 7x to 9x and always rested on a lot of compilation errors. For example, this:
What can be done? Thank you in advance! |
I needed a branch, I compiled from my branch: https://github.com/matiwinnetou/J2V8/tree/nodejs8 I can also give you compiled versions for Linux and OSX if you trust my binaries :) |
|
I don't think anything above 8.2.x will work easily without more dramatic J2V8 changes |
Hello @matiwinnetou and thanks for the reply, could you put here a link to your binaries for Linux? Thank you in advance! |
sure, a bit of patience |
I can expose this on my private web server this evening (late evening) or mail to you simply two jar files with latest 8.x NodeJS. This could really fast then. |
@matiwinnetou (https://github.com/matiwinnetou/J2V8/tree/nodejs8)
|
It works, but it assumes certain steps, like downloading NodeJS (prepare script), having docker available... |
Without the Docker will not build at all? |
@matiwinnetou I sent an email about binaries for Linux |
I sent you an email with j2v8.tar, let me know if you got this. |
@matiwinnetou , the result:
|
Please study LibraryLoader.java a bit, you will have to change the name of *.so file in your jar file to match your distribution. Sadly you have some very weird names. @drywolf did some work there but maybe the matching algorithm does not always work. |
Alternatively you have an issue with where the *.so file is stored, you can specify working dir yourself but normally it is java temp directory. |
Hi, Eager to get my hands on a J2V8 jar that uses Node 7 or 8. As far as I can tell, none are available yet, as kinks in the cross platform built process are still being worked out? Or are there downloads available somewhere for testing purposes? Any timeline on a official release using a newer version of Node? Paul |
Hi everyone, Just wanted to check if there has been any release of J2v8 which supports nodeJs version 6.9.+ , I tried using J2v8 4.6.0 (for windows OS) and it creates a NodeJs env of 5.9.1 only. Regards, |
Oh, who has pre-compiled J2V8 with Node.js 8.0.0 and higher for Android ARMv7? I have already lost a week due to the fact that I can not compile it. I beg you, if anyone has it, post it or send it to me. Thank you in advance. |
@irbull would you be adding a v8 update / nodejs update to support async/await? Thanks for any update. |
@irbull First off, thanks for the great efforts to get fat/64-bit support in place, etc. With those issues resolved, however, I believe this is the top J2V8 issue, i.e. getting to a more recent V8. |
+1 |
When will there be a new maven package release? |
When we will be able to see the artifacts with NodeJs version 10+? |
@matiwinnetou @aschrijver @irbull
I create this issue to move the discussion about building J2V8 with Node.js v8.x over from #327
(and to avoid potential duplicate efforts)
(Android needs fixing, see this)
(same behavior as in 7.4.0)
some crash the JVM
some crash the JVM
some crash the JVM
The text was updated successfully, but these errors were encountered: