Closed romanrm closed 5 years ago
It seems that people who work in Go assume it is trivial, while for the rest of us, it is not.
Some people come here because they found a particular project they needed which happened to be in written Go (me included), which they are not familiar with.
Here is what I came up with: First, create a ~/.profile (or append to an existing ~/.profile):
export GOPATH="$HOME/go_projects"
export GOBIN="$GOPATH/bin"
export GOROOT=/usr/lib/go-1.7
export PATH=$PATH:$GOROOT/bin:$GOBIN
Open a new shell to make sure these are set, or simply source ~/.profile.
Run the following sequence of commands:
mkdir -p ~/go_projects/{bin,src,pkg}
mkdir -p ~/go_projects/src/github.com/dop251
cd ~/go_projects/src/github.com/dop251
git clone https://github.com/dop251/diskrsync.git diskrsync
go get github.com/dop251/diskrsync
go build github.com/dop251/diskrsync
go install github.com/dop251/diskrsync/diskrsync
# cp -p ~/go_projects/bin/diskrsync /usr/local/bin
The last line is optional.
This exact receipt worked for me.
Notice that on 2 distributions I worked with (armbian on an A20-based PCduino3nano board, and an odroid HC2 running Ubuntu 16.04) the default go version was 1.3 and 1.6 respectively, which failed to compile the program (with different errors each time).
I had to specifically install golang-1.7 on the armbian board to get it to cleanly compile.
(Fix the GOROOT value above for your Go compiler's location).
Since the resulting binary is not dynamically loded (no dependency on any .so files), I then simply copied the binary to the odroid (also ARM based), which should work on ANY ARM distro since it has no dependency on any distro-specific .so file.
@udif Thanks! This is exactly what I meant.
Thanks again, udif. On Debian Buster/Sid and Debian 9, the following procedure worked, and it will probably work on Ubuntu and other Debian derivatives.
Note: Be sure to install on both the source and target hosts! If diskrsync is not found on the remote server, this message appears:
bash: /usr/local/ch-tools3/diskrsync: No such file or directory
Install procedure:
(1) sudo apt-get install golang
(2) As root (if necessary) put the following script in dir-in-PATH/install_diskrsync.txt (below script contains minor refinements of udif's script, above).
(3) sudo chmod +x dir-in-PATH/install_diskrsync.txt
(4) sudo dir-in-PATH/install_diskrsync.txt
Hello,
Could you please add some instructions on what are the build dependencies and how to compile the app?
Thanks.