Comments (7)
Hi,
Your build file is building with CGO enabled, which is not what we support or do for any of our official builds:
CGO_ENABLED=1
By building with CGO enabled, you building a dynamic binary which will depend on external dependencies rather than a static binary.
from telegraf.
@powersj
I don't know much about golang, I guess in traditional sense, you've meant static linkage?. By "CGO_ENABLED=1" is dynamic linkage?.
And there is no workaround regarding this ?.
from telegraf.
I guess in traditional sense, you've meant static linkage?. By "CGO_ENABLED=1" is dynamic linkage?.
Yes, there are a few other consequences as well, but that is the general difference. You can see:
- https://pkg.go.dev/cmd/cgo
- https://stackoverflow.com/questions/61515186/when-using-cgo-enabled-is-must-and-what-happens
- https://medium.com/@pengcheng1222/exploring-cgo-enabled-in-go-23cf5cf2fe88
And there is no workaround regarding this ?.
Why do you need to build a dynamic binary? By generating a static binary you avoid this all together.
from telegraf.
The go app that are used in OpenWrt are mostly/all dynamic i guess, "CGO_ENABLED=1" is hardcoded in golang compilation supports on OpenWrt.
For compiling telegraf with static linkage, what do I need to do manually?, what is the command line?, does passing "CGO_ENABLED=0" is enough?, it doesn't seems to work for my case.
What is the complete command lines , other than simple "make build" ?.
from telegraf.
The go app that are used in OpenWrt are mostly/all dynamic i guess, "CGO_ENABLED=1" is hardcoded in golang compilation supports on OpenWrt.
I thought someone was already building openwrt builds before. Did something change such that it broke?
other than simple "make build" ?.
That is how we produce all our artifacts. That roughly translates to:
branch := $(shell git rev-parse --abbrev-ref HEAD)
commit := $(shell git rev-parse --short=8 HEAD)
INTERNAL_PKG=github.com/influxdata/telegraf/internal
LDFLAGS := $(LDFLAGS) -X $(INTERNAL_PKG).Commit=$(commit) -X $(INTERNAL_PKG).Branch=$(branch)
CGO_ENABLED=0 go build -ldflags "-w -s $(LDFLAGS)" ./cmd/telegraf
You can add additional GO flags if required, like GOOS, GOARCH, etc. Or add LDFLAGS
from telegraf.
I am not a OpenWrt developer, only a user, but a PR that's comes in here .
$(1)/usr/bin/telegraf config > $(1)/etc/telegraf.conf
The compilation is going fine for the targeted devices but It's only for getting telegraf.conf, it's problematic if the libc or target is different than build system, I have tested that PR, if i am building targeting for glibc x86_64 then of course binary running fine.
Thank you for those snippet, it will be coming handy if just like old time, there is already extracted or given telegraf.conf somewhere, other than needs to run telegraf binary first.
from telegraf.
$(1)/usr/bin/telegraf config > $ (1)/etc/telegraf.conf
Keep in mind the user, you, can generate this later on. The configuration that is produced is not necessary to run telegraf as it is incomplete and does not include a working output. If a user needs this they can run the command and then go through it.
Our own builds will run go run ./cmd/telegraf config > etc/telegraf.conf
to generate the full config. This avoids running the locally built binary which as you discovered may be built for a different architecture.
Hopefully all these various steps help. I am going to close this as I don't think this is actually an issue with Telegraf itself.
from telegraf.
Related Issues (20)
- [inputs.tail] Logs being processed everytime the agent restarts HOT 2
- Debian Server Telegraf Docker Container fails to connect to OPCUA while Ubuntu Machine connects HOT 9
- [inputs.win_eventlog] Telegraf agent not collecting custom event logs HOT 4
- chore: support new golang version 1.22.3
- Add Python example for Execd plugin HOT 1
- [documentation]: improve details on kubernetes input configuration HOT 3
- Refreshing of Bearer token is unsupported in HTTP input plugin HOT 2
- influxdb_v2_listener rate limit HOT 10
- Internet Speed Monitor - add packet loss HOT 1
- Ping size configuration on Windows HOT 2
- feat(processors): Traffic shaper processor plugin to shape uneven distribution of incoming metrics HOT 1
- Kafka Input plugin - allow access to broker list through a VIP HOT 5
- No gather_time_ns when running Windows and --test HOT 2
- Adding support of extended_gateway to SFlow plugin HOT 10
- Support for explicit credentials for monitoring remote systems via win_perf_counters plugin HOT 2
- Cisco_telemetry_mdt input plugin incorrect parsing of child policy HOT 3
- Update produces log: "Failed to execute operation: File exists" HOT 4
- port_name plugin errors for unknown protocols cannot be silenced HOT 2
- Go Mod Toolkit more specific version HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telegraf.