Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile: Undefined symbols for architecture arm64 #47499

Closed
Higher08 opened this issue Aug 2, 2021 · 7 comments
Closed

x/mobile: Undefined symbols for architecture arm64 #47499

Higher08 opened this issue Aug 2, 2021 · 7 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@Higher08
Copy link

Higher08 commented Aug 2, 2021

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

$ go version
go1.16.4 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dmytro/Library/Caches/go-build"
GOENV="/Users/dmytro/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/dmytro/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/dmytro/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.4"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/86/5nplq84x6jl50czmncxkdqph0000gn/T/go-build543195465=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Build GOlang project with gomobile bind, import framework into iOS app and build it

What did you expect to see?

Launched app)

What did you see instead?

Undefined symbols for architecture arm64:
  "operator new(unsigned long)", referenced from:
      struct_utp_context::struct_utp_context() in Server(000033.o)
      _utp_init in Server(000033.o)
      _utp_create_socket in Server(000036.o)
  "___gxx_personality_v0", referenced from:
      struct_utp_context::struct_utp_context() in Server(000033.o)
      struct_utp_context::~struct_utp_context() in Server(000033.o)
      _utp_init in Server(000033.o)
      _utp_destroy in Server(000033.o)
      UTP_FreeAll(UTPSocketHT*) in Server(000036.o)
      _utp_create_socket in Server(000036.o)
      _utp_check_timeouts in Server(000036.o)
      ...
  "operator delete(void*)", referenced from:
      struct_utp_context::struct_utp_context() in Server(000033.o)
      struct_utp_context::~struct_utp_context() in Server(000033.o)
      _utp_init in Server(000033.o)
      _utp_destroy in Server(000033.o)
      UTP_FreeAll(UTPSocketHT*) in Server(000036.o)
      _utp_create_socket in Server(000036.o)
      _utp_check_timeouts in Server(000036.o)
      ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation
@mengzhuo
Copy link
Contributor

mengzhuo commented Aug 2, 2021

Could you elaborate on the code example?

@Higher08
Copy link
Author

Higher08 commented Aug 2, 2021

Code of usage in iOS app or GOlang code?

@cagedmantis cagedmantis added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 2, 2021
@cagedmantis cagedmantis changed the title Gomobile: Undefined symbols for architecture arm64 x/mobile: Undefined symbols for architecture arm64 Aug 2, 2021
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Aug 2, 2021
@gopherbot gopherbot added this to the Unreleased milestone Aug 2, 2021
@Higher08
Copy link
Author

Higher08 commented Aug 4, 2021

I think it's happening because of this library https://github.com/anacrolix/go-libutp. And it seems that the clang compiler doesn't understand some functions in it. Is there a way to fix it?

@Higher08
Copy link
Author

Higher08 commented Aug 4, 2021

@mengzhuo

@mengzhuo
Copy link
Contributor

mengzhuo commented Aug 5, 2021

I think it's happening because of this library https://github.com/anacrolix/go-libutp. And it seems that the clang compiler doesn't understand some functions in it. Is there a way to fix it?

I DO NOT think it's a bug.

According to your environment settings:

GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dmytro/Library/Caches/go-build"
GOENV="/Users/dmytro/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"

You may want to set GOARCH=arm64 to do cross compile.
And maybe it's related to #47212

p.s. Github issue is not a place for question you should ask it at Go-nuts

@Higher08
Copy link
Author

Higher08 commented Aug 5, 2021

@mengzhuo, perhaps it was not clear from the description, but the build problem is in the Xcode. gomobile bind runs fine. If I remove this library from my golang project, the ios application starts

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Dec 26, 2022
@gopherbot
Copy link

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Jan 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants