cryptonote-social / csminer

csminer Monero miner from https://cryptonote.social/
GNU General Public License v3.0
58 stars 24 forks source link

update code to work with go modules enabled #14

Open kevcrumb opened 1 year ago

kevcrumb commented 1 year ago

Trying to update the csminer Split Linux package, go build linux/csminer.go results in these errors:

linux/csminer.go:9:2: no required module provides package github.com/cryptonote-social/csminer: go.mod file not found in current directory or any parent directory; see 'go help modules'
linux/csminer.go:10:2: no required module provides package github.com/cryptonote-social/csminer/crylog: go.mod file not found in current directory or any parent directory; see 'go help modules'
linux/csminer.go:11:2: no required module provides package github.com/godbus/dbus: go.mod file not found in current directory or any parent directory; see 'go help modules'

Roughly two years ago, the instructions outlined in the following package template would result in a successful build, but now the go get commands seem to be outdated.

https://gitlab.com/kevcrumb/split-packages/-/blob/31e905090be9ee2a9dd9ab88bc0b1c918718ae40/srcpkgs/csminer/template#L28

cryptonote-social commented 1 year ago

thanks for the report. Yes the codebase is not "module" enabled as required by newer golang releases. You should be able to compile it by disabling modules as follows:

GO111MODULE=off go build ......

Will leave this open as a reminder to update the source with go.mod support.

kevcrumb commented 1 year ago

The errors are now:

linux/csminer.go:9:2: cannot find package "github.com/cryptonote-social/csminer" in any of:
        /usr/lib/go/src/github.com/cryptonote-social/csminer (from $GOROOT)
        /home/k/go/src/github.com/cryptonote-social/csminer (from $GOPATH)
linux/csminer.go:10:2: cannot find package "github.com/cryptonote-social/csminer/crylog" in any of:
        /usr/lib/go/src/github.com/cryptonote-social/csminer/crylog (from $GOROOT)
        /home/k/go/src/github.com/cryptonote-social/csminer/crylog (from $GOPATH)
linux/csminer.go:11:2: cannot find package "github.com/godbus/dbus/v5" in any of:
        /usr/lib/go/src/github.com/godbus/dbus/v5 (from $GOROOT)
        /home/k/go/src/github.com/godbus/dbus/v5 (from $GOPATH)

None of the paths actually exist. I remember there was always some hassle about setting these env vars when compiling Go, but I've forgotten the specifics.

kevcrumb commented 1 year ago

I found my notes with your(?) hints from back then:

You should have a directory named "src" where you will use git clone to check out csminer. Then set your GOPATH to the directory that contains the "src" directory. E.g. I have /home/cs/src where i run "git clone" from. Then my GOPATH is just /home/cs then I can cd /home/cs/src/github.com/cryptonote-social/csminer/linux go build -a csminer.go

It works:

cd /tmp

git clone https://github.com/cryptonote-social/RandomX.git &&
mkdir -p RandomX/build && cd RandomX/build/ &&
cmake .. && make && cd ../rxlib/ && ./make.sh && cd ../../

git clone https://github.com/cryptonote-social/csminer
cd csminer
GOPATH=${PWD%/*} go build linux/csminer.go
kevcrumb commented 1 year ago

It turned out, that it was not the GOPATH that made compilation successful, but apparently some other commands I had executed during trail-and-error.

Anyway, the necessary steps are documented in the updated package template file linked below and csminer version 0.3.3 is now available in the Split Linux x86_64 repository.

https://gitlab.com/kevcrumb/split-packages/-/blob/23402c9e37dc67318a9eb6a89102698aa8647154/srcpkgs/csminer/template#L28