mosquitto-go-auth: undefined reference to `mosquitto_client_id'
I’m trying to install it on raspberry pi, but i get this:
pi@raspberrypi:~/go/src/mosquitto-go-auth $ make
go build -buildmode=c-archive go-auth.go
go build -buildmode=c-shared -o go-auth.so
# github.com/iegomez/mosquitto-go-auth
/usr/bin/ld: $WORK/b001/_x003.o: in function `mosquitto_auth_acl_check':
auth-plugin.c:(.text+0x3ec): undefined reference to `mosquitto_client_id'
/usr/bin/ld: auth-plugin.c:(.text+0x3f8): undefined reference to `mosquitto_client_username'
collect2: error: ld returned 1 exit status
make: *** [Makefile:3: all] Error 2
can you help me out of this, thank you
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 34 (22 by maintainers)
Commits related to this issue
- Add flags for linker before make https://github.com/iegomez/mosquitto-go-auth/issues/91#issuecomment-826943411 — committed to home-assistant/addons by mdegat01 2 years ago
- Update mosquitto to 2.0.11 (#2453) * Update mosquitto base image to alpine 3.14 * Replace mosquitto-auth-plug with mosquitto-go-auth * Add flags for linker before make https://github.com/ieg... — committed to home-assistant/addons by mdegat01 2 years ago
- (split mosquitto)Update mosquitto to 2.0.11 (#2453) * Update mosquitto base image to alpine 3.14 * Replace mosquitto-auth-plug with mosquitto-go-auth * Add flags for linker before make https... — committed to scolby33/addons by mdegat01 2 years ago
@mkohns Thanks!!!
My host env is ubuntu 18.04, go 1.15.3 ,mosquitto 1.6.12 and go auth 1.1. I successfully build linux/arm target when I modify
export CGO_LDFLAGS="-shared -Wl,-unresolved-symbols=ignore-all"
I modify “go build -x -buildmode=c-shared -o go-auth.so”, I saw that cgo attach “-pie” to link parameters which cause this warning when target env is linux/arm.
Hi, I stumbled across this issue and debugged a bit. I still do not know the root cause for mosquitto-go-auth no building on raspberry pi - but i found a dirty solution for building this setup for rpi4
ENV MOSQUITTO_VERSION=1.6.10 ENV GO_VERSION=1.13.8
The reported linker error from @arctic-alpaca can actually be ignored. The reference is present - no idea why cgo has trouble finding it. With this patch file saved to patch.go-auth.go.rpi4 in docker subdirectoy
and this change in Dockerfile
The docker image can be build and runs smoothly with the newest version of mosquitto and auth plugin.
I suppose the patch file can be merged into master as the cgo directive should only hit armhf. But please double check.
@arctic-alpaca Thanks for sharing that description, it’ll surely be useful for anyone following your approach!
On the plugin version issue, I just created this PR which I believe fixes it: https://github.com/iegomez/mosquitto-go-auth/pull/103 Nevertheless, I’m waiting on comments in https://github.com/iegomez/mosquitto-go-auth/issues/96 to see if there’s anything else that needs consideration.
Cheers!
Hi! As the readme states, when building for Mosquitto 1.5 or later, you need to export some flags before:
Let me know if that works.