golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.07k stars 17.68k forks source link

x/mobile/cmd/gomobile: gomobile-build fails due to header-files not found error #24644

Closed hajimehoshi closed 6 years ago

hajimehoshi commented 6 years ago

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

go version go1.10 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hajimehoshi/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/hajimehoshi/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
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"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/7t/qw3np69559591s1v0mk5_p1m0000gn/T/go-build013947351=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

gomobile build -target ios golang.org/x/mobile/example/basic

What did you expect to see?

Build succeeds.

What did you see instead?

Build failed:

gomobile: go build -tags ios -o=/var/folders/7t/qw3np69559591s1v0mk5_p1m0000gn/T/gomobile-work-875171040/arm golang.org/x/mobile/example/basic failed: exit status 2
# golang.org/x/mobile/exp/gl/glutil
go/src/golang.org/x/mobile/exp/gl/glutil/context_darwin_desktop.go:15:9: fatal error: 'OpenGL/OpenGL.h' file not found
#import <OpenGL/OpenGL.h>
        ^~~~~~~~~~~~~~~~~
1 error generated.
# golang.org/x/mobile/app
go/src/golang.org/x/mobile/app/darwin_desktop.go:16:9: fatal error: 'Carbon/Carbon.h' file not found
#import <Carbon/Carbon.h> // for HIToolbox/Events.h
        ^~~~~~~~~~~~~~~~~
1 error generated.

Additional information

$ gomobile version
gomobile version unknown: binary is out of date, re-install it

I removed gomobile and redid go-get, but I couldn't remove this error.

AlexRouSg commented 6 years ago

Do you have xcode installed?

hajimehoshi commented 6 years ago

Yes.

bcmills commented 6 years ago

(CC @eliasnaur)

hajimehoshi commented 6 years ago

The above error happened with 54bca6061991cbde3139dc01ec713e2bba9cdb51.

With the previous one 4e3d9b79444693d916d1ae1f1d358cb13ba479e1, the situation changed:

$ gomobile build -target=ios golang.org/x/mobile/example/basic
gomobile: xcrun xcodebuild -configuration Release -project /var/folders/7t/qw3np69559591s1v0mk5_p1m0000gn/T/gomobile-work-221160388/main.xcodeproj -allowProvisioningUpdates DEVELOPMENT_TEAM=JF56W8HGC5 failed: exit status 65
Build settings from command line:
    DEVELOPMENT_TEAM = JF56W8HGC5

=== BUILD TARGET main OF PROJECT main WITH CONFIGURATION Release ===

