rmfakecloud icon indicating copy to clipboard operation
rmfakecloud copied to clipboard

MacOS support

Open iilyak opened this issue 4 years ago • 5 comments

Is it possible to build on MacOS for MacOS (given all build tools installed)?

What about M1 based mac?

iilyak avatar Feb 23 '22 21:02 iilyak

it should be possible

ddvk avatar Feb 24 '22 21:02 ddvk

Some notes from trying this out on x86 macOS Catalina (10.15.7) - a few things don't work quite as documented:

Building

  • node, yarn, and go installed from HomeBrew
$ node --version
v19.1.0
$ yarn --version
1.22.19
$ go version
go version go1.19.4 darwin/amd64
  • Docker Destkop installed from docker.com
  • make all fails as go on macOS no longer supports armv6 and armv7; removed those from the list of targets.
  • make container (rather than make docker)
    • this assumes that the dist/rmfakecloud-docker is a Linux x64 binary, which it won't be - it'll be a Mac binary. Modifying the Makefile to explicitly create rmfakecloud-docker as a Linux binary fixes this.
  • ~~running dockerbuild.sh crashes out for reasons I'm not clear on and haven't debugged as yet - possibly it's a similar Linux/MacOS problem as the make container build.~~

Running

  • ~I haven't tried running "native", but it looks like~ the build above produces a working native binary.
  • running in current Docker Desktop requires that the data directory is specified as an absolute path, not a relative one
  • ~~the current (as of 2022-12-27) downloadable Docker container (ddvk/rmfakecloud) isn't up-to-date with the GitHub version so may give various errors (probably not a macOS-specific issue!)~~ fixed in latest commits
  • I've not so far gotten the handwriting recognition to work - the API call to MyScript returns a certificate error which I've not tracked down this seems to only affect the docker build I tried; it works fine in the native build
  • ~~PDF view also doesn't appear to work - again, I've not tracked this down but it looks like something is getting passed as null somewhere along the way and that's breaking the renderer.~~ there's a couple of cosmetic issues here but the main one appears to be a mistaken assumption on my part that the web UI would render all documents. If I put a PDF into the reMarkable then it shows up correctly in this view.

Now, having said all of the above: the important parts of this (for me, at least) work: it's syncing my documents as expected and I can manually hack about with them on the filesystem for the moment. I'll see if I can debug further to understand why a few things aren't working, but this is a combination of environments that I'm either new to or not very familiar with.

Hope this helps!

Dobrin, if I can provide more useful feedback (e.g. if there's a debug mode I can enable or whatever) let me know.

waider avatar Dec 27 '22 21:12 waider

Further update:

  • the native macOS binary works just fine
  • handwriting recognition via MyScript works with the native binary (the certificate error I mentioned came from running inside docker)

waider avatar Dec 28 '22 09:12 waider

  • running dockerbuild.sh crashes out for reasons I'm not clear on and haven't debugged as yet - possibly it's a similar Linux/MacOS problem as the make container build.

latest update (2022-12-31) fixes this.

waider avatar Dec 31 '22 13:12 waider

Here's a patch to address some of the issues I identifed above. Building a specific -darwin binary isn't strictly necessary, mind; I just put that in for completeness.

(this is from a local branch - I haven't cloned this repo to my own space to generate a PR.)

commit 23f8808f647168519a827acfc652d9dde6b30333 (HEAD -> local)
Author: Ronan Waide <[email protected]>
Date:   Tue Dec 27 14:53:00 2022 +0000

    macOS support: disable unsupported build targets, add specific darwin target, make Docker target explicitly Linux x64
    
    This addresses a number of issues identified in https://github.com/ddvk/rmfakecloud/issues/153:
    * current versions of go on macOS do not support armv6 & armv7 targets.
    * the Makefile `container` target was assuming that the `rmfakecloud-docker` binary was a Linux x64 binary; this was not the case on macOS.
    * there was no macOS (darwin) binary in the list of builds.

diff --git a/Makefile b/Makefile
index bcd7360..e41c2f6 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,11 @@ GOFILES += $(ASSETS)
 UIFILES := $(shell find ui/src)
 UIFILES += $(shell find ui/public)
 UIFILES += ui/package.json
-TARGETS := $(addprefix $(OUT_DIR)/$(BINARY)-, x64 armv6 armv7 arm64 win64 docker)
+TARGETS := $(addprefix $(OUT_DIR)/$(BINARY)-, x64 arm64 win64 docker darwin)
+# recent versions of go will not build armv6/armv7 on macOS.
+ifneq ($(shell go env GOOS),darwin)
+TARGETS += $(addprefix $(OUT_DIR)/$(BINARY)-, armv6 armv7)
+endif
 YARN   = yarn --cwd ui  
 
 .PHONY: all run runui clean test testgo testui
@@ -34,12 +38,15 @@ $(OUT_DIR)/$(BINARY)-win64:$(GOFILES)
 $(OUT_DIR)/$(BINARY)-arm64:$(GOFILES)
        GOARCH=arm64 $(BUILD)
 
+$(OUT_DIR)/$(BINARY)-darwin:$(GOFILES)
+       GOOS=darwin $(BUILD)
+
 $(OUT_DIR)/$(BINARY)-docker:$(GOFILES)
-       CGO_ENABLED=0 $(BUILD)
+       GOOS=linux CGO_ENABLED=0 $(BUILD)
 
 container: $(OUT_DIR)/$(BINARY)-docker
        docker build -t rmfakecloud -f Dockerfile.make .
-       
+
 run: $(ASSETS)
        go run $(CMD) $(ARG)
 

waider avatar Jan 01 '23 11:01 waider