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

Pre-build Mosquitto go-auth binaries to remove step from install #53

Closed
3 of 5 tasks
hardillb opened this issue Nov 9, 2022 · 5 comments · Fixed by FlowFuse/flowfuse#1473
Closed
3 of 5 tasks
Assignees
Labels
area:install Part of the install/first-run user experience
Milestone

Comments

@hardillb
Copy link
Contributor

hardillb commented Nov 9, 2022

Epic

No response

Description

### As a: new localfs user

I want to: not have to build go-auth plugin

So that: I don't need to know how to setup a Go build environment

Acceptance Criteria

Build of the pluign for the following platforms

  • Linux/amd64
  • Linux/arm64
  • Linux/armv7
  • Darwin/amd64
  • Darwin/arm64

This may be better solved by submitting a PR to the plug-in project to resurrect: iegomez/mosquitto-go-auth#162

@hardillb hardillb self-assigned this Nov 9, 2022
@hardillb hardillb added this to the 1.1 milestone Nov 9, 2022
@hardillb
Copy link
Contributor Author

hardillb commented Nov 9, 2022

golang:latest

apt-get update
# arm64 linux
apt-get install gcc-aarch64-linux-gnu libc6-dev-arm64-cross
# armv7 linux
apt-get install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
# armv6 linux
apt-get install gcc-arm-linux-gnueabihf libc6-dev-armel-cross libc6-dev-armhf-cross

#build for linux arm64
env GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc make

#build for amd64
env GOOS=linux GOARCH=amd64 CGO_ENABLED=1 make

This might be useful for building MacOS on Linux
https://zig.news/kristoff/building-sqlite-with-cgo-for-every-os-4cic

# env GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 CC="zig cc -target aarch64-macos -I/usr/local/include" CXX="zig cc -target aarch64-macos -I/usr/local/include" make
Bulding for Linux
env CGO_CFLAGS="-I/usr/local/include -fPIC" go build -buildmode=c-archive go-auth.go
env CGO_LDFLAGS="-shared" go build -buildmode=c-shared -o go-auth.so
# github.com/iegomez/mosquitto-go-auth
/usr/local/go/pkg/tool/linux_amd64/link: running zig failed: exit status 1
warning: unsupported linker arg: -headerpad
warning: unsupported linker arg: 1144
warning: unsupported linker arg: -flat_namespace
warning: unsupported linker arg: -bind_at_load
warning(link): framework not found for '-framework CoreFoundation'
warning(link): framework not found for '-framework CoreFoundation'
warning(link): framework not found for '-framework Security'
warning(link): Framework search paths:
error(link): undefined reference to symbol '_SecTrustSetVerifyDate'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_SecTrustGetCertificateCount'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_SecTrustGetCertificateAtIndex'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_SecTrustEvaluateWithError'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_SecTrustCreateWithCertificates'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_SecPolicyCreateSSL'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_SecCertificateCreateWithData'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_SecCertificateCopyData'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFStringCreateWithBytes'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFStringCreateExternalRepresentation'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFRelease'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFErrorCopyDescription'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFDateCreate'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFDataGetLength'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFDataGetBytePtr'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFDataCreate'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFArrayGetValueAtIndex'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFArrayGetCount'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFArrayCreateMutable'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_CFArrayAppendValue'
error(link):   first referenced in '/tmp/go-link-582129748/go.o'
error(link): undefined reference to symbol '_mosquitto_client_id'
error(link):   first referenced in '/tmp/go-link-582129748/000002.o'
error(link): undefined reference to symbol '_mosquitto_client_username'
error(link):   first referenced in '/tmp/go-link-582129748/000002.o'
error: UndefinedSymbolReference

make: *** [Makefile:13: all] Error 2

@knolleary knolleary modified the milestones: 1.1, 1.2 Nov 24, 2022
@knolleary knolleary added the area:install Part of the install/first-run user experience label Nov 24, 2022
@hardillb
Copy link
Contributor Author

hardillb commented Dec 8, 2022

PR submitted to the mosquitto-go-auth project to build these.

If it's accepted then we don't need to build them, if now we can add the build script to part of our installer packaging build.

@hardillb
Copy link
Contributor Author

hardillb commented Dec 8, 2022

All the Linux options are now being build by the upstream project, just got to fix the MacOS builds.

@ZJvandeWeg
Copy link
Member

@hardillb Should we close this issue and create a follow up issue for the Mac one?

@hardillb
Copy link
Contributor Author

Upstream had a Git Token problem with the GH Action pushing the builds to the release page, so they haven't actually shipped any pre-built binaries yet. Said they didn't have time to look before Christmas.

We should open a follow up for the Mac builds and we should leave this in verify (and update the local install docs after) until upstream have fixed the token issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:install Part of the install/first-run user experience
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants