Trying to compile for FreeBSD
env GOOS=freebsd GOARCH=amd64 go build
# github.com/kopia/kopia/snapshot/restore
snapshot/restore/local_fs_output.go:131:33: undefined: symlinkChmod
snapshot/restore/local_fs_output.go:131:47: undefined: symlinkChown
snapshot/restore/local_fs_output.go:131:61: undefined: symlinkChtimes
I am able to build on Ubuntu machine if I just do go build
$go build
$./kopia --version
v0-unofficial build: unknown
And this is the code that is causing the problem
// symbolic links require special handling that is OS-specific and sometimes unsupported
// os.* functions change the target of the symlink and not the symlink itself.
if isSymlink(e) {
osChmod, osChown, osChtimes = symlinkChmod, symlinkChown, symlinkChtimes
}
Any ideas or suggestions on how to solve the issue?
Looking for one of those variables:
$grep -r symlinkChmod
snapshot/restore/local_fs_output_linux.go:func symlinkChmod(path string, mode os.FileMode) error {
snapshot/restore/local_fs_output_darwin.go:func symlinkChmod(path string, mode os.FileMode) error {
snapshot/restore/local_fs_output_windows.go:func symlinkChmod(path string, mode os.FileMode) error {
snapshot/restore/local_fs_output.go: osChmod, osChown, osChtimes = symlinkChmod, symlinkChown, symlinkChtimes
Don’t see a definition for FreeBSD. Does that mean it is unsupported?
julio
December 11, 2020, 1:03am
3
It is not officially supported. Without continuous integration testing for the platform one cannot confidently say it would work.
Nevertheless, there is a draft PR (#714 in the kopia repo) that you are welcome try out and may allow you to build kopia for FreeBSD.
Without continuous integration testing for the platform one cannot confidently say it would work.
What is the issue on that part? Github doesn’t support the continuous integration for FreeBSD?
Are there any instructions on how to do the tests manually?
When doing make how would I specify different OS target?
Oh. Thought you had bsd box.
If easiest way is to install Go on FreeBSD machine can do that.
Was trying to build from an Ubuntu machine for a FreeBSD target.
julio
December 16, 2020, 12:19am
9
Francisco, I assume you can check out the specific branch from git. But if not, assuming you have already cloned the kopia git repo, then you can check out the changes with:
# Check out PR changes
git fetch kopia refs/pull/714/head
git checkout -b pr/714 FETCH_HEAD
Then building on a BSD box should be a matter of just running make
as Jarek mentioned.
You can also quickly test whether or not it builds using from a different OS using the following:
# only builds the CLI with no UI
make -e GOOS=freebsd install-noui
What you originally used should also work:
env GOOS=freebsd GOARCH=amd64 go build
Hope this helps.
Hi @julio , I’ve tried applying your PR changes to the 0.8 release, but I’m getting this:
$ make -e GOOS=freebsd install-noui
go install -ldflags "-s -w -X github.com/kopia/kopia/repo.BuildVersion=20210411.0.0-50fac71a -X github.com/kopia/kopia/repo.BuildInfo=50fac71a32a26d81418c1df22047e307194ae4e8 -X github.com/kopia/kopia/repo.BuildGitHubRepo="
# github.com/hanwen/go-fuse/v2/fuse
../../../go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.0.4-0.20210104155004-09a3c381714c/fuse/api.go:218:41: undefined: GetAttrIn
../../../go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.0.4-0.20210104155004-09a3c381714c/fuse/api.go:219:41: undefined: SetAttrIn
../../../go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.0.4-0.20210104155004-09a3c381714c/fuse/api.go:222:39: undefined: MknodIn
../../../go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.0.4-0.20210104155004-09a3c381714c/fuse/api.go:246:42: undefined: SetXAttrIn
../../../go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.0.4-0.20210104155004-09a3c381714c/fuse/api.go:252:40: undefined: CreateIn
../../../go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.0.4-0.20210104155004-09a3c381714c/fuse/api.go:254:38: undefined: ReadIn
../../../go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.0.4-0.20210104155004-09a3c381714c/fuse/api.go:263:39: undefined: WriteIn
../../../go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.0.4-0.20210104155004-09a3c381714c/fuse/api.go:272:41: undefined: ReadIn
../../../go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.0.4-0.20210104155004-09a3c381714c/fuse/types.go:550:2: undefined: Attr
../../../go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.0.4-0.20210104155004-09a3c381714c/fuse/types.go:578:2: undefined: Attr
../../../go/pkg/mod/github.com/hanwen/go-fuse/v2@v2.0.4-0.20210104155004-09a3c381714c/fuse/api.go:272:41: too many errors
make: *** [Makefile:51: install-noui] Error 2
I’m building on Linux using Go version 1.16.3. I guess we should exclude Fuse support, as it is for Windows for example. Unfortunately I have no Go skills (yet). Do you have any hints? Thanks.
I’d really like to use Kopia to backup TrueNAS contents, this is the reason I’m trying to get a FreeBSD build.
I’m bringing the discussion on GitHub: I think it’s a better place for a technical discussion, and it will also have a higher visibility in case some developer would be interested in working on it.
julio
April 12, 2021, 4:44pm
12
The patch referenced above worked at that point in time. As Jarek mentioned in the GH issue, the FUSE implementation currently in use does not support FreeBSD.
The nightly FreeBSD builds (experimental, untested, use-at-your-risk kind of a thing) will now be available at https://github.com/kopia/kopia-test-builds/releases/latest
If somebody has experience with FreeBSD (and/or other BSD variants of which there’s quite a lot) and would like to work on maintaining and testing that build, we’d really appreciate help and expertise here. Setting up a full CI/CD pipeline would be great.