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

Install node 32bits in Ubuntu 64bits #672

Open
dnoliver opened this issue Feb 20, 2015 · 12 comments
Open

Install node 32bits in Ubuntu 64bits #672

dnoliver opened this issue Feb 20, 2015 · 12 comments
Labels
feature requests I want a new feature in nvm! installing node Issues with installing node/io.js versions. pull request wanted This is a great way to contribute! Help us out :-D

Comments

@dnoliver
Copy link

Is there a way to install an specific node arch (32|64) with nvm, in a 64 bits OS?

@ljharb
Copy link
Member

ljharb commented Feb 20, 2015

Any extra parameters that ./configure would take for a node or iojs install can be passed to nvm install -s - if any of those select an architecture that should work fine.

If that doesn't work, you could overwrite the nvm_get_arch function prior to nvm install-ing something, but I don't recommend that approach.

@am11
Copy link

am11 commented Mar 27, 2015

@ljharb, it seems like --dest-cpu=ia32 does not work with nvm install .. for released node.js/io.js versions.

Over at node-sass, we build eight binaries for Linux (x64, ia32), four for Mac (only x64) and eight Windows (x64 and ia32). In future, we are going to add FreeBSD and Solaris in our matrix.

So we have scribbled down the build steps in Dockerfile in order to automate our build process: https://gist.github.com/am11/1529b2458b1a1f4bdba8. As you can see from line 61 to 91, we have to manually download, extract and move gzip files for ia32 variants on CentOS x64 for our indented matrix.

On the contrary, for Windows, nvmw has this option to supply arch as a parameter:

nvmw install iojs-v1.6.2 x86  :: or x32, both work

and then use it like

nvmw use iojs-v1.6.2 x86  :: or x32, both work

It would be really useful for folks building binaries for varied versions of io.js/node.js, if you guys consider adding the architecture as an explicit option like nvmw, since both io.js and node.js provide binaries for 32-bit arch.

Thanks in anticipation.

@ljharb
Copy link
Member

ljharb commented Mar 28, 2015

All additional arguments are passed when installing from source - try nvm install -s iojs --dest-tcu=ia32?

By default, nvm install installs from a binary, and indeed does not allow you to override the architecture.

@am11
Copy link

am11 commented Mar 28, 2015

@ljharb, here is the output:

cd ~/.nvm
git pull --rebase origin master
Fast-forwarded HEAD to 70370a857f0bc16af50f4196afe9af03b100535e.
cd /tmp
nvm install -s iojs --dest-tcu=ia32
# Installing iojs from source is not currently supported

Seems like compiling from source is not supported?

On a related note, is it possible to get a specific version of node.js/io.js (v0.12, v0.10 and v1.0, v1.6)?

@ljharb
Copy link
Member

ljharb commented Mar 29, 2015

@am11 Ah yes, I still haven't gotten iojs source support in yet. Try nvm install -s node --dest-tcu=ia32 and see if that works?

nvm supports many forms of versions - 0.12, v0.12, 0.12.0, v0.12.0, node, iojs, stable, unstable, iojs-v1.0, iojs-1.6, etc. Ideally you should be able to type what you want and get it in an intuitive fashion :-)

@am11
Copy link

am11 commented Mar 29, 2015

That started to work with dest-cpy, but then it failed during ./configure with:

/usr/include/linux/errno.h:4:23: fatal error: asm/errno.h: No such file or directory
compilation terminated.
...
make: *** [node] Error 2
nvm: install v0.12.1 failed!

It must be a temporary issue, but it seems like it will compile the whole node.js? Oh this is brilliant, but nvm being the fast version switching machine, this is not what I was looking for. :)

Having an explicit option like nvmw for arch (only ia32 on x64, the other way around throws error) helps especially the folks using C++ module, to quickly test and build for cross arch (x64, ia32), cross runtime (node, iojs, atom-shell etc.). Note nvmw is just altering the dist. URL strings to accomplish this. Even though ia32 arch is becoming less popular in OS'es and is less convincing for devs, but some people have deliberately installed ia32 node.js/io.js on x64 and there exist some real use-cases such as node-sass.

Kindly reconsider your stance on this one. 8-)

@ljharb
Copy link
Member

ljharb commented Mar 30, 2015

I haven't made a stance yet :-) Note that nvmw is for Windows, and different binaries might be available - can you point me to the build file that you want to download, and the one that you are currently downloading, when running nvm install 0.12 here?

@am11
Copy link

am11 commented Mar 30, 2015

Ok, I am on x64 Linux. When running nvm install 0.12 it should download https://nodejs.org/dist/v0.12.1/node-v0.12.1-linux-x64.tar.gz, which it does.

Now on the same system, I would like to be able to run nvm install 0.12 ia32 or nvm install 0.12 x86, to be able to install 32-bit binary: https://nodejs.org/dist/v0.12.1/node-v0.12.1-linux-x86.tar.gz. I would like nvm to store it as versions/node/v0.12.1-x86 and let me use it in future as nvm use 0.12 ia32. Which means both ia32 and x64 variants of same versions can co-exist.

Same goes for io.js https://iojs.org/dist/latest/.

The nvmw reference was just to say that normally all their features are inspired by nvm, but this one is different (hakobera/nvmw#41), so nvm can probably take at least one inspiration from nvmw. 😃

@ljharb
Copy link
Member

ljharb commented Mar 30, 2015

Hmm - ok, so I can definitely easily add an install option for binary installs that, only when on an x64 arch, selects the x86 arch instead.

However, it would add a lot of complexity to have a secondary version identifier, or a modified version identifier (it took an insane amount of work to allow for iojs--prefixed versions to coexist alongside node versions and still work with all the same functionality). In order to allow both 64 bit and 32 bit to coexist, I'd need to add a third prefix, so it'd be like nvm use x86-0.12, and support that only on x64 architectures. I'm very hesitant to add that much complexity for the (seemingly at this point) very tiny use case of "binary module developers on 64 bit systems", especially when something like https://www.npmjs.com/package/nan already exists to smooth over these types of issues.

If a binary install architecture override feature would be helpful, I'd be happy to review a PR, or accept a new issue filed, to add that feature. I'll leave this issue open as a feature request for the full "32bit and 64bit simultaneously", but before adding it, I'd need to both become convinced that it wouldn't add much complexity (via a PR, or inspiration, or a convincing argument), and also that there's a large audience of people this feature would help.

@ljharb ljharb added installing node Issues with installing node/io.js versions. feature requests I want a new feature in nvm! needs followup We need some info or action from whoever filed this issue/PR. labels Mar 30, 2015
@am11
Copy link

am11 commented Mar 30, 2015

Thanks for the detailed response.

Regarding nan, we are using it all over the place to build our binding with libsass. But it does not provision nvm like ability to switch the runtime-arch. It only builds the binary for the current runtime-arch of running node.js process. (runtime = io.js/node.js in this context).

Question: Would it be possible to pass architecture as an argument, instead of a prefix? I agree prefix way would introduce complexity. So perhaps nvm install 0.10 --arch x86 would do the trick?

@ljharb
Copy link
Member

ljharb commented Mar 30, 2015

That's exactly how I'd implement the simple install architecture override - but to allow that to work with nvm use, nvm alias, .nvmrc, nvm run, nvm exec, etc, so they could coexist, is the complexity I'm concerned about.

@ljharb ljharb added pull request wanted This is a great way to contribute! Help us out :-D and removed needs followup We need some info or action from whoever filed this issue/PR. labels Jun 25, 2016
@kornpow
Copy link

kornpow commented Dec 11, 2017

I am also interested in functionality like this. I am running the Resin.io service, which is like docker for raspberry pi, and they cross compile my dockerfile and then load up an image onto my raspberry pi. It could be resin's fault too, but nvm install in this "cross-compile" mode tries grabbing armv8, which my Pi isnt, and then tries compiling from source, which takes a long time. Being able to specify architecture would be really nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature requests I want a new feature in nvm! installing node Issues with installing node/io.js versions. pull request wanted This is a great way to contribute! Help us out :-D
Projects
None yet
Development

No branches or pull requests

4 participants