Building Node.js Binary with `pkg` for ARMv7 / Ubuntu 14 fails when running output with libstdc++.so.6 Error - node.js

Cross compile? I have a device my company still manufacturers and deploys world-wide, running Ubuntu 14.04.3 ... on an ARMv7 Processor. I have a node app I'm creating for the product family, and I'd like to run it on this device as well. Tried going the whole nvm route to install-and-run node directly on it, but gyphy fails to build some deps from the project locally on the device. I'd really much rather use pkg to build a binary to deploy to the device.
If you aren't familiar, pkg is: https://www.npmjs.com/package/pkg
However, building the examples/express example from the pkg repo with pkg 4.4.9 like pkg . --targets node10.15.3-linux-armv7 --no-bytecode (on a linux box) and scp'ing the resulting binary over to the IOT device running the armv7 / Ubuntu 14 setup, I get the following error when trying to run the binary:
./express-example: relocation error: ./express-example: symbol
_ZTVNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEEE,
version GLIBCXX_3.4.21 not defined in file libstdc++.so.6 with link time reference
(Line wraps added to break long line)
Googling the error (specifically with regards to GLIBC and libstdc++.so.6) has gotten me nowhere. I can't figure out if the libstdc++ on the device is too old or too new. Tried updating libstdc++ but it said it was already at the latest version (for that OS.) I've got no clue where to go from here... Is there some way to compile the binary via pkg with different options, or statically link the libraries it needs instead of relying on system libraries?
Also, when I try to use a newer node version (like 10.21.0, etc) - it fails with an "unable to build" message. I know I can crosscompile regular C/C++ code on that linux box for ARM (we do that currently with Jenkins in the cloud on a linux box), so is there a way to get crosscompile working at buildtime?
Here's the error for building with 10.21:
[root#decidr ~/devel/pkg/examples/express]# ./node_modules/.bin/pkg . --targets node10-linux-armv7 --no-bytecode
> pkg#4.4.9
> Fetching base Node.js binaries to PKG_CACHE_PATH
fetched-v10.21.0-linux-armv7 [ ] 0%
> Error! 404 Not Found
https://github.com/zeit/pkg-fetch/releases/download/v2.6/uploaded-v2.6-node-v10.21.0-linux-armv7
> Asset not found by direct link:
{"tag":"v2.6","name":"uploaded-v2.6-node-v10.21.0-linux-armv7"}
> Not found in GitHub releases:
{"tag":"v2.6","name":"uploaded-v2.6-node-v10.21.0-linux-armv7"}
> Building base binary from source:
built-v10.21.0-linux-armv7
> Error! Not able to build for 'armv7' here, only for 'x64'
I find myself rather stuck - can't run node directly on the device, and the device won't run the pkg-built binary, even though it builds ARMv7 code. No idea how to proceed forward - any assistance or ideas? :)

Related

Building Tensorflow Lite for Linux x86_64 using bazel

As the title says im trying to build TFLite(R2.2) for Linux x86_64, i already have it working for Macosx x86_64, but i cant seem to find any options within the bazel build configs to change the build for linux.
I configure the bazel build by using ./configure and setting all the properties correctly, then use
bazel build //tensorflow/lite/java:libtensorflowlite_jni.so to build the .so
But no matter what options i pass into --config it always builds the .so for the host architecture (Macosx)
If anyone knows how to do this would be grand.
This Reference answers your solution and for linux follow

Has official 32bit support for cmake on Linux been dropped?

I don't mean the version(s) provided by the various distributions but the binary from the official website.
I have an old VM running 32bit OpenSUSE 12.1 that is configured for a project I'm working on at work. I need to install WebKitGTK. The problem is that the cmake in the repositories is ancient 2.x, while WebKitGTK at least 3.6 (or similar). So I went to the official website and (my fault) without looking too much into it downloaded the 3.10 installation for Linux.
Upon executing the binary that was installed I got the error that the file could not be run. I checked the execution rights and it was fine. Then it struck me...I ran file cmake and got 64 instead of the required 32bit.
I went back to the website and all I could find were 32bit versions for Windows but none for Linux.
I can build it from source but just out of curiousity would like to know if support has been dropped. I was unable to find any information so far.
32-bit support for CMake hasn't been dropped. They just don't provide binaries for it on their website as of CMake 3.7.0

