I’am working on a iOS Port of Syncthing, i am able now after some weeks to compile go source for iOS arm & arm64, now i can compile go source as a library like a go-output.a file with c header like _cgo_export.h and run go code on iOS Devices.
In the next weeks i will puplish the workaround how to do this for go source on iOS.
But now i need a little bit help to compile Syncthing
//THIS IS JUST A BASIC EXAMPLE WHAT I MUST DO
For Compile:
C Header _cgo_export.h is now generated with link to iosmain() xcode
Build for arm64 looks also fine, when i run it, it shows be “Bad CPU…”, is a good sign!
Next step:
-ldflags ‘-tmpdir …/go-obj -linkmode external’ this makes troubles because i can use it in the console, i must find the ldflags and adjust it in Syncthing.
i fixed now a lot of stuff puhhh… so compile is done… and no errors anymore…just some warnings about icons… nothing important right now.
when i start the iOS App, i get permission denied error, i think this happend because it try to generate the config.xml and the ssh key’s… right?
Where i can find this part to adjust this parts… on ios i must move all to the Documents folder dynamically, this is the only folder which Apple allows me to create or modify files inside the sandbox.
-no-restart at this time is not possible… see monitor.go… because it fails on first start… forc/exec is not allowed, just threads on iOS…
Infoln("Starting syncthing")
err = cmd.Start()
if err != nil {
Infoln("1 Starting failed!!!!!!!!!!!")
Fatalln(err)
}
// Let the next child process know that this is not the first time
// it's starting up.
os.Setenv("STRESTART", "yes")
Say hello to Syncthing from Go!
2015-07-06 17:40:52.552 IDZWebBrowser[1366:329658] Hello to Syncthing from Object C!!!
------------------WebServer--------------
Now lets run the Webserver!
------------------WebServer--------------
[start] 16:40:52 INFO: Generating RSA key and certificate for syncthing…
2015-07-06 17:40:54.868 IDZWebBrowser[1366:329658] -[IDZWebBrowserViewController updateButtons] loading = YES
2015-07-06 17:40:55.035 IDZWebBrowser[1366:329658] -[IDZWebBrowserViewController updateButtons] loading = NO
[K2HOG] 16:41:13 INFO: syncthing unknown-dev (devel +300d9a2 Tue Jun 30 22:56:30 2015 +0000 darwin-arm64 default) unknown@unknown 1970-01-01 00:00:00 UTC
[K2HOG] 16:41:13 INFO: My ID: K2HOGDV-2CD2P3N-LYNRWIW-T6XJAKR-HOZOCSY-ZFQT4NX-DH3IYBB-EH7IWAG
[K2HOG] 16:41:13 INFO: No config file; starting with empty defaults
[K2HOG] 16:41:13 INFO: Edit /private/var/mobile/Containers/Data/Application/8D2A1F26-4DD8-4027-BDC7-CC199DD249F8/Library/Application Support/Syncthing/config.xml to taste or use the GUI
[K2HOG] 16:41:13 INFO: Starting deadlock detector with 20m0s timeout
[K2HOG] 16:41:13 OK: Ready to synchronize default (read-write)
[K2HOG] 16:41:13 INFO: Starting web GUI on http://127.0.0.1:8384/
[K2HOG] 16:41:13 INFO: Loading HTTPS certificate: open /private/var/mobile/Containers/Data/Application/8D2A1F26-4DD8-4027-BDC7-CC199DD249F8/Library/Application Support/Syncthing/https-cert.pem: no such file or directory
[K2HOG] 16:41:13 INFO: Creating new HTTPS certificate
[K2HOG] 16:41:13 INFO: Generating RSA key and certificate for iPhone-von-Saber-Gilani…
[K2HOG] 16:41:13 WARNING: Stopping folder “default” - mkdir /private/var/mobile/Containers/Data/Application/8D2A1F26-4DD8-4027-BDC7-CC199DD249F8/Sync: operation not permitted
[K2HOG] 16:41:13 INFO: Skipping folder default scan due to folder error: mkdir /private/var/mobile/Containers/Data/Application/8D2A1F26-4DD8-4027-BDC7-CC199DD249F8/Sync: operation not permitted
[K2HOG] 16:41:18 INFO: Starting local discovery announcements
[K2HOG] 16:41:18 INFO: Starting global discovery announcements
[K2HOG] 16:41:18 INFO: API listening on 127.0.0.1:8384
[K2HOG] 16:41:18 INFO: Device K2HOGDV-2CD2P3N-LYNRWIW-T6XJAKR-HOZOCSY-ZFQT4NX-DH3IYBB-EH7IWAG is “iPhone-von-Saber-Gilani” at [dynamic]
[K2HOG] 16:41:18 INFO: No automatic upgrades; unknown-dev is not a release version.
[K2HOG] 16:41:31 INFO: New UPnP port mapping: external port 8712 to local port 22000.
I moved now all config and cert files to the iOS Documents Folder, now i am able to change the config add a new device or folder, because the document folder is write able.
But still i have a problem:
[KRYMQ] 13:58:23 INFO: Skipping folder default scan due to folder error: mkdir /private/var/mobile/Containers/Data/Application/CEE251AF-4A07-4890-945A-37EE25BFE81A:
I must change this to also to the documents folder like:
I know this is a possible way but do you like really this workaround with syncthing -generate ?
I think it more (nice) to modify the default config which Syncthing generates by first lunch after ssh cert generation.
And for me it looks not like a config.xml problem. I added now also a new folder, all is fine in the config.xml and sync works, but after restart i get “folder path missing” i think it happend somewhere else…