jstaf / onedriver

A native Linux filesystem for Microsoft OneDrive
GNU General Public License v3.0
1.86k stars 91 forks source link

I can't compile it #336

Closed abtye closed 1 year ago

abtye commented 1 year ago

My device only has 7GB of storage space, and OneDriver is of great significance to it. Its CPU is based on the armhf architecture, and it can also run armv7l or amrv6l code. But it can't run the code for arm64 I cannot compile it on my own, the following is the error message:

CGO_CFLAGS=-Wno-deprecated-declarations go build -v \
    -ldflags="-X github.com/jstaf/onedriver/cmd/common.commit=e2ef1e48e938c3c383e159701a6f8289723bb73a" \
    ./cmd/onedriver
github.com/jstaf/onedriver/fs
# github.com/jstaf/onedriver/fs
fs/content_cache.go:32:16: undefined: os.ReadFile
fs/content_cache.go:38:9: undefined: os.WriteFile
make: *** [Makefile:21:onedriver] Error 2

To be honest, I don't understand GoLang, so I can only rely on you, man, help me!

jstaf commented 1 year ago

What does go --version show? I'm guessing I was somewhat naughty recently and used newer Golang features (1.16+), and your installed version of Golang is too old.

Never fear however - you have two options:

abtye commented 1 year ago

I have updated the version of GoLang, and its current version isgo version go1.20.5 Linux/arm. There are no errors reported now, but I compiled for an hour and still haven't completed the compilation

CGO_ CFLAGS=- No reported declarations go build - v\
-Ldflags="- X github. com/jstaf/onedriver/cmd/common. common=e2ef1e48e938c3c383e159701a6f8289723bb73a"\
./cmd/onedriver
Github. com/gotk3/gotk3/gtk

It has been parked here for an hour.

jstaf commented 1 year ago

lol, gotk3 (the Go bindings for the GTK GUI framework) just takes forever to compile. Just let it do its thing and it will eventually finish. It takes me about 15 minutes to compile on a semi-fast laptop. But you're not alone, just need to wait!

If your device doesn't need a GUI, you can get a super fast/normal compile time by setting export CGO_ENABLED=0 (this will disable the GUI, but if you're doing things on a raspberry pi or other server-like environment that doesn't have a UI, this is probably fine).