Génération de code source Node.js donnant une erreur de segmentation sur ARM

tl; dr: J’ai essayé d’installer node.js sur mon Cubox basé sur ARMv7 sous Ubuntu 12.10 (quantal). Lors de la compilation de node.js à partir de la source (voir “Deuxième tentative” ci-dessous), le node génère une erreur de segmentation. Que puis-je faire ici?

Premier essai

Tout d’abord, j’ai essayé d’installer node.js via le gestionnaire de paquets, en suivant les instructions pour Ubuntu qui sont données ici: Installation de Node.js via le gestionnaire de paquets: Ubuntu, Mint

L’ajout du référentiel mentionné à l’aide de sudo add-apt-repository ppa:chris-lea/node.js semble bien fonctionner:

 You are about to add the following PPA to your system: Evented I/O for V8 javascript. Node's goal is to provide an easy way to build scalable network programs More info: https://launchpad.net/~chris-lea/+archive/node.js Press [ENTER] to continue or ctrl-c to cancel adding it gpg: keyring `/tmp/tmpp0owib/secring.gpg' created gpg: keyring `/tmp/tmpp0owib/pubring.gpg' created gpg: requesting key C7917B12 from hkp server keyserver.ubuntu.com gpg: /tmp/tmpp0owib/trustdb.gpg: trustdb created gpg: key C7917B12: public key "Launchpad chrislea" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK 

Cependant, sudo apt-get install nodejs me donne l’erreur:

 E: Unable to locate package nodejs 

Je suppose que c’est parce que j’ai un système basé sur ARM. Autant que je sache, d’ après les détails du paquet , le référentiel ne contient que des versions pour i386 et amd64. Est-ce que mon hypothèse est correcte?

Deuxième essai

Donc, ma prochaine tentative a été d’installer node.js à partir du source. J’ai utilisé les instructions données dans l’essentiel suivant: Node.js et NPM en 30 secondes . Tout semble fonctionner, y compris make install . Mais l’exécution du script install.sh dans la dernière ligne de l’essentiel échoue car le node produit une erreur de segmentation. Maintenant, je me demande ce que je peux faire pour installer correctement node.js sur ma machine?

Pour illustrer mon problème, voici quelques résultats:

sortie install.sh

Ceci est la sortie de install.sh après l’exécution de make install , comme décrit dans les instructions d’installation essentielles mentionnées ci-dessus.

 cyroxx@cubox:~/node-latest-install$ curl https://npmjs.org/install.sh | sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 7882 100 7882 0 0 11251 0 --:--:-- --:--:-- --:--:-- 14984 tar=/bin/tar version: tar (GNU tar) 1.26 Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redissortingbute it. There is NO WARRANTY, to the extent permitted by law. Written by John Gilmore and Jay Fenlason. install npm@latest fetching: http://registry.npmjs.org/npm/-/npm-1.2.21.tgz Segmentation fault Segmentation fault You need node to run this program. node --version reports: v0.10.7 Please upgrade node before continuing. It failed 

sortie de noeud

 cyroxx@cubox:~/node-latest-install$ node Segmentation fault 

faire construire Debug

BUILDTYPE=Debug make avec BUILDTYPE=Debug produit cette sortie:

 cyroxx@cubox:~/node-latest-install$ make -C out BUILDTYPE=Debug make: Entering directory `/home/cyroxx/node-latest-install/out' CXX(target) /home/cyroxx/node-latest-install/out/Debug/obj.target/v8_base/deps/v8/src/arm/stub-cache-arm.o ../deps/v8/src/arm/stub-cache-arm.cc: In function 'void v8::internal::ProbeTable(v8::internal::Isolate*, v8::internal::MacroAssembler*, v8::internal::Code::Flags, v8::internal::StubCache::Table, v8::internal::Register, v8::internal::Register, v8::internal::Register, v8::internal::Register, v8::internal::Register, v8::internal::Register)': ../deps/v8/src/arm/stub-cache-arm.cc:106:15: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] cc1plus: all warnings being treated as errors make: *** [/home/cyroxx/node-latest-install/out/Debug/obj.target/v8_base/deps/v8/src/arm/stub-cache-arm.o] Error 1 make: Leaving directory `/home/cyroxx/node-latest-install/out' 

Quel est le problème ici? Est-ce un bug dans l’implémentation ARM de V8? Peut-être que tous les drapeaux du compilateur qui ne sont pas (correctement) définis? Rien d’autre? Je suis totalement coincé.

J’ai eu ce problème aussi sur quelques ordinateurs ARM différents. Comstackr sans la fonctionnalité d’instantané a fonctionné pour moi. Snapshot est une fonctionnalité de la V8 qui permet au nœud de démarrer plus rapidement. Il semble y avoir un bogue pour ARM.

 ./configure --without-snapshot make sudo make install 

http://www.armhf.com/index.php/node-js-for-the-beaglebone-black/

J’ai eu du mal à créer un Samsung Chromebook XE303C12I avec Crouton exécutant Unity, même avec --without-snapshot et --with-arm-float-abi=hard ;

Les fichiers binarys se trouvent dans le répertoire de publication, à l’adresse nodejs.org/dist/{version number}

Par exemple, vous pouvez télécharger le fichier binary ARM pour v0.10.24 [ici] ( http://nodejs.org/dist/v0.10.24/node-v0.10.24-linux-arm-pi.tar.gz ).

Voici un script pour télécharger et installer un binary. Une fois que vous avez installé le noeud, assurez-vous d’append path/to/bin/node à votre $PATH .