Hello David. Unfortunately not all packages that are available from GitHub and other sources work out-of-the-box on all platforms. Some do, for sure, but often they need to be ported to a given platform, such as z/OS. We have posted some rudimentary porting instructions here:
https://www.ibm.com/docs/en/sdk-go-zos/1.16?topic=porting-applications-zos. I took a quick look at git-lfs, and noted the following steps that would need to be taken to get this ported (there may be others, but these are the ones I caught on a first look):
First, the dependency
github.com/olekukonko/ts needs to be ported. It uses a raw syscall that isn't supported on z/OS. To port it, I got the code, added a !zos build tag to ts_other.go and ts_x.go, then created a ts_zos.go based on ts_solaris.go (put in a build tag and changed TIOCGWINSZ to syscall.TIOCGWINSZ). I use "go mod edit -replace" on the git-lfs go.mod file to point to the location of my updated packages. Sometimes I have to do "go mod init" on those packages if they don't have a go.mod file. There is another issue --- git-lfs is using int32 for file mode instead of uint32 -- this has to be changed in several places, the reason being that on z/OS it truly is a uint32. I also found that github/mattn/go-isatty had to have it's go.mod file updated to use "latest' for x/sys/unix. So, as I said, this is what a cursory look told me - there may be other things that need to be done to finish the porting of git-lfs. If you follow through with these steps you can get a working git-lfs on z/OS. I hope that helps. ...Bill------------------------------
Bill O'Farrell
------------------------------
Original Message:
Sent: Wed July 07, 2021 09:50 PM
From: David Crayford
Subject: Compile failures build git-lfs
We (Rocket Software) are trying to build git-lfs on z/OS. The build fails with the following errors.
GOOS= GOARCH= go generate github.com/git-lfs/git-lfs/commands
GOOS=zos GOARCH=s390x go build -ldflags=" -X github.com/git-lfs/git-lfs/config.GitCommit=38ae601d -s -w " -gcflags="all=-trimpath="$HOME" " -asmflags="all=-trimpath="$HOME"" -trimpath -o ./bin/git-lfs ./git-lfs.go
# github.com/olekukonko/ts
../go/pkg/mod/github.com/olekukonko/ts@v0.0.0-20171002115256-78ecb04241c0/ts_x.go:19:14: undefined: syscall.Syscall
# github.com/git-lfs/gitobj/v2
../go/pkg/mod/github.com/git-lfs/gitobj/v2@v2.0.1/tree.go:212:20: constant 4278190080 overflows int32
Makefile:246: recipe for target 'bin/git-lfs' failed
make: *** [bin/git-lfs] Error 2
------------------------------
David Crayford
------------------------------