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

unable to build with M1 #477

Open
aslom opened this issue Aug 24, 2023 · 1 comment
Open

unable to build with M1 #477

aslom opened this issue Aug 24, 2023 · 1 comment

Comments

@aslom
Copy link

aslom commented Aug 24, 2023

It seems go should be enough to build local version? That owuld be great for local testing ...

It fails on macbook M1:

$ make build
(re)installing /Users/aslom/Documents/awsm/go/src/github.ibm.com/z-cloud-integration/flowlogs-pipeline/bin/golangci-lint-v1.53.3
/Users/aslom/Documents/awsm/go/src/github.ibm.com/z-cloud-integration/flowlogs-pipeline/bin/golangci-lint-v1.53.3 run --enable goimports --enable gofmt --enable ineffassign --timeout 5m
/Users/aslom/Documents/awsm/go/src/github.ibm.com/z-cloud-integration/flowlogs-pipeline/bin/golangci-lint-v1.53.3: /Users/aslom/Documents/awsm/go/src/github.ibm.com/z-cloud-integration/flowlogs-pipeline/bin/golangci-lint-v1.53.3: cannot execute binary file
make: *** [lint] Error 126

Macbook pro 16 M1:

$ uname -a
Darwin m1.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64
$ sw_vers
ProductName:		macOS
ProductVersion:		13.5.1
BuildVersion:		22G90
@aslom
Copy link
Author

aslom commented Aug 31, 2023

Here is workaround for current version - if go build fails:

$ go build -ldflags "-X 'main.BuildVersion=0.1.10-rc1-daa0340-dirty' -X 'main.BuildDate=2023-08-30 13:26'" "./cmd/flowlogs-pipeline"
# github.com/netobserv/netobserv-ebpf-agent/pkg/utils
vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/utils/utils.go:76:18: undefined: syscall.Utsname
vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/utils/utils.go:77:20: undefined: syscall.Uname
vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/utils/utils.go:80:42: cannot infer T (/Users/aslom/Documents.../vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/utils/utils.go:84:17)

then patch vendor/github.com/netobserv/netobserv-ebpf-agent/pkg/utils/utils.go

 func currentKernelVersion() (uint32, error) {
-       var buf syscall.Utsname
-       if err := syscall.Uname(&buf); err != nil {
-               return 0, err
-       }
-       releaseString := strings.Trim(utsnameStr(buf.Release[:]), "\x00")
+       // var buf syscall.Utsname
+       // if err := syscall.Uname(&buf); err != nil {
+       //      return 0, err
+       // }
+       // releaseString := strings.Trim(utsnameStr(buf.Release[:]), "\x00")
+       releaseString := "macos"
        return kernelVersionFromReleaseString(releaseString)
 }

then build works:

$ file flowlogs-pipeline
flowlogs-pipeline: Mach-O 64-bit executable arm64
./flowlogs-pipeline -h
Transform, persist and expose flow-logs as network metrics
...


@ronensc 

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

No branches or pull requests

1 participant