{"id":123,"date":"2016-03-08T00:26:37","date_gmt":"2016-03-07T23:26:37","guid":{"rendered":"http:\/\/www.mikropunto.org\/?p=123"},"modified":"2024-12-03T23:11:43","modified_gmt":"2024-12-03T22:11:43","slug":"compile-install-4-3-2-nodejs","status":"publish","type":"post","link":"https:\/\/mikropunto.org\/?p=123","title":{"rendered":"Compile \/ install 4.3.2 nodejs"},"content":{"rendered":"<p>I had some trouble recently trying to compile nodejs under Slackware 14 and I would like to share some notes about it,\u00a0 just in case someone gets stuck in the same situation.<\/p>\n<h3>First of all: there is a precompiled package that should work, so why all the hassle?<\/h3>\n<p>Well, I like to compile my own packages. I use Slackware, we don&#8217;t have a package manager, we should be able to compile our software ourselves.<\/p>\n<h3>Second: slackbuilds can help you<\/h3>\n<p><a href=\"https:\/\/slackbuilds.org\/repository\/14.1\/development\/nodejs\/\">slackbuilds.org<\/a> has a build script for nodejs 4.2.4 If you are familiar with Slackware, for sure you know what to do with it. But there are three small problems;<\/p>\n<ul>\n<li>I want nodejs 4.3.2 and the script is for 4.2.4<\/li>\n<li>I am using Slackware 14, not 14.1<\/li>\n<li>nodejs wont compile, any version of it<\/li>\n<\/ul>\n<p>So, I download the script and the 4.3.2 sources, take a peek to nodejs.slackbuild and modified it to compile the new version:<\/p>\n<pre>VERSION=${VERSION:-v4.3.2} #4.2.4<\/pre>\n<p>Let&#8217;s try it, it&#8217;s just a minor version change, it probably works&#8230; errr&#8230; no. During config, a message alerts that<\/p>\n<p><span style=\"color: #ff0000;\">WARNING:<\/span> C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=g++)<\/p>\n<p>Damn, Slackware 14 g++ is 4.7.1 !!\u00a0 I don&#8217;t want to update gcc! It is A LOT of trouble! What if I just &#8230;<\/p>\n<h3>Third: use an alternative version of gcc \/ g++<\/h3>\n<p>Hmm&#8230; so install a newer version, tell <em>configure<\/em> and <em>make<\/em> that we want to compile using it&#8230; that can&#8217;t be so difficult.<\/p>\n<p>I will install gcc and g++ from the oficial distro repos. Yes, I know what I said about \u00abcompiling my own software\u00bb, but NO, I am not compiling gcc. In the distro I trust.<\/p>\n<p>So, get them from <a href=\"http:\/\/mirrors.slackware.com\/slackware\/slackware-14.1\/slackware\/d\/gcc-4.8.2-i486-1.txz\">here<\/a> and <a href=\"http:\/\/mirrors.slackware.com\/slackware\/slackware-14.1\/slackware\/d\/gcc-g++-4.8.2-i486-1.txz\">here<\/a> and<\/p>\n<pre># mkdir \/opt\/gcc\r\n# installpkg --root \/opt\/gcc .\/gcc-4.8.2-i486-1.txz\r\n# installpkg --root \/opt\/gcc .\/gcc-g++-4.8.2-i486-1.txz<\/pre>\n<p>Now just tell the script to use it.\u00a0 Let&#8217;s add at the beggining of nodejs.slackbuild<\/p>\n<pre>PATH=\/opt\/gcc\/usr\/bin:$PATH\r\nexport PATH=\/opt\/gcc\/usr\/lib\/gcc\/i486-slackware-linux\/4.8.2:$PATH\r\nexport CC=\/opt\/gcc\/usr\/bin\/cc\r\nexport CXX=\/opt\/gcc\/usr\/bin\/g++<\/pre>\n<p>This must work now&#8230; and&#8230; and&#8230; NO!<\/p>\n<h3>Fourth: assembler error???<\/h3>\n<p>Compiling fails saying<\/p>\n<pre>{entrada est\u00e1ndar}: Mensajes del ensamblador:\r\n{entrada est\u00e1ndar}:32423: Error: se espera una instrucci\u00f3n de cadena despu\u00e9s de `rep'\r\nmake[1]: *** [\/tmp\/MKp\/node-v4.3.2\/out\/Release\/obj.target\/v8_base\/deps\/v8\/src\/api.o] Error 1<\/pre>\n<p>After some thinking and testing, I finally realize that the \u00ab-march=xxx -mtune=xxx\u00bb\u00a0 options are to blame. How? well, I just tried to compile the source without the build script, and suddenly I realized that what g++ was saying that there was something rotten when translating to assembler if I tried the default slackbuild options, but everything was fabulous when saying just \u00ab.\/.configure;make\u00bb<\/p>\n<p>So, I add a new line to the build script, just under the $SLKCFLAGS assignment to override it<\/p>\n<pre>SLKCFLAGS=\"-O2 -pipe\"<\/pre>\n<p>And&#8230; HEY, KNOW WHAT? IT WORKS!<\/p>\n<h3>Final thoughts<\/h3>\n<p>So, after some wrestling with the bloody nodejs, looks like it doesn&#8217;t like how my computer is arch-tuning it&#8230; I don&#8217;t know if mine is the only case, but for sure this took me some time to solve, so here it is for your compiling pleasure.<\/p>\n<p>Next, I think I will dig into Slackware&#8217;s installpkg script, as I can&#8217;t find the new gcc\/g++ listed under \/var\/log\/packages and I don&#8217;t know why&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had some trouble recently trying to compile nodejs under Slackware 14 and I would like to share some notes about it,\u00a0 just in case someone gets stuck in the same situation. First of all: there is a precompiled package &hellip; <a href=\"https:\/\/mikropunto.org\/?p=123\">Sigue leyendo <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-123","post","type-post","status-publish","format-standard","hentry","category-gnu-linux"],"_links":{"self":[{"href":"https:\/\/mikropunto.org\/index.php?rest_route=\/wp\/v2\/posts\/123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mikropunto.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mikropunto.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mikropunto.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mikropunto.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=123"}],"version-history":[{"count":6,"href":"https:\/\/mikropunto.org\/index.php?rest_route=\/wp\/v2\/posts\/123\/revisions"}],"predecessor-version":[{"id":146,"href":"https:\/\/mikropunto.org\/index.php?rest_route=\/wp\/v2\/posts\/123\/revisions\/146"}],"wp:attachment":[{"href":"https:\/\/mikropunto.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mikropunto.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mikropunto.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}