protoc-gen-go does not execute on linux machine - go

I have installed protoc-gen-go and its in the bin direct and I have set the path to this as well. The problem is that when I run protoc-gen-go from the commandline it does not error, but nothing happens as well.
If I run the following command sudo protoc --go_out=. --go_opt=paths=source_relative --go-grpc_ths=source_relative helloworld/helloworld.proto I get the following error
protoc-gen-go: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--go_out: protoc-gen-go: Plugin failed with status code 1.
However protoc-gen-go is available in my /home/usrname/go/bin path and this bin path has been exported to my linux PATH variable. Not sure what is going wrong here. The protoc-gen-go has the following permissions
-rwxr-xr-x 1 usrname 9003065 Apr 16 11:16 protoc-gen-go

Related

'protoc-gen-go-grpc: program not found or is not executable', despite all the efforts

I'm trying to run makefile command 'gen' from this project https://github.com/penthaapatel/grpcblog. The command is: protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative blog/blog.proto However I get an error:
protoc-gen-go-grpc: program not found or is not executable
--go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.
make: *** [/home/deckard/go/src/grpcblog/Makefile:2: gen] Error 1
I use Ubuntu 20.04? Golang-1.13.8 with $GOROOT=/usr/lib/go-1.13 and $GOPATH=/home/deckard/go ($HOME is /home/deckard). Protoc is libprotoc v.3.6.1.. I installed protobuf-compiler both with:
sudo apt install protobuf-compiler
and
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
There's a folder /home/deckard/go/src/github.com/golang/protobuf and /home/deckard/go/src/google.golang.org/protobuf with /home/deckard/go/src/google.golang.org/protobuf, with, I guess, everything i need.
My bashrc configurations (tried few methods, so things overlap each other):
export GOROOT=/usr/lib/go-1.13
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN
export PATH=$PATH:$GOPATH/bin
export GO_PATH=~/go
export PATH=$PATH:/$GO_PATH/bin
So i tried solutions from here: protoc-gen-go: program not found or is not executable, but none of them helped me. Any clue would be helpful, because I stuck and am very tired.
UPDATE: ls -l /home/deckard/go/bin/protoc-gen-go-grpc shows rwxrwxr-x 1 deckard deckard 7970222 мая 1 14:55 /home/deckard/go/bin/protoc-gen-go-grpc, and printenv PATH returns /home/deckard/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/deckard/.dotnet/tools:/usr/lib/go-1.13:/home/deckard/go:/home/deckard/go/bin:/home/deckard/go/bin://home/deckard/go/bin
UPDATE: which protoc returns /usr/bin/protoc (tried to install it from precompiled binary to /home/deckard/.local/bin/protoc, didn't helped). In both cases protoc-gen-go-grpc --version returns protoc-gen-go-grpc 1.1.0. I also tried to copy everything from google.golang.org/protobuf to google.golang.org/protobuf, no result.
So I deleted github.com/golang/protobuf folder, and seems like google.golang.org/protobuf has started indexing, and everything just started working.

protoc-gen-go-grpc: program not found or is not executable [protoc-gen-go is in PATH]

I am trying to generate Go source code from .proto file through this command:
protoc greet/greetpb/greet.proto --go-grpc_out=plugins=grpc:.
and, this is the directory structure:
greet/greetpb/greet.proto
I have tried all the answers mentioned here
But, none of them seems to be working.
I have verified that protoc-gen-go is in PATH.
Still, I am getting this:
protoc-gen-go-grpc: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.
Additional details:
Go Version: go version go1.14.6 darwin/amd64
protoc version: libprotoc 3.12.3
My .zshrc file:
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN

Error message:protoc-gen-go: Plugin failed with status code 1

This is not a duplicate question
First, I made sure I have the following configuration:
1 export GOPATH=/Users/chezixin/go
2 export GOBIN=/Users/chezixin/go/bin
3
4 export GO111MODULE=on
5 # 123
6 export GOPROXY=https://goproxy.cn
7
8
9 export PATH="$PATH:/Applications/Postgres.app/Contents/Versions/12/bin:/Users/chezixin/flutterSDK/flutter/bin:/usr/local/go/bin:$GOPATH:$GOBIN"
10
czxmac:~ chezixin$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:
/sbin:/Applications/VMwareFusion.app/Contents/Public:
/Applications/Postgres.app/Contents/Versions/latest/bin:
/Applications/Postgres.app/Contents/Versions/12/bin:
/Users/chezixin/flutterSDK/flutter/bin:/usr/local/go/bin:
/Users/chezixin/go:/Users/chezixin/go/bin':
/Users/chezixin/Go/bin:/Applications/Postgres.app/Contents/Versions/12/bin:
/Users/chezixin/flutterSDK/flutter/bin:
/usr/local/go/bin:/Users/chezixin/go:
/Users/chezixin/go/bin:/Users/chezixin/Go/bin
Already installed:
go get -u google.golang.org/grpc
look protoc:
czxmac:~ chezixin$ protoc --version
libprotoc 3.11.1
Protoc-gen-go is installed and exists in $ GOPATH/bin
go get -u github.com/golang/protobuf/protoc-gen-go
problem:
When I execute the following command
$ protoc --go_out=plugins=grpc:. *.proto
An error occurred:
protoc-gen-go: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--go_out: protoc-gen-go: Plugin failed with status code 1.
Where is the problem, please master guidance.
This issue is related with your PATH variable, please set it again.
I can see a typo of an extra trailing apostrophe(') in this line of PATH variable. /Users/chezixin/go:/Users/chezixin/go/bin':
Try updating it to
/Users/chezixin/go:/Users/chezixin/go/bin:
For anyone facing a similar issue, but it was not the case of an invalid PATH variable, I very much sympathize with you.
I realized that I had to install the compiler (again?) before it started working. I hadn't installed it before, but it appeared to already be downloaded. I guess I had to install it again or update it.
I personally was using betterproto, and I followed the instructions here to install it with the protoc plugin and try out their example.

Build R source code from windows

C:\Work\R contains the R-3.1.1.tar.gz file
I have build R source(R-3.1.1) in windows 8 from the following commands
cd C:\Work\R
tar --no-same-owner -xf R-3.1.1.tar.gz
cd C:\Work\R\R-3.1.1\src\gnuwin32\
make all recommended
Add the following path to the Environment variables
C:\Work\R\R-3.1.1\bin\i386
Enter the R.exe in command promt
I got the following Error
Fatal error unable to open the base package
System information
Windows 8, 64 bit operating System, x64 –based processor
How to resolve this error?
If you are using R, you can download the newest version from here and then simply install it.
If you have an older version and want only to download the new one, use those commands inside R:
# installing/loading the package:
if(!require(installr)) {
install.packages("installr"); require(installr)} #load / install+load installr
# using the package:
updateR() # this will start the updating process of your R installation. It will check for newer versions, and if one is available, will guide you through the decisions you'd need to make.
We can resolve this issue by using the following command before build the R source code
Set TMPDIR=c:\cygwin64\bin
Here c:\cygwin64\bin is the cygwin installed location in Windows 8 machine.
Here I have mentioned the R source code build steps:
Install cygwin setup
Install RTools
Create the R_HOME file in the directory like C:\R_HOME
Place the R source code tar file in the R_HOME
Add the following path in environment variable in first
c:\Rtools\bin\;c:\Rtools\gcc-4.6.3\bin;C:\cygwin64\bin\;C:\Program Files (x86)\HTML Help Workshop\;C:\R_HOME\R-3.1.1\bin\;
Enter the following command in the command prompt
Set TMPDIR=C:\cygwin64\bin
Set working directory as C:\R_HOME
Enter the following command
tar --no-same-owner -xf R-3.1.1.tar.gz
Copy the Tcl source from c:\R (it will be created while installing RTools)
Set the working directory as follow in command prompt
C:\R_HOME\R-3.1.1\src\gnuwin32
Enter the following command
Make all recommended
Enter the R.exe command in command prompt. We can enter the R terminal

File does not exist error when I run hello.go program

I am following go documentation and try to run hello.go.
I am on Windows 7 and install go 1.1.2 using msi installer.
I have file "C:\Go\pkg\tool\windows_386\8g.exe" (see dir output below), but when I do 'go.exe run hello.go', I get the file does not exist error.
Please help. Thank you.
C:\>go.exe run hello.go
go build command-line-arguments: exec: "C:\\Go\\pkg\\tool\\windows_386\\8g.exe":
file does not exist
C:\>go.exe version
go version go1.1.2 windows/386
C:\>go.exe run hello.go
go build command-line-arguments: exec: "C:\\Go\\pkg\\tool\\windows_386\\8g.exe":
file does not exist
C:\>dir C:\\Go\\pkg\\tool\\windows_386\\8g.exe
The specified path is invalid.
C:\>dir C:\Go\pkg\tool\\windows_386\\8g.exe
Volume in drive C is Local Disk
Volume Serial Number is C07E-54F5
Directory of C:\Go\pkg\tool\windows_386
08/13/2013 07:04 AM 1,831,416 8g.exe
1 File(s) 1,831,416 bytes
0 Dir(s) 11,407,892,480 bytes free
From issue 6224, this error happens if you had the environment variable PATHEXT set to only one extension, before running go.exe.
set PATHEXT=.BAT
go run hello.go
What is the expected output?
no errors and hello world program runs
What do you see instead?
go build command-line-arguments:
exec: "c:\\Go\\pkg\\tool\\windows_386\\8g.exe": file does not exist
8g
Windows 7 64bit
go version go1.1.2 windows/386
On my computer (W7 64 bits), I have:
set pa
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
and everything runs just fine.
LookPath is called with "c:\Go\pkg\tool\windows_386\8g.exe" and the fact that PATHEXT is being set in an evil way let's say, make LookPath fails
For windows users :
If using vscode type this on terminal
$env:GOOS="windows"
else type this in windows powershell

Resources