cp: cannot stat ‘build/docker/gotools/bin/protoc-gen-go’: No such file or directory - vagrant

I try to build hyperledger fabric, and have installed the project as the guide in http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup/#option-1-vagrant-development-environment.
When I try to 'make peer', command is shown as:
vagrant#ubuntu-1404:/opt/gopath/src/github.com/hyperledger/fabric/devenv$
cp: cannot stat 'build/docker/gotools/bin/protoc-gen-go': No such file
or directory
I looked into the folder and didn't find the file protoc-gen-go. Does it indicate that I missed few steps when I was setting up the envrionment?

Step 1: Run
$go get -u github.com/golang/protobuf/protoc-gen-go
Download protoc-gen-go
Step 2: cp
$ cp $GOPATH/bin/protoc-gen-go build/docker/gotools/bin/
Then continue your make.

You can find the file protoc-gen-go in path: $GOPATH/bin, then copy this file to $GOPATH/src/github.com/hyperledger/fabric/build/docker/gotools/bin/.
If all things has done, you can run: make peer and it will work.

I had a same problem. Maybe your GOPATH and GOROOT variables are conflicted with your customized paths.
I solved the problem like this:
Delete /usr/lib/go
Delete /usr/local/go
Download protoc-gen-go ($go get -u github.com/golang/protobuf/protoc-gen-go)
protoc-gen-go binary is created at your go workspace
copy the protoc-gen-go binary to fabric/build/docker/gotools/bin/
BUILD AS make peer
I hope this would helpful to you

Can you try to:
cd /opt/gopath/src/github.com/hyperledger/fabric/
make peer
and see if it works? Looks like you are in the devenv subdir.

I had the same issue when Docker was returning permissions issues causing the build to fail.
Once that happens, the build process won't work successfully even after you fix the Docker issues.
Instead, once Docker is repaired, delete the gotools folder and run make again:
Makefile:245: recipe for target 'build/docker/gotools' failed
make: *** [build/docker/gotools] Error 126
user#:~/go/src/github.com/hyperledger/fabric$ rm -rf build/docker/gotools/
user#:~/go/src/github.com/hyperledger/fabric$ make all

Related

Install pg_trgm on postgres 9.4.24

