Error starting executable built by a Go compiler - linux

I am new to Go, and I have a docker plugin written in Go on my MAC. I build it with the following command:
env GOOS=linux GOARCH=amd64 go build
The output is binary file. When I copy it to CoreOS and try to execute:
./my-binary-file
the result is:
"2016/12/07 08:05:00 Error Group root not found"
The OS on which file is executed is CoreOS. I've checked MAC and CoreOS, both of them are x86_64.
Why then I get this error?
EDIT:
The problem was in ServerUnixGroup. It should be "docker" instead of "root".

The problem was in ServerUnixGroup. It should be "docker" instead of "root". – user2739823

Related

Golang + Linux + Docker error : standard_init_linux.go:211 : no such file or directory

This is not a duplicate because although the error is same, my use case is different from others.
I am compiling a go application to deploy with docker on:
latest arch linux
latest docker version, golang:alpine image
tried with go version 1.13.3 and 1.14.4 linux amd64
i have no bash scripts or wrong file endings. Whole project is written on this Linux machine
i can deploy an empty go app that has only a fmt print without any error
however,
when i build it on my OSX machine, and send it to linux, I can deploy that executable to docker without any error
OSX mojave
latest docker
go 1.13.3
GOOS=linux
Error :
standard_init_linux.go:211: exec user process caused "no such file or directory"
When you compile your go app with cgo enabled the compiler links dynamically to libstdc .
However, golang:alpine image is so small, because it is not using libstdc but a simplified version of it called musl libc.
The error message says
standard_init_linux.go:211: exec user process caused "no such file or directory"
If you connect to your image with
$ docker run -it [image] /bin/sh
you can find your executable in let's say /dist/myexec, but when you try to run that executable, it says err not found, because of not that it can't find your executable, obviously, but it can't find file libc .
The solution is to either
disable CGO : use CGO_ENABLED=0 while building
or add
RUN apk add --no-cache libc6-compat
to your Dockerfile
or do not use golang:alpine
To have a all static binary executable, build it with:
$ CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' .

Unable to connect to the GDB server through arm-none-eabi-gdb command

I am following this tutorial. I have compiled the code successfully, but when I try to run using command arm-none-eabi-gdb -q thumbv7em-none-eabihf/debug/led-roulette on terminal, it says that:
C:\Program Files (x86)\GNU Tools ARM Embedded\8 2018-q4-major\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
thumbv7em-none-eabihf/debug/led-roulette: No such file or directory
Although, I have physically checked the path and the file does exist there.
I am a beginner to stm32f3Discovery and trying to setup the device using the documentation
Steps taken so far:
Already added the target using:
rustup target add thumbv7em-none-eabihf
Compiled the program using command:
cargo build --target thumbv7em-none-eabihf
Getting correct output of the following command:
cargo readobj --target thumbv7em-none-eabihf --bin led-roulette -- -file-headers
As I am on Windows, I've tried the following command to launch openOCD:
openocd -s C:\OpenOCD\scripts -f interface/stlink-v2-1.cfg -f target/stm32f3x.cfg
Run this command to connect to gdb server, but failed:
arm-none-eabi-gdb -q target/thumbv7em-none-eabihf/debug/led-roulette
The above command should work and connect GDB server, but it doesn't.
Thanks hellow.. Your 'Triple check' statement works for me. Yes, it was the path issue which i had to change while debugging. It is rocking..

OpenShift oc command line with Cygwin

I'm running Cygwin 64bit but can't seem to get OpenShift oc command line to work
I downloaded oc.tar.gz ( from here https://mirror.openshift.com/pub/openshift-v3/clients/3.6.173.0.5/linux/oc.tar.gz ), unzipped it and placed it in my path in /usr/bin
When I try to run: oc login I get the following.
-bash: /usr/bin/oc: cannot execute binary file: Exec format error
Do I need to somehow 'install' the executable ?
Any help would be much appreciated.
In addition to #Graham Dumpleton's answer:
open cygwin and check for directory /usr/local/bin
mkdir -p local/bin
$ cd /usr/local/bin
if it does not exists:
$ mkdir -p local/bin
finally extract the windows package:
$ cp /cygdrive/c/Users/me/Downloads/oc-3.5.5.31.24-windows.zip /usr/local/bin/
unzip oc-3.5.5.31.24-windows.zip
$ oc version
oc v3.5.5.31.24
kubernetes v1.5.2+43a9be4
features: Basic-Auth
Use the Windows binary from the following page:
https://github.com/openshift/origin/releases
From project homepage
https://www.cygwin.com/
Cygwin is not:
a way to run native Linux apps on Windows. You must rebuild your
application from source if you want it to run on Windows.
a way to magically make native Windows apps aware of UNIX®
functionality like signals, ptys, etc. Again, you need to build your
apps from source if you want to take advantage of Cygwin
functionality.

How do I cross compile my Go program from Mac OS X to Ubuntu 64-bit

As the title says I'm wondering how to cross-compile my program so that I can run it on Ubuntu 64-bit
I've went into the /usr/local/go/src folder and ran
GOOS=linux GOARCH=amd64 ./make.bash --no-clean
everything compiled fine
then went into my project directory and ran go build -v -a and then took the compiled binary and moved it to my linux server, but when running it I get this error:
root#PanicCSGO40:~/test# ./test
-bash: ./test: cannot execute binary file: Exec format error
root#PanicCSGO40:~/test# sudo ./test
./test: 1: ./test: Syntax error: "(" unexpected
root#PanicCSGO40:~/test#
Not sure what I am doing wrong any information would be great thanks.
I've also tried doing it with GOARCH=386 but still get the same errors. Thanks!
This link does not solve my question because the chosen answer is a link to a blog post which relies heavily on doing all cross-compilation on using the blog writers bash scripts to do it, I just simply wanted to know what the correct way to do it was and now I do.
The build command needs to identify the target environment:
$ GOOS=linux GOARCH=amd64 go build -v /path/to/target/package

Jenkins build fails when running nodeJS

I have Jenkins set up on a machine with the NodeJS plugin. Sadly, whenever I try to use the plugin in a build, it fails with:
[workspace] $ node /tmp/hudson3477900862350780409.js
FATAL: command execution failed
java.io.IOException: Cannot run program "node" (in directory
"/var/lib/jenkins/jobs/XXX/workspace"): error=2, No such file or directory
When I log into the machine as the jenkins user, I can use node through command line. I also added the path to node (/opt/node-0.6.18/bin) into the Configuration screen for the current working node (which is only one: master).
I've been stuck with this for a while, any help would be highly appreciated.
Cheers!
Well, this isn't the most elegant of solutions, but it worked: I simply made a symlink to from /bin/ to the installation path for node and now the problem's gone.
ah easy, you need to tick "Provide Node/npm bin folder to PATH" when running a "execute shell" build task"
I am using NVM and I had the same issue. One workaround was to create a symlink:
ln -s /root/.nvm/versions/node/v8.11.3/bin/node /bin/node
ln -s /root/.nvm/versions/node/v8.11.3/bin/npm /bin/npm
For Jenkins running in Docker, use jenkins/jenkins:latest image to avoid this issue.
the error came up just because you did't install node in your machine.after you installed it,and add it to PATH,then the problem can be solved.
hope it helps.

Resources