Check dependencies
2018-04-03 11:25:33.311 xcodebuild[6547:153334]  DVTPortal: Service '<DVTPortalAddAppIDService: 0x7fa2dbfd6100; action='addAppId'>' encountered an unexpected result code from the portal ('9401')
2018-04-03 11:25:33.311 xcodebuild[6547:153334]  DVTPortal: Error:
Error Domain=DVTPortalServiceErrorDomain Code=9401 "An App ID with Identifier 'org.golang.todo.basic' is not available. Please enter a different string." UserInfo={payload=<CFBasicHash 0x7fa2d96ccfb0 [0x7fff9fa5aaf0]>{type = mutable dict, count = 10,
entries =>
        0 : <CFString 0x7fa2dbf7d7d0 [0x7fff9fa5aaf0]>{contents = "requestId"} = <CFString 0x7fa2dc338a30 [0x7fff9fa5aaf0]>{contents = "FDC58D0A-2A94-4CFE-AB6D-86AF0D29B4BA"}
        1 : responseId = <CFString 0x7fa2dc32cf70 [0x7fff9fa5aaf0]>{contents = "af8a5adc-56fc-4053-94f1-ccd31e79d372"}
        2 : <CFString 0x7fff9f97db58 [0x7fff9fa5aaf0]>{contents = "protocolVersion"} = QH65B2
        3 : <CFString 0x7fa2dbf51a00 [0x7fff9fa5aaf0]>{contents = "requestUrl"} = <CFString 0x7fa2dbf6c200 [0x7fff9fa5aaf0]>{contents = "https://developerservices2.apple.com/services/QH65B2/ios/addAppId.action"}
        6 : <CFString 0x7fa2dc344310 [0x7fff9fa5aaf0]>{contents = "userLocale"} = en_US
        8 : resultCode = <CFNumber 0x24b937 [0x7fff9fa5aaf0]>{value = +9401, type = kCFNumberSInt64Type}
        9 : userString = <CFString 0x7fa2dc344b70 [0x7fff9fa5aaf0]>{contents = "An App ID with Identifier 'org.golang.todo.basic' is not available. Please enter a different string."}
        10 : <CFString 0x7fa2dbf57de0 [0x7fff9fa5aaf0]>{contents = "resultString"} = <CFString 0x7fa2dc344b70 [0x7fff9fa5aaf0]>{contents = "An App ID with Identifier 'org.golang.todo.basic' is not available. Please enter a different string."}
        11 : httpCode = <CFNumber 0xc837 [0x7fff9fa5aaf0]>{value = +200, type = kCFNumberSInt64Type}
        12 : <CFString 0x7fa2dc30b9f0 [0x7fff9fa5aaf0]>{contents = "creationTimestamp"} = <CFString 0x7fa2dc3493b0 [0x7fff9fa5aaf0]>{contents = "2018-04-03T02:25:33Z"}
}
, NSLocalizedDescription=An App ID with Identifier 'org.golang.todo.basic' is not available. Please enter a different string.}
Code Signing Error: Failed to create provisioning profile. The app ID "org.golang.todo.basic" cannot be registered to your development team. Change your bundle identifier to a unique string to try again.
Code Signing Error: No profiles for 'org.golang.todo.basic' were found:  Xcode couldn't find any iOS App Development provisioning profiles matching 'org.golang.todo.basic'.
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.3'

** BUILD FAILED **

The following build commands failed:
        Check dependencies
(1 failure)
gopherbot commented 6 years ago

Change https://golang.org/cl/104355 mentions this issue: app,exp/gl/glutil: add missing build directives

eliasnaur commented 6 years ago

CL 104355 should fix the compilation error.

The gomobile version issue is #24389 stalled on #24558.

The App ID problem is #20241.

hajimehoshi commented 6 years ago

I have another similar issue, and I am not sure this is related to the issues above.

go get -u github.com/hajimehoshi/go-inovation
cd $GOPATH/src/github.com/hajimehoshi/go-inovation
gomobile bind -v -target ios -o ./mobile/ios/Mobile.framework github.com/hajimehoshi/go-inovation/mobile

fails with this message:

# github.com/hajimehoshi/ebiten/internal/devicescale
../ebiten/internal/devicescale/impl_ios.go:22:10: fatal error: 'UIKit/UIKit.h' file not found
 #import <UIKit/UIKit.h>
         ^~~~~~~~~~~~~~~
1 error generated.
# golang.org/x/mobile/gl
In file included from ../../../golang.org/x/mobile/gl/work.go:28:
./work.h:18:10: fatal error: 'OpenGLES/ES2/glext.h' file not found
#include <OpenGLES/ES2/glext.h>
         ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
gomobile: gobind -lang=go,objc -outdir=/var/folders/7t/qw3np69559591s1v0mk5_p1m0000gn/T/gomobile-work-847470222 -tags=ios github.com/hajimehoshi/go-inovation/mobile failed: exit status 1

git-bisect says 4600df55ca9f03689ade154095e4daf53a00e223 is the cause.

gopherbot commented 6 years ago

Change https://golang.org/cl/104458 mentions this issue: cmd/gomobile: don't run gobind with the ios tag

hajimehoshi commented 6 years ago

I think the problem at https://github.com/golang/go/issues/24644#issuecomment-378220711 is not solved yet.

eliasnaur commented 6 years ago

CL 104458 should fix that problem.

hajimehoshi commented 6 years ago

I confirmed the error (gomobile bind for iOS) is still happening with the latest gomobile.

eliasnaur commented 6 years ago

Did you try with CL 104458 applied? It's not submitted yet.

hajimehoshi commented 6 years ago

Oh, I've not tried that, sorry