Skip to content
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

Can't build NodeJS v4.*, missing libuv #219

Closed
etiago opened this issue Apr 18, 2016 · 10 comments
Closed

Can't build NodeJS v4.*, missing libuv #219

etiago opened this issue Apr 18, 2016 · 10 comments

Comments

@etiago
Copy link

etiago commented Apr 18, 2016

Hi @fornwall ,

Thanks for the great work you're doing with Termux!

I've been trying to get NodeJS's LTS version (v4 branch) to compile under the provided Docker image but unfortunately I've hit a roadblock.

To start with I made a copy of the current NodeJS folder and I changed the version to 4.4.3 in the TERMUX_PKG_VERSION, plus I removed all the patches since they were probably going to fail anyway. I was planning on manually readjusting the patches to match the 4.4.3's sources.

However, after starting the compilation via the build-package.sh as instructed, here's what I eventually get:

In file included from ../src/debug-agent.cc:22:0:
../src/debug-agent.h:27:16: fatal error: uv.h: No such file or directory
 #include "uv.h"
                ^
compilation terminated.
In file included from ../src/env.h:5:0,
                 from ../src/env.cc:1:
../src/debug-agent.h:27:16: fatal error: uv.h: No such file or directory
 #include "uv.h"
                ^
node.target.mk:143: recipe for target '/root/termux/nodejs-lts/src/out/Release/obj.target/node/src/debug-agent.o' failed
make[1]: *** [/root/termux/nodejs-lts/src/out/Release/obj.target/node/src/debug-agent.o] Error 1
make[1]: *** Waiting for unfinished jobs....
compilation terminated.
node.target.mk:143: recipe for target '/root/termux/nodejs-lts/src/out/Release/obj.target/node/src/env.o' failed
make[1]: *** [/root/termux/nodejs-lts/src/out/Release/obj.target/node/src/env.o] Error 1
In file included from ../src/env.h:5:0,
                 from ../src/base-object-inl.h:5,
                 from ../src/async-wrap-inl.h:6,
                 from ../src/async-wrap.cc:2:
../src/debug-agent.h:27:16: fatal error: uv.h: No such file or directory
 #include "uv.h"
                ^
compilation terminated.
node.target.mk:143: recipe for target '/root/termux/nodejs-lts/src/out/Release/obj.target/node/src/async-wrap.o' failed
make[1]: *** [/root/termux/nodejs-lts/src/out/Release/obj.target/node/src/async-wrap.o] Error 1
make[1]: Leaving directory '/root/termux/nodejs-lts/src/out'
Makefile:45: recipe for target 'node' failed
make: *** [node] Error 2

Basically it seems I'm missing the libuv package... I tried to apt-get it (libuv-dev) but I keep getting the same thing, which I think it makes sense since we're cross-compiling.

Maybe you have some ideas to set me off in the right direction? I would be more than happy to maintain this package going forward as it's nice to have a package for the LTS releases of Node. I need it myself and maybe others find it useful too 😄

Thanks in advance!

@fornwall
Copy link
Member

You need to build the dependencies openssl and libuv in the build environemt first. Something like:

./build-package.sh openssl
./build-package.sh libuv
./build-package.sh path-to-your-nodejs-lts-folder

Let me know how this works for you!

You maintaining a nodejs-lts package would be great! You can use that build-package.sh takes a folder path to point to your local package folder containing build scripts and patches in order to have it under version control.

There has been no additional repo for Termux except the official one at https://termux.net, so it would be very interesting to have one setup! I guess https://bintray.com/ could be a nice way to maintain an external apt repo with .deb packages for most people (if you don't want to do it manually on a server of your own).

@etiago
Copy link
Author

etiago commented Apr 18, 2016

A-ha! I'll give this a try tomorrow. I wasn't aspiring to start my own repo... I was thinking more along the lines of submitting it (and every other update to the LTS package) as a pull request. Or perhaps you want to keep your repo to only contain packages ported/compiled by you? I'll also give BinTray a look, maybe that's also good enough 👍

@fornwall
Copy link
Member

I wasn't aspiring to start my own repo... I was thinking more along the lines of submitting it (and every other update to the LTS package) as a pull request. Or perhaps you want to keep your repo to only contain packages ported/compiled by you?

As the number of packages starts to grow, it would be great as a way forward to start having third-party repos for Termux if people are interested in maintaining them! This would increase scalability by distributing code, issue and builds across multiple maintainers.

Hopefully a small "how to setup a third-party apt repo for Termux" could be written, and scripts be added to easily upload a locally built deb do bintray (I started with https://github.com/termux/termux-packages/blob/master/scripts/bintray-upload-deb, but it's not yet tested).

You are of course also welcome to submit a pull request for a package without hosting it yourself! For big packages you can start by adding it to the disabled-packages folder, since packages there are not built and uploaded to the apt repo by default, allowing time for people to test it out first.

@etiago
Copy link
Author

etiago commented Apr 19, 2016

Okay so I managed to actually go all the way through, readjust all the patches for Node v4.4.3 and build the package. Now, however, I am producing ARM 32 bit packages. Also when I looked in the build script, it says that 64 bit builds are not supported for now.

Is that really so? I saw that in your repos I'm getting proper 64 bit packages in my OnePlus Two... is there any trick to build the ARM64 packages?

@fornwall
Copy link
Member

@etiago Thanks, I've updated the comment in the build script! The three supported arches in Termux for now are arm, aarch64 and i686.

Just export export TERMUX_ARCH=aarch64 to build packages for 64-bit arm!

@etiago
Copy link
Author

etiago commented Apr 19, 2016

@fornwall thanks for the quick response!

I've followed your suggestion and managed to build the package for aarch64... however... when I try to install it in my phone, I get the following:

dpkg -i nodejs-lts_4.4.3_aarch64.deb
dpkg-split: error: unable to read part file 'nodejs-lts_4.4.3_aarch64.deb': Permission denied
dpkg:/home/fornwall/termux/dpkg/src/src/unpack.c:123:deb_reassemble: internal error: unexpected exit status 2 from dpkg-split
Aborted

Any idea what am I doing wrong? The file has the right user and I've even chmod'ed it to 777 just to be sure but still no dice...

@fornwall
Copy link
Member

Can you upload the nodejs-lts_4.4.3_aarch64.deb and link to it so I can try it?

@etiago
Copy link
Author

etiago commented Apr 19, 2016

Here it is. Interestingly enough when I try to manually download the nodejs v5 deb from your repos and manually install it, I get the same error... I wonder if it's something with dpkg...?

nodejs-lts_4.4.3_aarch64.deb.zip

@etiago
Copy link
Author

etiago commented Apr 19, 2016

Update: the issue seems to be with permissions... I used some hacks to download the file and then copy it into Termux's space and that seems to have messed with the file.

I can now install it :D now I just need to fix an additional reference to /tmp and it should be good to go!

@etiago
Copy link
Author

etiago commented Apr 20, 2016

Hey @fornwall!

I managed to get nodejs compiled and good to go. The only thing with nodejs is that even though I patched the install.sh script, because nodejs comes by default with npm v2, when we update to npm v3 we have again hardcoded references to /tmp which Android doesn't agree with. This is easily mitigated though by setting the env var TMPDIR to point to Termux's tmp path.

In any case, I've given bintray a try and just when I was trying to upload the deb files I got a message saying that perhaps they are malformed... so I'm inclined to give up on having my own repo due to too much hassle just to maintain one package 😄

If you are interested, I uploaded the .sh file and the patches to a repo of my own. You can find it here: https://github.com/etiago/termux-nodejs-lts . If you like you can just download it and use it directly, feel free to do with it whatever you want 😉 in the future I will probably keep updating it with the LTS versions of node, so you could also add it as a submodule of this repo if you feel like it.

It's nice to be able to use Node v4 😄 now feel free to provide it as part of Termux as well!

@etiago etiago closed this as completed May 21, 2016
@termux termux locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants