node.js on mac in 32 bit mode? - node.js

For the app.js I need to have my node.js in 32 bit mode.
node me$ file `which node`
/usr/local/bin/node: Mach-O universal binary with 2 architectures
/usr/local/bin/node (for architecture i386): Mach-O executable i386
/usr/local/bin/node (for architecture x86_64): Mach-O 64-bit executable x86_64
node me$
Does this mean, that it is installes in two executable versions(32 and 64 bit) on my system? If so, how can I tell the executable to run the 32 bit version?

On this page: https://nodejs.org/download/ you can download and install the 32-bit version, and node should then run only the 32-bit version. Be sure to remove any other instances you have of it first. You can verify which you have with a command like this:
$ file `which node`
I have the 64-bit version and I get:
$ file `which node`
/usr/local/bin/node: Mach-O 64-bit executable x86_64
You should get something about 32-bit once you get the 32-bit version installed.

Related

How to install a 32-bit node.js(8.5.0) into a 64-bit ubuntu(17.0)?

I've downloaded 32-bit、64-bit node binaries of v8.5. Currently I also have a 64-bit ubuntu os(v17.0). I tried ./bin/node both on 64-bit binaries and 32-bit binaries, and 64-bit was working fine but 32-bit node binary returns bash: ./node: No such file or directory.
So how do I run 32-bit node on 64-bit a linux system?
You may ask why I'm doing this, because there are some very old .so library which is 32-bit, I can't get this library working with node-ffi with 64-bit node, so sadly I have to install a 32-bit node.
Also, I've tried nvm install 8.5.0 32, it downloads x64 sadly. And I just realize this only works in windows with this nvm-windows, which indicates there is a way to install a 32-bit node on a 64-bit OS?
Take a look atthis article
First you'll need to enable 32-bit support:
sudo dpkg --add-architecture i386
sudo apt -get update
The article I linked to then recommends apt-get dist-upgrade, but I'm not actually sure that will do much for you.
Then you'll need to install the libraries that the 32-bit version of node uses.
sudo apt-get install libc6:i386
will install the base set of libraries that all applications need in 32-bit mode.
sudo apt-get install libares2:i386 libicu57:i386 libstdc++6:i386 libgcc1:i386
should get you to a point where running ./node gives a useful error pointing to a specific library that you need to install so that Node can run.
I've tried: sudo apt install nodejs
And it worked.

aapt missing but its there

I had to reinstall ubuntu-14.04-64 due to reasons.
After this reinstall, when I try to build my android projets, I get a bunch of these lines (among others) in output:
java.io.IOException: Cannot run program "/home/gps/Android/Sdk/build-tools/23.0.2/aapt": error=2, No such file or directory
Now, I know this file exists in my setup because this:
gps#gps-HP-ProBook-4540s:~$ ls -l /home/gps/Android/Sdk/build-tools/23.0.2/aapt
-rwxrwxr-x 1 gps gps 1146608 Jan 4 18:47 /home/gps/Android/Sdk/build-tools/23.0.2/aapt
gps#gps-HP-ProBook-4540s:~$ file /home/gps/Android/Sdk/build-tools/23.0.2/aapt
/home/gps/Android/Sdk/build-tools/23.0.2/aapt: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=fc8aded5418584519d59f2133e81184fe3d4bdfd, not stripped
gps#gps-HP-ProBook-4540s:~$
I have installed all sdk tools from v19 onwards. Changing project settings to any of them shows same error.
Also, trying to execute the file directly gives same error:
gps#gps-HP-ProBook-4540s:~$ /home/gps/Android/Sdk/build-tools/23.0.2/aapt
bash: /home/gps/Android/Sdk/build-tools/23.0.2/aapt: No such file or directory
Can someone suggest a solution to this problem?
Problem solved as follows:
Issue was missing 32 bit libraries, libc and zlib in this case. Installed using following :
sudo apt-get install libc6:i386
sudo apt-get install zlib1g-dev:i386
Thanks #Joni for clear directions.
You're probably missing some dynamic link library that the program needs. Run this command to list the libraries it uses and install those that are missing:
ldd /home/gps/Android/Sdk/build-tools/23.0.2/aapt
Solution as of Ubuntu 16.04 / 16.10 to enable 32 bit binaries to run on 64 bit host
sudo dpkg --add-architecture i386
sudo apt-get -qqy update
sudo apt-get -qqy install libncurses5:i386 libstdc++6:i386 zlib1g:i386

Docker container won't run 32 bit iperf executable copied with wget

Though iperf is successfully installed inside the container, Docker doesn't recognize it:
Docker version:
$ sudo docker version
Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a
Image inf.
root#15cb22522f30:/#uname -a && cat /etc/lsb-release
Linux f93f33213b2a 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
iperf package installation:
root#15cb22522f30:/#wget https://iperf.fr/download/iperf_2.0.2/iperf_2.0.2-4_i386
root#15cb22522f30:/#chmod +x iperf_2.0.2-4_i386
root#15cb22522f30:/#sudo mv iperf_2.0.2-4_i386 /usr/bin/iperf
File located:
root#15cb22522f30:/# which iperf
/usr/bin/iperf
Docker doesn't recognize it:
root#15cb22522f30:/# iperf
bash: /usr/bin/iperf: No such file or directory
You are trying to execute a 32 bit binary on a 64 bit system.
Docker runs on 64 bit systems, and produces 64 bit containers [*]
The copied iperf file is a 32 bit binary.
file /usr/bin/iperf
/usr/bin/iperf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
After hunting around, I found if you install these 32 bit libs in the docker container:
apt-get update && apt-get install libc-i386 lib32stdc++6
Then it will at least load iperf:
iperf
Usage: iperf [-s|-c host] [options]
Try `iperf --help' for more information.
[*] A few people have hacked dockers tools to run on 32 bit systems, so it can be done -- but it isn't the norm and appears to have been rejected by the docker leaders in favor of a single standard.
Paul's answer solved the issue. I additionally had to install i386 architecture for 32-bit packages to be installed automatically:
dpkg --add-architecture i386
apt-get update
apt-get install libc6-dbg
apt-get install libc6-dbg:i386
apt-get install lib32stdc++6

Debugging an unknown Linux box

I have a Linux box that I have root access to, using SSH.
I want to use GDB to debug the system.
It's a stripped-down Debian package; therefore, I don't have any compile tools in it.
uname -a gives:
2.6.38.6-41 SMP XXXXXXX 2014 i686 GNU/Linux
What is the best way to install GDB on it?
I have tried to download the GDB binaries i386, but it always require a different library installed, so if I install all the compatible libraries asked for gdb then I may corrupt the original system.
How can I achieve the GDB instalation goal?
Thanks
There is no apt-get executable installed.
There is no compiler tools installed.
No file in /etc/lsb_release.
If you have Debian package then you can install gdb using following command
sudo apt-get install gdb

How to replace "as" tool with the x86 version on REHL?

I ran into below problem on RHEL while using gcc to compile a C file.
[test]$ gcc hello.c
as: unrecognized option '-Qy'
Then found my "as" is the MIPS version:
[test]$ as -v
GNU assembler version 2.13.2 (mips-dec-ultrix42) using BFD version 2.13.2
So I tried to remove MIPS utilities and reinstall x86 gcc and x86 binutilites by issuing:
sudo yum erase binutils-mips64-linux-gnu.x86_64
sudo yum install gcc-4.4.6-4.el6.x86_64
sudo yum install binutils-2.20.51.0.2-5.34.el6.x86_64
But the problem still occurred. Anyone has any clue on how to replace my "as" with a x86 version?
BTW, Linux release info is as following:
[test]$ lsb_release -a LSB Version:
:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:gaphics-4.0-noarch:printing-4.0-amd64:printing- 4.0-noarch
Distributor ID: RedHatEnterpriseWorkstation Description: Red Hat
Enterprise Linux Workstation release 6.3 (Satiago) Release: 6.3
Codename: Santiago

Resources