doujianglin6704 2017-10-12 12:44
浏览 60
已采纳

x / mobile / app无法为iOS编译

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 2017-12-15 07:23
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?