Sing-box attempts to send logs to log.tailscale.com despite Enforce NoLogsNoSupport
Operating system
Linux
System version
Fedora 42
Installation type
Original sing-box Command Line
If you are using a graphical client, please provide the version of the client.
None
Version
$ sing-box version
sing-box version 1.12.9
Environment: go1.25.1 linux/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale
Revision: 328a6de7976182700aaa4f7e2c134bd568b47d88
CGO: disabled
Description
- Expected behavior: With Enforce NoLogsNoSupport enabled, sing-box should not perform DNS queries for or send any logs to log.tailscale.com.
- Actual behavior: sing-box is making DNS queries for log.tailscale.com and then attempting an HTTPS connection to the resolved IP (ec2-54-161-152-147.compute-1.amazonaws.com / 54.161.152.147). The capture below shows DNS queries from the sing-box process and a following TCP SYN to the resolved host on port 443, which indicates log forwarding is being attempted despite the enforcement.
- The official tailscale client, when run with
TS_NO_LOGS_NO_SUPPORT=true, logs the messageYou have disabled logging. Tailscale will not be able to provide support.and does not connect to log.tailscale.com. sing-box does not log that message and still attempts to contact Tailscale log endpoints.
Logs:
- tcpdump excerpt showing DNS queries and TCP connection attempts
$ sudo tcpdump -i eth0
dropped privs to tcpdump
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
22:08:03.039297 IP app-singbox.40613 > 10.0.0.1.domain: 25150+ [1au] AAAA? log.tailscale.com. (46)
22:08:03.039377 IP app-singbox.54291 > 10.0.0.1.domain: 36349+ [1au] A? log.tailscale.com. (46)
...
22:08:03.092924 IP 10.0.0.1.domain > app-singbox.40613: 25150 1/0/1 AAAA 2600:1f18:429f:9305:590c:496f:7805:d86f (74)
22:08:03.092925 IP 10.0.0.1.domain > app-singbox.54291: 36349 1/0/1 A 54.161.152.147 (62)
22:08:03.093535 IP app-singbox.54228 > ec2-54-161-152-147.compute-1.amazonaws.com.https: Flags [S], seq 3650799077, win 64240, options [mss 1460,nop,nop,sackOK,nop,wscale 6], length 0
...
- sing-box logs (relevant traces around Tailscale endpoint):
INFO network: updated default interface eth0, index 3
TRACE endpoint/tailscale[hs-ep]: [v1] using fake (no-op) tun device
TRACE endpoint/tailscale[hs-ep]: [v1] using fake (no-op) OS network configurator
TRACE endpoint/tailscale[hs-ep]: dns: using *tailscale.dnsConfigurtor
TRACE endpoint/tailscale[hs-ep]: link state: interfaces.State{defaultRoute=[REDACTED_IP] ifs={eth0:[REDACTED_IP]/32 [REDACTED_IP]} v4=true v6=false}
TRACE endpoint/tailscale[hs-ep]: onPortUpdate(port=57319, network=udp6)
...
TRACE endpoint/tailscale[hs-ep]: Engine created.
...
- For comparison, official tailscaled behavior when TS_NO_LOGS_NO_SUPPORT=true:
systemd[1]: Starting tailscaled.service - Tailscale node agent...
tailscaled[1975]: 2025/10/13 :53:30 You have disabled logging. Tailscale will not be able to provide support.
tailscaled[1975]: logtail started
tailscaled[1975]: Program starting: v1.88.3-...
...
tailscaled[1975]: Engine created.
...
Reproduction
- Install sing-box v1.12.9 (original command-line).
- On the host run (example): sudo tcpdump -i eth0
- Configure and run sing-box with Tailscale endpoint.
- Observe DNS queries and outbound TCP attempts to log.tailscale.com shortly after sing-box starts.
Reproducible on a Linux host running sing-box with headscale as the control server.
Please let me know if you want me to attach full sing-box config used to reproduce.
Logs
# Interesting thing is that it says "NoLogsNoSupport":true
---
INFO network: updated default interface eth0, index 3
TRACE endpoint/tailscale[hs-ep]: [v1] using fake (no-op) tun device
TRACE endpoint/tailscale[hs-ep]: [v1] using fake (no-op) OS network configurator
TRACE endpoint/tailscale[hs-ep]: dns: using *tailscale.dnsConfigurtor
TRACE endpoint/tailscale[hs-ep]: link state: interfaces.State{defaultRoute=[REDACTED_IP] ifs={eth0:[REDACTED_IP]/32 [REDACTED_IP]} v4=true v6=false}
TRACE endpoint/tailscale[hs-ep]: onPortUpdate(port=57317, network=udp6)
TRACE endpoint/tailscale[hs-ep]: [v1] warning: fakeRouter.UpdateMagicsockPort: not implemented.
TRACE endpoint/tailscale[hs-ep]: magicsock: [warning] failed to force-set UDP read buffer size to 7340032: operation not permitted; using kernel default values (impacts throughput only)
TRACE endpoint/tailscale[hs-ep]: magicsock: [warning] failed to force-set UDP write buffer size to 7340032: operation not permitted; using kernel default values (impacts throughput only)
TRACE endpoint/tailscale[hs-ep]: onPortUpdate(port=43015, network=udp4)
TRACE endpoint/tailscale[hs-ep]: [v1] warning: fakeRouter.UpdateMagicsockPort: not implemented.
TRACE endpoint/tailscale[hs-ep]: magicsock: [warning] failed to force-set UDP read buffer size to 7340032: operation not permitted; using kernel default values (impacts throughput only)
TRACE endpoint/tailscale[hs-ep]: magicsock: [warning] failed to force-set UDP write buffer size to 7340032: operation not permitted; using kernel default values (impacts throughput only)
TRACE endpoint/tailscale[hs-ep]: [v1] magicsock: peermtu: peer MTU status is false
TRACE endpoint/tailscale[hs-ep]: magicsock: disco key = [REDACTED_KEY]
TRACE endpoint/tailscale[hs-ep]: Creating WireGuard device...
TRACE endpoint/tailscale[hs-ep]: Bringing WireGuard device up...
TRACE endpoint/tailscale[hs-ep]: wg: [v2] UDP bind has been updated
TRACE endpoint/tailscale[hs-ep]: wg: [v2] Interface state was Down, requested Up, now Up
TRACE endpoint/tailscale[hs-ep]: Bringing router up...
TRACE endpoint/tailscale[hs-ep]: [v1] warning: fakeRouter.Up: not implemented.
TRACE endpoint/tailscale[hs-ep]: Clearing router settings...
TRACE endpoint/tailscale[hs-ep]: [v1] warning: fakeRouter.Set: not implemented.
TRACE endpoint/tailscale[hs-ep]: Starting network monitor...
TRACE endpoint/tailscale[hs-ep]: Engine created.
DEBUG endpoint/tailscale[hs-ep]: tsnet running state path [REDACTED_PATH]
TRACE endpoint/tailscale[hs-ep]: pm: using backend prefs for "profile-bfc2": Prefs{ra=false dns=true want=true routes=[] statefulFiltering=false nf=on url="[REDACTED_URL]" host="app-singbox"}
TRACE endpoint/tailscale[hs-ep]: [v1] netmap packet filter: (not ready yet)
DEBUG endpoint/tailscale[hs-ep]: tsnet starting with hostname "[REDACTED_HOSTNAME]", varRoot "[REDACTED_ROOT]"
TRACE endpoint/tailscale[hs-ep]: Start
TRACE endpoint/tailscale[hs-ep]: wg: [v2] Routine: receive incoming mkReceiveFunc - started
TRACE endpoint/tailscale[hs-ep]: wg: [v2] Routine: receive incoming mkReceiveFunc - started
TRACE endpoint/tailscale[hs-ep]: wg: [v2] Routine: receive incoming receiveDERP - started
TRACE endpoint/tailscale[hs-ep]: [vJSON] {"Hostinfo":{"IPNVersion":"sing-box 1.12.9","BackendLogID":"[REDACTED_BACKEND_LOG_ID]","OS":"linux","OSVersion":"","Container":false,"Distro":"fedora","DistroVersion":"42","Desktop":true,"Hostname":"app-singbox","NoLogsNoSupport":true,"Machine":"x86_64","GoArch":"amd64","GoArchVar":"v1","GoVersion":"go1.25.1","Userspace":true,"UserspaceRouter":true,"AppConnector":false}}
TRACE endpoint/tailscale[hs-ep]: [v1] netmap packet filter: (not ready yet)
TRACE endpoint/tailscale[hs-ep]: control: [v1] HostInfo: {"IPNVersion":"sing-box 1.12.9","BackendLogID":"[REDACTED_BACKEND_LOG_ID]","OS":"linux","OSVersion":"","Container":false,"Distro":"fedora","DistroVersion":"42","Desktop":true,"Hostname":"app-singbox","NoLogsNoSupport":true,"Machine":"x86_64","GoArch":"amd64","GoArchVar":"v1","GoVersion":"go1.25.1","Userspace":true,"UserspaceRouter":true,"AppConnector":false}
TRACE endpoint/tailscale[hs-ep]: Backend: logs: be:[REDACTED_BACKEND_LOG_ID] fe:
TRACE endpoint/tailscale[hs-ep]: control: client.Login(0)
TRACE endpoint/tailscale[hs-ep]: control: [v1] authRoutine: state=new; goal=nil paused=false
TRACE endpoint/tailscale[hs-ep]: control: [v1] authRoutine: context done.
DEBUG endpoint/tailscale[hs-ep]: Authkey is set; but state is NoState. Ignoring authkey. Re-run with TSNET_FORCE_LOGIN=1 to force use of authkey.
TRACE endpoint/tailscale[hs-ep]: control: [v1] authRoutine: state=new; wantLoggedIn=true
TRACE endpoint/tailscale[hs-ep]: control: [v1] direct.TryLogin(flags=0)
TRACE endpoint/tailscale[hs-ep]: control: doLogin(regen=false, hasUrl=false)
TRACE endpoint/tailscale[hs-ep]: EditPrefs: MaskedPrefs{RouteAll=false ExitNodeIP=invalid IP AdvertiseRoutes=[]}
TRACE endpoint/tailscale[hs-ep]: [v1] netmap packet filter: (not ready yet)
TRACE endpoint/tailscale[hs-ep]: health(warnable=warming-up): error: Tailscale is starting. Please wait.
TRACE endpoint/tailscale[hs-ep]: control: [v1] mapRoutine: state:authenticating
TRACE endpoint/tailscale[hs-ep]: [v1] authReconfig: netmap not yet valid. Skipping.
INFO inbound/socks[socks-in]: tcp server started at [REDACTED_IP]:1080
TRACE endpoint/tailscale[hs-ep]: control: control server key from https://[REDACTED_URL]: ts2021=[REDACTED], legacy=
TRACE endpoint/tailscale[hs-ep]: control: RegisterReq: onode= node=[REDACTED_NODE] fup=false nks=false
TRACE endpoint/tailscale[hs-ep]: control: [v1] creating new noise client
TRACE endpoint/tailscale[hs-ep]: control: setting empty HTTPS port with http scheme and private host [REDACTED_IP]
INFO endpoint/tailscale[hs-ep]: output connection to [REDACTED_IP]:8080
INFO sing-box started (0.33s)
TRACE endpoint/tailscale[hs-ep]: control: RegisterReq: got response; nodeKeyExpired=false, machineAuthorized=true; authURL=false
TRACE endpoint/tailscale[hs-ep]: control: [v1] No AuthURL
TRACE endpoint/tailscale[hs-ep]: control: [v1] sendStatus: authRoutine-success: state:authenticated
TRACE endpoint/tailscale[hs-ep]: control: [v1] restartMap: synced=false
TRACE endpoint/tailscale[hs-ep]: control: [v1] authRoutine: state:authenticated; goal=nil paused=false
TRACE endpoint/tailscale[hs-ep]: control: [v1] PollNetMap: stream=false ep=[]
TRACE endpoint/tailscale[hs-ep]: [v1] authReconfig: netmap not yet valid. Skipping.
TRACE endpoint/tailscale[hs-ep]: control: [v1] mapRoutine: context done.
TRACE endpoint/tailscale[hs-ep]: control: [v1] mapRoutine: state:authenticated
TRACE endpoint/tailscale[hs-ep]: control: [v1] PollNetMap: stream=true ep=[]
TRACE endpoint/tailscale[hs-ep]: [v1] successful lite map update in 6ms
TRACE endpoint/tailscale[hs-ep]: {"controltime":"REDACTED"}
TRACE endpoint/tailscale[hs-ep]: control: [v1] new network map (periodic):
netmap: self: [REDACTED_NODE] auth=machine-authorized u=[REDACTED_USER] [REDACTED_IP]/32 [REDACTED_IP]/128
TRACE endpoint/tailscale[hs-ep]: control: [v1] mapRoutine: netmap received: state:synchronized
TRACE endpoint/tailscale[hs-ep]: control: [v1] sendStatus: mapRoutine-got-netmap: state:synchronized
TRACE endpoint/tailscale[hs-ep]: health(warnable=not-in-map-poll): ok
TRACE endpoint/tailscale[hs-ep]: [v2] netstack: registered IP [REDACTED_IP]/32
TRACE endpoint/tailscale[hs-ep]: [v2] netstack: registered IP [REDACTED_IP]/128
TRACE endpoint/tailscale[hs-ep]: active login: [REDACTED_USER]
TRACE endpoint/tailscale[hs-ep]: [v1] netmap packet filter: 1 filters
TRACE endpoint/tailscale[hs-ep]: [v1] magicsock: got updated network map; 1 peers
TRACE endpoint/tailscale[hs-ep]: Switching ipn state NoState -> Starting (WantRunning=true, nm=true)
TRACE endpoint/tailscale[hs-ep]: monitor: gateway and self IP changed: gw=[REDACTED_IP] self=[REDACTED_IP]
TRACE endpoint/tailscale[hs-ep]: magicsock: SetPrivateKey called (init)
TRACE endpoint/tailscale[hs-ep]: [v1] magicsock: peermtu: peer MTU status is false
TRACE endpoint/tailscale[hs-ep]: wgengine: Reconfig: configuring userspace WireGuard config (with 0/1 peers)
TRACE endpoint/tailscale[hs-ep]: wg: [v2] UAPI: Updating private key
TRACE endpoint/tailscale[hs-ep]: wgengine: Reconfig: configuring router
TRACE endpoint/tailscale[hs-ep]: dns: Set: {DefaultResolvers:[] Routes:{} SearchDomains:[example.com.] Hosts:2}
TRACE endpoint/tailscale[hs-ep]: dns: Resolvercfg: {Routes:{} Hosts:2 LocalDomains:[]}
TRACE endpoint/tailscale[hs-ep]: dns: OScfg: {SearchDomains:[example.com.] }
TRACE endpoint/tailscale[hs-ep]: [v1] wgengine: Reconfig done
TRACE endpoint/tailscale[hs-ep]: [v1] authReconfig: ra=false dns=true 0x00: <nil>
TRACE endpoint/tailscale[hs-ep]: peerapi: serving on http://[REDACTED_IP]:61123
TRACE endpoint/tailscale[hs-ep]: peerapi: serving on http://[REDACTED_IP]:61123
TRACE endpoint/tailscale[hs-ep]: [v1] magicsock: peermtu: peer MTU status is false
TRACE endpoint/tailscale[hs-ep]: [v1] wgengine: Reconfig done
TRACE endpoint/tailscale[hs-ep]: [v1] authReconfig: ra=false dns=true 0x00: <nil>
TRACE endpoint/tailscale[hs-ep]: control: [v1] HostInfo: {"IPNVersion":"sing-box 1.12.9","BackendLogID":"[REDACTED_BACKEND_LOG_ID]","OS":"linux","OSVersion":"","Container":false,"Distro":"fedora","DistroVersion":"42","Desktop":true,"Hostname":"app-singbox","NoLogsNoSupport":true,"Machine":"x86_64","GoArch":"amd64","GoArchVar":"v1","GoVersion":"go1.25.1","Userspace":true,"UserspaceRouter":true,"AppConnector":false}
TRACE endpoint/tailscale[hs-ep]: control: [v1] PollNetMap: stream=false ep=[]
TRACE endpoint/tailscale[hs-ep]: control: [v1] successful lite map update in 3ms
TRACE endpoint/tailscale[hs-ep]: netcheck: [v1] report: udp=true v6=false v6os=true mapvarydest=false portmap= v4a=[REDACTED_IP]/32 derp=7 derpdist=1v4:201ms,2v4:145ms,3v4:109ms,4v4:310ms,6v4:172ms,7v4:41ms,8v4:281ms,9v4:173ms,10v4:148ms,12v4:185ms,13v4:170ms,14v4:284ms,15v4:225ms,16v4:197ms,17v4:133ms,18v4:264ms,19v4:284ms,20v4:91ms,21v4:207ms,22v4:287ms,23v4:183ms,24v4:186ms,25v4:270ms,26v4:281ms,27v4:197ms,28v4:314ms
TRACE endpoint/tailscale[hs-ep]: magicsock: derp-7 connected; connGen=1
TRACE endpoint/tailscale[hs-ep]: health(warnable=no-derp-connection): ok
TRACE endpoint/tailscale[hs-ep]: netcheck: [v1] report: udp=true v6=false v6os=true mapvarydest=false portmap= v4a=[REDACTED_IP]/32 derp=7 derpdist=3v4:109ms,7v4:49ms,20v4:109ms
TRACE endpoint/tailscale[hs-ep]: control: [v0JSON]1{"controltime":"REDACTED"}
TRACE endpoint/tailscale[hs-ep]: control: [v1] mapRoutine: netmap received: state:synchronized
TRACE endpoint/tailscale[hs-ep]: control: [v1] sendStatus: mapRoutine-got-netmap: state:synchronized
TRACE endpoint/tailscale[hs-ep]: [v1] netmap diff:
- [MxetA] [REDACTED_KEY] D7 [REDACTED_IP] [REDACTED_IP]/128 : [REDACTED_IP]:35537 [REDACTED_IP]:41641 [REDACTED_IP]:35537
+ [MxetA] [REDACTED_KEY] D7 [REDACTED_IP] [REDACTED_IP]/128 : [REDACTED_IP]:41641 [REDACTED_IP]:41641
TRACE endpoint/tailscale[hs-ep]: [v1] magicsock: got updated network map; 1 peers
TRACE endpoint/tailscale[hs-ep]: [v1] magicsock: peermtu: peer MTU status is false
TRACE endpoint/tailscale[hs-ep]: [v1] wgengine: Reconfig done
TRACE endpoint/tailscale[hs-ep]: [v1] authReconfig: ra=false dns=true 0x00: <nil>
TRACE endpoint/tailscale[hs-ep]: control: [v0JSON]1{"controltime":"REDACTED"}
TRACE endpoint/tailscale[hs-ep]: control: [v1] mapRoutine: netmap received: state:synchronized
TRACE endpoint/tailscale[hs-ep]: control: [v1] sendStatus: mapRoutine-got-netmap: state:synchronized
TRACE endpoint/tailscale[hs-ep]: [v1] netmap diff:
- [MxetA] [REDACTED_KEY] D7 [REDACTED_IP] [REDACTED_IP]/128 : [REDACTED_IP]:41641 [REDACTED_IP]:41641
+ [MxetA] [REDACTED_KEY] D7 [REDACTED_IP] [REDACTED_IP]/128 : [REDACTED_IP]:40161 [REDACTED_IP]:40161
TRACE endpoint/tailscale[hs-ep]: [v1] magicsock: got updated network map; 1 peers
TRACE endpoint/tailscale[hs-ep]: [v1] magicsock: peermtu: peer MTU status is false
TRACE endpoint/tailscale[hs-ep]: [v1] wgengine: Reconfig done
TRACE endpoint/tailscale[hs-ep]: [v1] authReconfig: ra=false dns=true 0x00: <nil>
TRACE endpoint/tailscale[hs-ep]: netcheck: [v1] report: udp=true v6=false v6os=true mapvarydest=false portmap= v4a=[REDACTED_IP]/32 derp=7 derpdist=3v4:104ms,7v4:35ms,20v4:85ms
TRACE endpoint/tailscale[hs-ep]: [v1] magicsock: derp route for [MxetA] set to derp-7 (shared home)
TRACE endpoint/tailscale[hs-ep]: canceling captive portal context
TRACE endpoint/tailscale[hs-ep]: control: client.Shutdown ...
TRACE endpoint/tailscale[hs-ep]: control: [v1] authRoutine: context done.
TRACE endpoint/tailscale[hs-ep]: control: authRoutine: exiting
TRACE endpoint/tailscale[hs-ep]: control: updateRoutine: exiting
TRACE endpoint/tailscale[hs-ep]: control: [v1] PollNetMap: context canceled
TRACE endpoint/tailscale[hs-ep]: control: mapRoutine: exiting
TRACE endpoint/tailscale[hs-ep]: control: Client.Shutdown done.
TRACE endpoint/tailscale[hs-ep]: magicsock: closing connection to derp-7 (conn-close), age 59s
TRACE endpoint/tailscale[hs-ep]: magicsock: 0 active derp conns
TRACE endpoint/tailscale[hs-ep]: [v1] warning: fakeRouter.Close: not implemented.
TRACE endpoint/tailscale[hs-ep]: wg: [v2] Device closing
TRACE endpoint/tailscale[hs-ep]: wg: [v2] Routine: receive incoming receiveDERP - stopped
TRACE endpoint/tailscale[hs-ep]: wg: [v2] Routine: receive incoming mkReceiveFunc - stopped
TRACE endpoint/tailscale[hs-ep]: wg: [v2] Routine: receive incoming mkReceiveFunc - stopped
TRACE endpoint/tailscale[hs-ep]: wg: [v2] Device closed
Supporter
- [ ] I am a sponsor
Integrity requirements
- [x] I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
- [x] I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
- [x] I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
- [x] I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.
These are not Makefile variables, but C Preprocessor variables.
The way to pass such variables to the compiler via make is presumed standard, and looks like this:
CPPFLAGS="-DZSTDCLI_CLEVEL_DEFAULT=19 -DZSTDCLI_NBTHREADS_DEFAULT=16" make
It would be possible to add a paragraph in programs/README.md to explain that process and list preprocessor variables.
These are not
Makefilevariables, but C Preprocessor variables.
I know but that's not what I meant. Let me explain it - if a user passes CFLAGS to make it will replace the existing one.
$ echo "int main(){ return 0; }" > prog.c
$ cat << EOF > Makefile
CFLAGS += -O2 -Wall -Iinclude -DDEFINE1
LD=$(CC)
.c.o:
$(CC) $(CFLAGS) -c -o $@ $<
prog: prog.o
$(LD) -o $@ $+
EOF
$ make CFLAGS='-DDISPLAY_LEVEL_DEFAULT=1' -n
cc -DDISPLAY_LEVEL_DEFAULT=1 -c -o prog.o prog.c
cc -o prog prog.o
What I would expect to see is
$ make CFLAGS='-DDISPLAY_LEVEL_DEFAULT=1' -n
cc -O2 -Wall -Iinclude -DDEFINE1 -DDISPLAY_LEVEL_DEFAULT=1 -c -o prog.o prog.c
cc -o prog prog.o
Which I don't see doable with CFLAGS, only with separate variable. You can alway say that I can provide full CFLAGS generated by make but that's not reasonable option - how am I suppose to know what is full CFLAGS, not to mention it likely will change depending on target, system, whatever is detected...?
Just checked how it looks like with with zstd and, sure enough, it's just like that.
$ make zstd -n
CFLAGS=-O3 -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -Wpointer-arith -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings -Wredundant-decls -Wmissing-prototypes -Wc++-compat -Wa,--noexecstack
# pass CFLAGS to the make:
$ make CFLAGS='-DDISPLAY_LEVEL_DEFAULT=1' zstd -n
CFLAGS=-DDISPLAY_LEVEL_DEFAULT=1
- You should not use
CFLAGSto pass preprocessor variables, useCPPFLAGSinstead - If you pass a variable after
make, it indeed overrides any internal setting, which is probably not what is wanted in this instance. Pass it before themakeas an environment variable. Like in the suggested example.
Didn't know that, but it worked.
$ CFLAGS='-DDISPLAY_LEVEL_DEFAULT=1' make
cc -DDISPLAY_LEVEL_DEFAULT=1 -O2 -Wall -Iinclude -DDEFINE1 -c -o prog.o prog.c
cc -o prog prog.o
It didn't go so well with zstd:
$ CFLAGS='-DDISPLAY_LEVEL_DEFAULT=1' make zstd -n
echo CFLAGS=-DDISPLAY_LEVEL_DEFAULT=1 -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement -Wstrict-prototypes -Wundef -Wpointer-arith -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings -Wredundant-decls -Wmissing-prototypes -Wc++-compat -Wa,--noexecstack
It lost `-O3' somehow.
After passing said define through environment I get redefinition warning.
$ CFLAGS='-O3 -DDISPLAY_LEVEL_DEFAULT=1' make
fileio.c: In function ‘FIO_compressFilename’:
fileio.c:2150: warning: "DISPLAY_LEVEL_DEFAULT" redefined
#define DISPLAY_LEVEL_DEFAULT 2
Which is surprising - how does it work then?
#ifndef DISPLAY_LEVEL_DEFAULT
#define DISPLAY_LEVEL_DEFAULT 2
#endif
use CPPFLAGS instead
Does CPP here stand for C Pre Processor?
I don't think DISPLAY_LEVEL_DEFAULT was designed to be changed at compilation time.
For this capability to exist, it must be prepared.
Reason to change it is simple - I want it to work like other *nix compressors, without flooding console with running statistics. If I want them, and sometimes I will, then I type `-v'. Typing `-q' every single time, specially in scripts is tiresome. And it would be better to change it during compilation then edit source file every time you build a program.