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

Failed to build confluent-kafka-go on arm64 machine. #1176

Open
7 tasks
ahan-ai opened this issue Apr 16, 2024 · 2 comments
Open
7 tasks

Failed to build confluent-kafka-go on arm64 machine. #1176

ahan-ai opened this issue Apr 16, 2024 · 2 comments
Labels

Comments

@ahan-ai
Copy link

ahan-ai commented Apr 16, 2024

Description

I use github.com/confluentinc/confluent-kafka-go/v2@v2.3.0 in my project, which needs to be compiled on arm64 machine.

I use the go build command to build the binary, like:
GOOS=linux CGO_ENABLED=1 GOARCH=arm64 go build -ldflags=-s -w -X 'main.BuildTime=' -X 'main.GitBranch=multi_arch' -X 'main.GitCommit=xxxxxxxxx' -X 'main.GoVersion=' -o output/backup-mgr cmd/mgr/main.go

The error messages are shown below:

/usr/local/go/pkg/tool/linux_arm64/link: running gcc failed: exit status 1
/opt/tiger/compile_path/pkg/mod/github.com/confluentinc/confluent-kafka-go/v2@v2.3.0/kafka/librdkafka_vendor/librdkafka_glibc_linux_arm64.a(rdkafka_mock.o): In function rd_kafka_mock_connection_write_out': (.text+0xd94): undefined reference to __aarch64_ldadd4_acq_rel'
/opt/tiger/compile_path/pkg/mod/github.com/confluentinc/confluent-kafka-go/v2@v2.3.0/kafka/librdkafka_vendor/librdkafka_glibc_linux_arm64.a(rdkafka_mock.o): In function rd_kafka_mock_connection_close': (.text+0xf60): undefined reference to __aarch64_ldadd4_acq_rel'
/opt/tiger/compile_path/pkg/mod/github.com/confluentinc/confluent-kafka-go/v2@v2.3.0/kafka/librdkafka_vendor/librdkafka_glibc_linux_arm64.a(rdkafka_mock.o): In function rd_kafka_mock_connection_close': (.text+0xf88): undefined reference to __aarch64_ldadd4_acq_rel'
/opt/tiger/compile_path/pkg/mod/github.com/confluentinc/confluent-kafka-go/v2@v2.3.0/kafka/librdkafka_vendor/librdkafka_glibc_linux_arm64.a(rdkafka_mock.o): In function rd_kafka_mock_cluster_thread_main': (.text+0x11f0): undefined reference to __aarch64_ldadd4_acq_rel'
/opt/tiger/compile_path/pkg/mod/github.com/confluentinc/confluent-kafka-go/v2@v2.3.0/kafka/librdkafka_vendor/librdkafka_glibc_linux_arm64.a(rdkafka_mock.o): In function rd_kafka_mock_cluster_thread_main': (.text+0x130c): undefined reference to __aarch64_ldadd4_acq_rel'
/opt/tiger/compile_path/pkg/mod/github.com/confluentinc/confluent-kafka-go/v2@v2.3.0/kafka/librdkafka_vendor/librdkafka_glibc_linux_arm64.a(rdkafka_mock.o):(.text+0x14f0): more undefined references to __aarch64_ldadd4_acq_rel' follow /opt/tiger/compile_path/pkg/mod/github.com/confluentinc/confluent-kafka-go/v2@v2.3.0/kafka/librdkafka_vendor/librdkafka_glibc_linux_arm64.a(rdkafka_txnmgr.o): In function rd_kafka_txn_op_commit_transaction.part.0':
(.text+0x4170): undefined reference to `__aarch64_ldadd8_acq_rel'

My go env:
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/opt/tiger/.cache/go-build"
GOENV="/tmp/.config-cof63mlelf3dpgqrls40/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/opt/tiger/compile_path/pkg/mod"
GONOPROXY="gitlab.everphoto.cn,sysrepo.byted.org,git.smartisan.com"
GONOSUMDB="code.byted.org,gitlab.everphoto.cn,git.byted.org,sysrepo.byted.org,git.smartisan.com"
GOOS="linux"
GOPATH="/opt/tiger/compile_path"
GOPRIVATE="gitlab.everphoto.cn,sysrepo.byted.org,git.smartisan.com"
GOPROXY="https://goproxy.byted.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_arm64"
GOVCS=""
GOVERSION="go1.20.14"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/opt/tiger/compile_path/src/code.byted.org/infcs/vebackup-core/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3739323652=/tmp/go-build -gno-record-gcc-switches"

How to reproduce

I am not pretty sure if other people can reproduce it, but I can reproduce it in my machine.

Checklist

Please provide the following information:

  • confluent-kafka-go and librdkafka version (LibraryVersion()): confluent-kafka-go 2.3.0
  • Apache Kafka broker version:
  • Client configuration: ConfigMap{...}
  • Operating system:
  • Provide client logs (with "debug": ".." as necessary)
  • Provide broker log excerpts
  • Critical issue
@milindl
Copy link
Contributor

milindl commented Apr 23, 2024

@ahan-ai , I'll take a look at this issue. I couldn't reproduce it locally but I was using an amd64 system and cross compiling to arm64.

Could you try this, set the CGO_LDFLAGS environment variable to "-latomic" and see if that works for you? CGO_LDFLAGS="-latomic"

@milindl
Copy link
Contributor

milindl commented Apr 23, 2024

And also, what is the version of gcc on your machine which is used for linking?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants