I want to run a go project called syncthing on iOS , but I have some issues

547 views
Skip to first unread message

m18742...@163.com

unread,
Sep 12, 2018, 12:28:12 AM9/12/18
to golang-nuts
I run the shell 

set -e
echo "Done 1"

HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
GO=$HOME/golang/bin/go

if [ ! -d "$HOME/cgo-obj" ]; then
mkdir $HOME/cgo-obj
fi

if [ ! -d "$HOME/go-obj" ]; then
mkdir $HOME/go-obj
fi

echo "Done 2"
CGO_ENABLED=1 GOARCH=arm64 GOARM=7 $GO tool cgo -objdir $HOME/cgo-obj 
$HOME/syncthing/src/github.com/syncthing/syncthing/cmd/syncthing/main.go
echo "Done 3"
GOPATH=$HOME/syncthing CGO_ENABLED=1 GOARCH=arm64 
$GO build -v -o syncthing-exc 
-ldflags "-tmpdir $HOME/go-obj -linkmode external" 
github.com/syncthing/syncthing/cmd/syncthing
echo "Done 4"
when I run it on xcode  

  runtime/cgo

# runtime/cgo

In file included from _cgo_export.c:3:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/stdlib.h:63:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/_types.h:27:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:32:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/cdefs.h:761:2: error: Unsupported architecture

In file included from _cgo_export.c:3:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/stdlib.h:63:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/_types.h:27:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:33:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported

In file included from _cgo_export.c:3:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/stdlib.h:63:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/_types.h:27:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:55:9: error: unknown type name '__int64_t'; did you mean '__int128_t'?

note: '__int128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:56:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?

note: '__int128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:57:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?

note: '__int128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:60:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?

note: '__uint128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:61:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?

note: '__uint128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:62:9: error: unknown type name '__uint64_t'; did you mean '__uint128_t'?

note: '__uint128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:68:9: error: unknown type name '__darwin_natural_t'

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:70:9: error: unknown type name '__uint16_t'; did you mean '__uint128_t'?

note: '__uint128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:71:9: error: unknown type name '__int64_t'; did you mean '__int128_t'?

note: '__int128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:72:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?

note: '__int128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:73:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?

note: '__uint128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:74:9: error: unknown type name '__int32_t'; did you mean '__int128_t'?

note: '__int128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:75:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?

note: '__uint128_t' declared here

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/_types.h:76:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?

note: '__uint128_t' declared here

In file included from _cgo_export.c:3:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/stdlib.h:63:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/_types.h:43:9: error: unknown type name '__uint32_t'; did you mean '__uint128_t'?

note: '__uint128_t' declared here

In file included from _cgo_export.c:3:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/stdlib.h:65:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/wait.h:109:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/signal.h:82:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/machine/signal.h:34:2: error: architecture not supported

In file included from _cgo_export.c:3:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/stdlib.h:65:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/wait.h:109:

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/sys/signal.h:146:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/usr/include/machine/_mcontext.h:31:2: error: architecture not supported

fatal error: too many errors emitted, stopping now [-ferror-limit=]

github.com/syncthing/syncthing/lib/auto



when I run it on terminal



   gcc_arm64.S:27:16: error: brackets expression not supported on this target

 stp x19, x20, [sp, #-16]!

               ^

gcc_arm64.S:28:16: error: brackets expression not supported on this target

 stp x21, x22, [sp, #-16]!

               ^

gcc_arm64.S:29:16: error: brackets expression not supported on this target

 stp x23, x24, [sp, #-16]!

               ^

gcc_arm64.S:30:16: error: brackets expression not supported on this target

 stp x25, x26, [sp, #-16]!

               ^

gcc_arm64.S:31:16: error: brackets expression not supported on this target

 stp x27, x28, [sp, #-16]!

               ^

gcc_arm64.S:32:16: error: brackets expression not supported on this target

 stp x29, x30, [sp, #-16]!

               ^

gcc_arm64.S:33:2: error: unknown use of instruction mnemonic without a size suffix

 mov x29, sp

 ^

gcc_arm64.S:35:2: error: unknown use of instruction mnemonic without a size suffix

 mov x19, x0

 ^

gcc_arm64.S:36:2: error: unknown use of instruction mnemonic without a size suffix

 mov x20, x1

 ^

gcc_arm64.S:37:2: error: unknown use of instruction mnemonic without a size suffix

 mov x0, x2

 ^

gcc_arm64.S:39:2: error: invalid instruction mnemonic 'blr'

 blr x20

 ^~~

gcc_arm64.S:40:2: error: invalid instruction mnemonic 'blr'

 blr x19

 ^~~

gcc_arm64.S:42:16: error: brackets expression not supported on this target

 ldp x29, x30, [sp], #16

               ^

gcc_arm64.S:43:16: error: brackets expression not supported on this target

 ldp x27, x28, [sp], #16

               ^

gcc_arm64.S:44:16: error: brackets expression not supported on this target

 ldp x25, x26, [sp], #16

               ^

gcc_arm64.S:45:16: error: brackets expression not supported on this target

 ldp x23, x24, [sp], #16

               ^

gcc_arm64.S:46:16: error: brackets expression not supported on this target

 ldp x21, x22, [sp], #16

               ^

gcc_arm64.S:47:16: error: brackets expression not supported on this target

 ldp x19, x20, [sp], #16

               ^


I have some pain now ,I don't know how to do next step.I need some help.Thanks!

               ^

Tamás Gulácsi

unread,
Sep 12, 2018, 2:18:51 AM9/12/18
to golang-nuts
Why not just "go install" ?

m18742...@163.com

unread,
Sep 12, 2018, 8:47:01 AM9/12/18
to golang-nuts
I tried to use "go install" but I got the same probrom.
I'm the first time using golang.I think if I have set the wrong go environment.But I set go environment for at least eight times.
I want to konw if I can run go project on iOS.I am a little sad.
在 2018年9月12日星期三 UTC+8下午2:18:51,Tamás Gulácsi写道:

Elias Naur

unread,
Sep 12, 2018, 8:58:01 AM9/12/18
to golang-nuts
Tamás is right: go install or go build should be enough. Mare sure you have a recent version of Xcode (I use version 9.x) installed.

Here's my attempt:

$ GOARCH=arm64 CGO_ENABLED=1 ~/go-tip/bin/go build -tags ios -o syncthing github.com/syncthing/syncthing/cmd/syncthing
../go/src/github.com/syncthing/syncthing/vendor/github.com/syncthing/notify/watcher_fsevents_cgo.go:10:10: fatal error: 'CoreServices/CoreServices.h' file not found
#include <CoreServices/CoreServices.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

The CoreServices error is probably because CoreServices is not available until iOS 12.

What are you trying to do? Command line programs are not supported on iOS, unless your device is jailbroken.

 - elias

m18742...@163.com

unread,
Sep 12, 2018, 9:39:38 AM9/12/18
to golang-nuts
I got the project from https://github.com/pangliang/syncthing-ios  ,it can work 2years ago, and the synching.a can be used now.

在 2018年9月12日星期三 UTC+8下午8:58:01,Elias Naur写道:
Reply all
Reply to author
Forward
0 new messages