Skip to content

[skip changelog] Update proto files build step #1277

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

Merged
merged 5 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/link-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.14"
go-version: "1.16"

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

- name: Install protoc compiler
uses: arduino/setup-protoc@v1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
go get golang.org/x/lint/golint
go get github.com/golang/protobuf/protoc-gen-go
go get github.com/cmaglie/go.rice/rice
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
shell: bash

- name: Install Taskfile
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.14"
go-version: "1.16"

- name: Install Go dependencies
run: |
go version
go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.4.1

- name: Install protoc compiler
uses: arduino/setup-protoc@v1
Expand Down
49 changes: 45 additions & 4 deletions DistTasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ tasks:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_arm_7"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
BUILD_PLATFORM: "linux/armv7"
CONTAINER_TAG: "{{ .GO_VERSION }}-arm"
CONTAINER_TAG: "{{ .GO_VERSION }}-armhf"
PACKAGE_PLATFORM: "Linux_ARMv7"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"

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

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

vars:
CONTAINER: "docker.elastic.co/beats-dev/golang-crossbuild"
GO_VERSION: "1.14.7"
GO_VERSION: "1.16.4"
CHECKSUM_FILE: "{{ .VERSION }}-checksums.txt"
8 changes: 4 additions & 4 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ tasks:
protoc:compile:
desc: Compile protobuf definitions
cmds:
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/commands/v1/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/monitor/v1/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/settings/v1/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/debug/v1/*.proto'
- '{{ 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'
- '{{ 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'
- '{{ 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'
- '{{ 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'

protoc:docs:
desc: Generate docs for protobuf definitions
Expand Down
1 change: 1 addition & 0 deletions commands/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (

// ArduinoCoreServerImpl FIXMEDOC
type ArduinoCoreServerImpl struct {
rpc.UnimplementedArduinoCoreServiceServer
VersionString string
}

Expand Down
4 changes: 3 additions & 1 deletion commands/daemon/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ import (
)

// DebugService implements the `Debug` service
type DebugService struct{}
type DebugService struct {
dbg.UnimplementedDebugServiceServer
}

// Debug returns a stream response that can be used to fetch data from the
// target. The first message passed through the `Debug` request must
Expand Down
4 changes: 3 additions & 1 deletion commands/daemon/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import (
)

// MonitorService implements the `Monitor` service
type MonitorService struct{}
type MonitorService struct {
rpc.UnimplementedMonitorServiceServer
}

// StreamingOpen returns a stream response that can be used to fetch data from the
// monitor target. The first message passed through the `StreamingOpenReq` must
Expand Down
4 changes: 3 additions & 1 deletion commands/daemon/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ import (
)

// SettingsService implements the `Settings` service
type SettingsService struct{}
type SettingsService struct {
rpc.UnimplementedSettingsServiceServer
}

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