doujianglin6704
doujianglin6704
2017-10-12 12:44

x / mobile / app无法为iOS编译

  • IT行业问题
  • 计算机技术
  • it技术
  • 编程语言问答
  • 互联网问答
已采纳

What version of Go are you using (go version)?

go version go1.9 darwin/amd64
XCode Version 9.0 (9A235)

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/users/sh.garatuev/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/3l/h5gppnys24d6rkswsm0079mr0000gp/T/go-build268352381=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

Run gomobile bind -target ios for a simpliest package with one function.

package mSensor

import (
    "fmt"

    _ "golang.org/x/mobile/app"
)

func HelloGo() {
    fmt.Println("Hello Go!")
}

What did you expect to see?

Expected to get successfully binded package for using in XCode 9.0

What did you see instead?

gomobile: darwin-x86_64: go build -pkgdir=/users/sh.garatuev/go/pkg/gomobile/pkg_darwin_amd64 -tags ios -buildmode=c-archive -o /var/folders/3l/h5gppnys24d6rkswsm0079mr0000gp/T/gomobile-work-272988193/mSensor-amd64.a /var/folders/3l/h5gppnys24d6rkswsm0079mr0000gp/T/gomobile-work-272988193/src/iosbin/main.go failed: exit status 2
# golang.org/x/mobile/app
../../golang.org/x/mobile/app/darwin_amd64.go:16:9: fatal error: 'Carbon/Carbon.h' file not found
#import <Carbon/Carbon.h> // for HIToolbox/Events.h
        ^~~~~~~~~~~~~~~~~

1 error generated.

I've created issue on github. Any help, please?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • duan0417 duan0417 4年前

    just exclude "golang.org/x/mobile/app" import and build would work fine. This import is necessary only for Android builds.

    点赞 评论 复制链接分享

为你推荐