Rclone build on AIX 7.2

Hi,

I am trying to build rclone (latest if possible) on AIX 7.2 (powerpc).
It works pretty well when building on Red Hat Linux - however building on AIX fails with compiler errors:

root@xxxxxx\(xxxx\):/tmp/go/rclone $ go build -trimpath -ldflags -s
# github.com/atotto/clipboard
../pkg/mod/github.com/atotto/clipboard@v0.1.4/clipboard.go:10:9: undefined: readAll
../pkg/mod/github.com/atotto/clipboard@v0.1.4/clipboard.go:15:9: undefined: writeAll
# github.com/rclone/rclone/fs/log
fs/log/redirect_stderr_unix.go:17:6: redirectStderr redeclared in this block
        /tmp/go/rclone/fs/log/redirect_stderr.go:15:24: previous declaration
# github.com/rclone/rclone/backend/local
backend/local/local.go:1362:9: o.readMetadataFromFile undefined (type *Object has no field or method readMetadataFromFile)
root@xxxxxx\(xxxx\)/tmp/go/rclone $ go version
go version go1.17.12 aix/ppc64

I am not sure if the golang compiler is a bit pickier on AIX than on Linux - however, I am not sure how to handle such errors from depending libraries like atotto.
Any known workarounds?

BR
Marcel

ok for the first two error I resolved: adding aix (or !aix) in the +build list solved the issue:

../pkg/mod/github.com/atotto/clipboard\@v0.1.4/clipboard_unix.go
rclone/fs/log/redirect_stderr.go

However the other error remains:

root@xxxxxx\(xxxxx\):/tmp/go/rclone $ go build
backend/local/local.go:1362:9: o.readMetadataFromFile undefined (type *Object has no field or method readMetadataFromFile)

Obviously, the error relates to the local file system backend plugin. Seems like AIX has its own way of getting file metadata.
As a workaround, I removed the local backend from

/rclone/backend/all/all.go

I now have a rclone executable. I will do further tests tomorrow.

1 Like

AIX isn't one of the OSes we compile for normally.

Here is the list of the ones we do: rclone/cross-compile.go at 7a24c173f6669172d845221c7e37e5824fa13fb7 · rclone/rclone · GitHub

What does go env print on AIX?

Adding and removing build constraints is the correct way to fix the build.

As for the read metadata, probably adding aix in here rclone/metadata_unix.go at master · rclone/rclone · GitHub should be the right thing to do and add !aix in the other metadata*.go files. If that doesn't work, then add it into metadata_other.go

go env

:/tmp/go $ go env
GO111MODULE=""
GOARCH="ppc64"
GOBIN=""
GOCACHE="/.cache/go-build"
GOENV="/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="ppc64"
GOHOSTOS="aix"
GOINSECURE=""
GOMODCACHE="/tmp/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="aix"
GOPATH="/tmp/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/freeware/lib/golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/freeware/lib/golang/pkg/tool/aix_ppc64"
GOVCS=""
GOVERSION="go1.17.12"
GCCGO="/opt/freeware/bin/gccgo"
GOPPC64="power8"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -maix64 -pthread -mcmodel=large -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3193259906=/tmp/go-build -gno-record-gcc-switches"

I already played around with the metadata_*.go files.
Adding aix to metadata_unix.go results in

:/tmp/go/rclone $ go build -trimpath -ldflags -s
# github.com/rclone/rclone/backend/local
backend/local/metadata_unix.go:34:23: cannot use stat.Atim (type syscall.StTimespec_t) as type syscall.Timespec in argument to setTime
backend/local/metadata_unix.go:35:23: cannot use stat.Mtim (type syscall.StTimespec_t) as type syscall.Timespec in argument to setTime

however adding aix to metadata_other.go and !aix all others seems to work - no compiler errors!

I will do some testing later that day. Thanks a lot! :star_struck:

Ok were are not there yet. I just found out that the mount command is not available.

Damn - seems like AIX does not support fuse. No port is available for AIX.
is Bazil maybe still supported - since they state they do not rely on the C FUSE Library?

No FUSE support sounds like no support in the kernel rather than the userspace library?

If there is kernel support for FUSE but no libfuse then compiling cmd/mount is the way to go. Though cmd/cmount uses libfuse and is probably more reliable.

AIX doesn't seem to have kernel support for fuse.
I was able to use rclone for sftp, s3 and others. Mounting is not possible due to missing kernel support for fuse.

I will open a support case with IBM to get a final answer.

1 Like

Do you want to send a PR with the fixes for AIX?

I could add it to the build tester also.

I will try to create a PR. The only things I changed, are build tags. However, I also changed build-tags in atotto (depending library).
I guess I need to create a second PR for the atotto repository.

Great

Or use build tags to compile out that feature in rclone.

I created a PR for atotto.
I will also create one for rclone. Will take some time for testing.

Sorry I am not that knowledgeable with go build pipelines,etc.
Can you elaborate on how to exclude the clipboard feature with build tags?

nevermind - I figured it out.
PR created= Installing from Source: AIX support by MFriedmann · Pull Request #6344 · rclone/rclone · GitHub

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.