Skip to content

Commit c8059b5

Browse files
[skip changelog] Update proto files build step (#1277)
* [skip changelog] Update proto files build step * Added missing go.sum * Update builders to 1.16.4 * Fixed crossbuild for Linux ARMv6/ARMv7 * Fixed macOS_64bit build Co-authored-by: Cristian Maglie <[email protected]>
1 parent d4f31df commit c8059b5

20 files changed

+2796
-2587
lines changed

Diff for: .github/workflows/link-validation.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525
- name: Install Go
2626
uses: actions/setup-go@v2
2727
with:
28-
go-version: "1.14"
28+
go-version: "1.16"
2929

3030
- name: Installs Go dependencies
3131
shell: bash
32-
run: go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
32+
run: go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.4.1
3333

3434
- name: Install protoc compiler
3535
uses: arduino/setup-protoc@v1

Diff for: .github/workflows/test.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
go get golang.org/x/lint/golint
3434
go get github.com/golang/protobuf/protoc-gen-go
3535
go get github.com/cmaglie/go.rice/rice
36+
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
3637
shell: bash
3738

3839
- name: Install Taskfile

Diff for: .github/workflows/validate-docs.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ jobs:
3939
- name: Setup Go
4040
uses: actions/setup-go@v2
4141
with:
42-
go-version: "1.14"
42+
go-version: "1.16"
4343

4444
- name: Install Go dependencies
4545
run: |
4646
go version
47-
go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
47+
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.4.1
4848
4949
- name: Install protoc compiler
5050
uses: arduino/setup-protoc@v1

Diff for: DistTasks.yml

+45-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ tasks:
135135
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_arm_7"
136136
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
137137
BUILD_PLATFORM: "linux/armv7"
138-
CONTAINER_TAG: "{{ .GO_VERSION }}-arm"
138+
CONTAINER_TAG: "{{ .GO_VERSION }}-armhf"
139139
PACKAGE_PLATFORM: "Linux_ARMv7"
140140
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
141141

@@ -157,7 +157,35 @@ tasks:
157157
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_arm_6"
158158
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
159159
BUILD_PLATFORM: "linux/armv6"
160-
CONTAINER_TAG: "{{ .GO_VERSION }}-arm"
160+
# We are experiencing the following error with ARMv6 build:
161+
#
162+
# # github.com/arduino/arduino-cli
163+
# net(.text): unexpected relocation type 296 (R_ARM_V4BX)
164+
# panic: runtime error: invalid memory address or nil pointer dereference
165+
# [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x51ae53]
166+
#
167+
# goroutine 1 [running]:
168+
# cmd/link/internal/loader.(*Loader).SymName(0xc000095c00, 0x0, 0xc0000958d8, 0x5a0ac)
169+
# /usr/local/go/src/cmd/link/internal/loader/loader.go:684 +0x53
170+
# cmd/link/internal/ld.dynrelocsym2(0xc000095880, 0x5a0ac)
171+
# /usr/local/go/src/cmd/link/internal/ld/data.go:777 +0x295
172+
# cmd/link/internal/ld.(*dodataState).dynreloc2(0xc007df9800, 0xc000095880)
173+
# /usr/local/go/src/cmd/link/internal/ld/data.go:794 +0x89
174+
# cmd/link/internal/ld.(*Link).dodata2(0xc000095880, 0xc007d00000, 0x60518, 0x60518)
175+
# /usr/local/go/src/cmd/link/internal/ld/data.go:1434 +0x4d4
176+
# cmd/link/internal/ld.Main(0x8729a0, 0x4, 0x8, 0x1, 0xd, 0xe, 0x0, 0x0, 0x6d7737, 0x12, ...)
177+
# /usr/local/go/src/cmd/link/internal/ld/main.go:302 +0x123a
178+
# main.main()
179+
# /usr/local/go/src/cmd/link/main.go:68 +0x1dc
180+
# Error: failed building for linux/armv6: exit status 2
181+
#
182+
# This seems to be a problem in the go builder 1.16.x that removed support for the R_ARM_V4BX instruction:
183+
# https://github.com/golang/go/pull/44998
184+
# https://groups.google.com/g/golang-codereviews/c/yzN80xxwu2E
185+
#
186+
# Until there is a fix released we must use a recent gcc for Linux_ARMv6 build, so for this
187+
# build we select the debian10 based container.
188+
CONTAINER_TAG: "{{ .GO_VERSION }}-armel-debian10"
161189
PACKAGE_PLATFORM: "Linux_ARMv6"
162190
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
163191

@@ -201,11 +229,24 @@ tasks:
201229
PLATFORM_DIR: "{{ .PROJECT_NAME }}_osx_darwin_amd64"
202230
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
203231
BUILD_PLATFORM: "darwin/amd64"
204-
CONTAINER_TAG: "{{ .GO_VERSION }}-darwin"
232+
# We are experiencing the following error with macOS_64bit build:
233+
#
234+
# Undefined symbols for architecture x86_64:
235+
# "_clock_gettime", referenced from:
236+
# _runtime.walltime_trampoline in go.o
237+
# ld: symbol(s) not found for architecture x86_64
238+
# clang: error: linker command failed with exit code 1 (use -v to see invocation)
239+
#
240+
# The reason seems that go 1.16.x use a macos API which is available since 10.12
241+
# https://github.com/techknowlogick/xgo/issues/100#issuecomment-780894190
242+
#
243+
# To compile it we need an SDK >=10.12 so we use the debian10 based container that
244+
# has the SDK 10.14 installed.
245+
CONTAINER_TAG: "{{ .GO_VERSION }}-darwin-debian10"
205246
PACKAGE_PLATFORM: "macOS_64bit"
206247
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
207248

208249
vars:
209250
CONTAINER: "docker.elastic.co/beats-dev/golang-crossbuild"
210-
GO_VERSION: "1.14.7"
251+
GO_VERSION: "1.16.4"
211252
CHECKSUM_FILE: "{{ .VERSION }}-checksums.txt"

Diff for: Taskfile.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ tasks:
8686
protoc:compile:
8787
desc: Compile protobuf definitions
8888
cmds:
89-
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/commands/v1/*.proto'
90-
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/monitor/v1/*.proto'
91-
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/settings/v1/*.proto'
92-
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/debug/v1/*.proto'
89+
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/commands/v1/*.proto'
90+
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/monitor/v1/*.proto'
91+
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/settings/v1/*.proto'
92+
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/debug/v1/*.proto'
9393

9494
protoc:docs:
9595
desc: Generate docs for protobuf definitions

Diff for: commands/daemon/daemon.go

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434

3535
// ArduinoCoreServerImpl FIXMEDOC
3636
type ArduinoCoreServerImpl struct {
37+
rpc.UnimplementedArduinoCoreServiceServer
3738
VersionString string
3839
}
3940

Diff for: commands/daemon/debug.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import (
2626
)
2727

2828
// DebugService implements the `Debug` service
29-
type DebugService struct{}
29+
type DebugService struct {
30+
dbg.UnimplementedDebugServiceServer
31+
}
3032

3133
// Debug returns a stream response that can be used to fetch data from the
3234
// target. The first message passed through the `Debug` request must

Diff for: commands/daemon/monitor.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import (
2525
)
2626

2727
// MonitorService implements the `Monitor` service
28-
type MonitorService struct{}
28+
type MonitorService struct {
29+
rpc.UnimplementedMonitorServiceServer
30+
}
2931

3032
// StreamingOpen returns a stream response that can be used to fetch data from the
3133
// monitor target. The first message passed through the `StreamingOpenReq` must

Diff for: commands/daemon/settings.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ import (
2727
)
2828

2929
// SettingsService implements the `Settings` service
30-
type SettingsService struct{}
30+
type SettingsService struct {
31+
rpc.UnimplementedSettingsServiceServer
32+
}
3133

3234
// GetAll returns a message with a string field containing all the settings
3335
// currently in use, marshalled in JSON format.

0 commit comments

Comments
 (0)