Linux - Running Executable Error (GLIBCXX_3.4.21 not found)

I'm trying to deploy my application as a stand-alone that can work on any Linux machine. I've built my application under Qt Creator and have successfully statically linked my application. However, when I test the application on another Linux machine, I get the following error:
libstdc++.so.6: version 'GLIBCXX_3.4.21' not found (required by ./Executable)
I'm not sure how to resolve this error.
This is a error i had myself, but in another context.
What this means is: libstdc++.so.6 (a shared object file, the standard library of c++ programms, that many programms can use together(share)) is another version then the program you compiled requires.
i had this issue when switching from gcc-4.8 to gcc-5.
Have you using different linux distros when compiling and executing? (Ubuntu?)
You must make sure the versions match, or statically compile the used libstdc++ into your binary as well.
Here is a SO question relating to these kind of issues.
GLIBCXX versions

Unable to Run mksdcard sdk tool on ARMv7 Processor Ubuntu 14.04

When trying to install Android Studio on my Linux Laptop, I get "Unable to Run mksdcard tool" From what I can tell from searching, this is usually caused by lacking the 32 bit compatibility libraries on 64 bit Linux, however I am running it on an ARMv7 processor, using the crouton project to use Linux on my Chromebook. I have tried install the recomended packages ending in i386, but the command line returned:
Reading Package Lists... Done
Building Dependendency Tree
Reading State information... Done
E: unable to locate package [Name of package here]
E: Couldn't find any package by Regex '[Name of package]'
Does anyone know what is causing this and how I can fix it?
I've discovered a workaround.
After a little searching, I've found that we can create executable binary of the tool for the ARMv7 platform ourselves! Whupee!
Head over to GitHub and pick up the source code, mksdcard.c. Download this to wherever you'd like, but make sure you download it as mksdcard.c and not as mksdcard.c.txt, which your browser might try to do. You can always rename the file later in case you accidentally save the filename incorrectly.
Over in your chroot environment, head to the directory where you downloaded the file.
Make sure you have the gcc compilation tools installed. Try running gcc -v in an attempt to see what version of GCC you have installed. If this doesn't work, you'll need to install GCC via sudo apt-get install gcc.
Run gcc -o mkdscard mksdcard.c. This uses GCC to compile the source code into something that can be executed. After compilation has completed, you can use ./mkscard to have Linux execute the binary file, which verifies that it works.
Navigate to your Android SDK Tools directory. This is usually ~/Downloads/Android/Sdk/tools. By running ls, you'll list the files and find the version of mksdcard that your Linux distribution doesn't understand how to run. (Running ./mksdcard on this file will confirm this.)
Backup the broken binary somewhere, then delete the copy in the tools folder. (I created a backups/ directory within the Android SDK Tools folder to move it to.)
Within the directory, use rm -r mksdcard to delete the old mksdard binary.
Finally, copy your compatible binary over to take it's place, e.g. cp ~/Downloads/mksdcard . (Copies the mksdcard binary we've created to the current directory ., the Android SDK Tools folder.)
Head back over to your Android Studio installer. In the dialogue complaining about mksdcard failing, hit Retry and the installation should continue. After it's finished, be sure to apply any updates that are recommended by the environment. Enjoy!
For newer versions eg. 3.1 C4 of Android Studio running with Ubuntu on ARM32 you will also need to place mksdcard in ~/Downloads/Android/Sdk/emulator (referencing like path from Alext T.).

Ubuntu/Darling - dyld: Failed to load native library: libSimpleWebKit.so

I'm attempting to use Darling directly built from source on Github, I ran in to a few issues with building and dependencies, but with the help of apt-file I got through all the little problems. Now, I'm trying to run Sourcetree From Atlassian (as Wine can't seem to handle the windows version) and am getting the following error. Would anyone happen to have an idea on why? Currently running Ubuntu 13.04 64bit.
dyld: Cannot execute binary file: Failed to load native library: libSimpleWebKit.so: cannot open shared object file: No such file or directory
I just had this error myself. The error message tells you already everything you need to know: The appropriate library - libsimplewebkit - was not found and needs to be installed. Just search for simplewebkit with your distros package manager and install the appropriate package. If it doesn't find anything you will need to compile it yourself.

Resources