I'm trying to use the similarity function on a Greemplum system using postgres 9.4.24 version.
The Greenplum System is running on a CentOS 7 cluster (CentOS Linux release 7.9.2009 (Core))
I've managed to install the postgresql-contrib package by running this:
sudo yum install postgresql-contrib.x86_64
However, when I run this command on a DB:
create extension pg_trgm();
I get the following:;
SQL Error [58P01]: ERROR: could not open extension control file "/usr/local/greenplum-db-6.13.0/share/postgresql/extension/pg_trgm.control": No such file or directory
I looked in the directory and the pg_trgm.control wasn't there but I was expecting it since I installed the contrib package.
Is there anything I missed?
I found the contrib repository for Greenplum and downloaded the code here:
https://github.com/greenplum-db/gpdb/tree/master
which includes the contrib directory with all the extensions..
however, when I try to make && make install, I get an error:
[gpadmin#mdw pg_trgm]$ sudo make
Makefile:22: ../../src/Makefile.global: No such file or directory
Makefile:23: /contrib/contrib-global.mk: No such file or directory
make: *** No rule to make target `/contrib/contrib-global.mk'. Stop.
Looking at the directory structure and files, Makefile.global doesn't exists and contrib-global.mk does but not sure if the path is correct, I can try changing the path in the Makefile but not sure.
These are the contents of the Makefile file:
# contrib/pg_trgm/Makefile
MODULE_big = pg_trgm
OBJS = trgm_op.o trgm_gist.o trgm_gin.o trgm_regexp.o $(WIN32RES)
EXTENSION = pg_trgm
DATA = pg_trgm--1.3--1.4.sql \
pg_trgm--1.3.sql pg_trgm--1.2--1.3.sql pg_trgm--1.1--1.2.sql \
pg_trgm--1.0--1.1.sql pg_trgm--unpackaged--1.0.sql
PGFILEDESC = "pg_trgm - trigram matching"
REGRESS = pg_trgm pg_word_trgm pg_strict_word_trgm
REGRESS_OPTS += --init-file=$(top_srcdir)/src/test/regress/init_file
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pg_trgm
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
I have checked out the code in my /tmp folder and it created the structure under /tmp/gpdb
UPDATE:
I did follow Bradford suggestions and was able to compile and install, however, I'm getting this when I run:
create extension pg_trgm;
ERROR: could not open extension control file "/usr/local/greenplum-db-6.13.0/share/postgresql/extension/pg_trgm.control": No such file or directory (seg57 172.28.8.8:6001 pid=146663)
I did run manually once I ran the make and make install:
/usr/bin/install -c -m 755 pg_trgm.so '/usr/local/greenplum-db-6.13.0/lib/postgresql/pg_trgm.so'
/usr/bin/install -c -m 644 pg_trgm.control '/usr/local/greenplum-db-6.13.0/share/postgresql/extension/'
/usr/bin/install -c -m 644 pg_trgm--1.1.sql pg_trgm--1.0--1.1.sql pg_trgm--unpackaged--1.0.sql '/usr/local/greenplum-db-6.13.0/share/postgresql/extension/'
I can see the .control file in there so not sure what's going on, it seems it was copied only to the master but not the segment hosts, would that be an issue? Do I need to compile this on every segment host?
UPDATE:
I did install on each segment and now I'm getting this:
SQL Error [0A000]: ERROR: query plan with multiple segworker groups is not supported
Hint: likely caused by a function that reads or modifies data in a distributed table
would this extension not be supported by greenplum?
At a high level, you will want to download the source for the release of GPDB that you are running. You can do this either by downloading the tarball from the GitHub release page or cloning the repository and checking-out the release tag.
Once you have done that, source greenplum_path.sh from your installation of GPDB, change into the the contrib/pg_trgm directory and run
USE_PGXS=true make
USE_PGXS=true make install
Setting USE_PGXS will pull in the missing Makefiles from the installation of GPDB.
If the install location of GPDB is not owned by gpadmin user, then the make install will fail for permission issues; using sudo make install will most likely fail because pg_config won't be found on the path. In that case, I just run make -n install and then manually run the commands prefixed with sudo.
Here are all the steps in a psuedo-shell session:
git clone https://github.com/greenplum-db/gpdb.git
cd gpdb
# use git checkout 6.13.0 for older versions of git
git switch --detach 6.13.0
git submodule update --init --recursive
source /usr/local/greenplum-db-6.13.0/greenplum_path.sh
cd contrib/pg_trgm
USE_PGXS=true make
USE_PGXS=true make -n install
Edit: I should clarify that I haven't tested if pg_trgm works with GPDB, only that it builds and compiles.

env: ‘go’: No such file or directory make: *** [Makefile:43: build] Error 127?

https://github.com/ChainSafe/ChainBridge
Why does this command not work?
make build
I cloned the repo locally, cd'd into the right folder; all I get back in the Git CLI is
> \033[32mBuilding binary...\033[0m
cd cmd/chainbridge && env GOARCH=amd64 go build -o ../../build/chainbridge -ldflags="-X main.Version=v.1.1.2-2-g6f55404"
env: ‘go’: No such file or directory
make: *** [Makefile:43: build] Error 127
I downloaded Go for Windows 10 64 bit, version 1.16.4
With Go, you don't really need to use Makefiles anymore. I think people just do it out of habit. I don't agree with the practice, as Go is a new language, and I don't like to see people misuse it by continuing to work with old crappy tools from the past. To that end, you can just download the code, then change location to:
cmd\chainbridge
Then run:
go build
I know this works, as I just did it with go version go1.16.3 windows/amd64. Also, you need to make sure go.exe is on your PATH. You probably need to add C:\go\bin or similar.

golangci-lint run command shows errors in makefile

I have created a make file to run some bash commands for Go.
This is check.sh file
This is my make file
Error is : make: *** [Makefile:23: check] Error 1
How can I solve this issue?
According to this stackoverflow answer that happens if one of the commands exits with exit code != 0. That is the case if golangci-lint finds something to complain about.
Try putting the call to golangci-lint directly in the make file.
From my Makefiles:
lint:
golangci-lint run
Have you created mod file in the root folder ?
go mod init <root folder /Application Name>
if yes, check for the bin folder if the specified package is installed, if not install the package ,
go install github.com/golangci/golangci-lint/cmd/golangci-lint#latest
Then add it in make file
lint:
golangci-lint run

How to find a Go package installed with 'go get -u' when no $GOPATH is defined?

I'm following the gRPC Quickstart tutorial for Go, https://grpc.io/docs/quickstart/go/, and have installed gRPC using the command
go get -u google.golang.org/grpc
I actually haven't defined a GOPATH environment variable:
> echo $GOPATH
which, as I understand it, means that it defaults to ~/go, or in my case /Users/kurt/go.
At the next step, I'd like to build the example by doing
cd $GOPATH/src/google.golang.org/grpc/examples/helloworld
However, I find that the directory doesn't exist, and there is also no google.golang.org directory in /Users/kurt/go/src:
~/g/src> ls *google*
fish: No matches for wildcard '*google*'. See `help expand`.
ls *google*
^
Should the package not be located here? That's what I understand from Where does go get install packages?.
Using Go Modules, you can find 'go get' downloaded files at:
~/go/pkg/mod/cache/download
However, it should be treated like an immutable copy of the source code.
If you want a mutable copy of the source code, you should clone the repository:
git clone https://github.com/grpc/grpc-go
In your example output, you are in ~/g/arc
Go path default would be ~/go/src
I think auto complete bit ya there
In the end, I worked around the problem by cloning https://github.com/grpc/grpc-go which appears to contain the examples/helloworld directory I'm looking for. Still curious to hear where the package downloaded with go get is located.

Trouble installing and running elasticsearch

Yes, I have thoroughly searched for another answer to this question but have yet to find one.
I tried installing first by following the instructions on this page: http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
I am not sure what to do after this step. It seems that is has installed correctly, but I don't know how to run it. (I am using PuTTY.) Can I import it into my module now and being using it, or is there something else I should do?
Here are some attempts I've made:
deloacha#azdev-deloacha:~$ bin/elasticsearch.bat
-bash: bin/elasticsearch.bat: No such file or directory
deloacha#azdev-deloacha:~$ cd elasticsearch-1.5.1/bin
-bash: cd: elasticsearch-1.5.1/bin: No such file or directory
deloacha#azdev-deloacha:~$ cd elasticsearch-1.5.1
-bash: cd: elasticsearch-1.5.1: No such file or directory
deloacha#azdev-deloacha:~$ cd ..
deloacha#azdev-deloacha:/home$ cd elasticsearch-1.5.1
-bash: cd: elasticsearch-1.5.1: No such file or directory
Installing the way as provided in the document can sometimes leads to confusion. You need to find the directory containing the elasticsearch files. most probably it'll be at "/etc/elast...."
Another easy way of installation follow the steps:
make a directory where you want to install
go to that directory and download elasticsearch there using
wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.5.1.tar.gz or curl
extract files: tar -zxvf elasticsearch-1.5.1.tar.gz
cd elasticsearch-1.5.1
You need to have java 7 on your system. you can start elasticsearch using "bin/elasticsearch -d" . "-d" is to run in detached mode.
Logs are by default in the location elasticsearch-1.5.1/logs. Check logs for any error during start up.
check status at: http://localhost:9200 or http://{system ip}:9200

Resources