Skip to content

_T3_WIDGET_DEBUG is unconditionally defined in src/Makefile, causing libt3widgetlog.txt to be created on every run #9

Description

@chrisdebian

1. Pre-submission Checklist

  • Searched existing open issues, not already reported
  • Checked changelog, no related note
  • Running latest stable (master branch as of 2026-06-18)
  • This is a bug, not a configuration question

2. Description

What went wrong? src/Makefile line 88 reads CXXFLAGS += -D_T3_WIDGET_DEBUG with no debug/release conditional around it, so every build of the library has debug logging compiled in permanently. This causes src/log.cc's init_log() to unconditionally fopen("libt3widgetlog.txt", "a") in the current working directory whenever any program linking against libt3widget runs.

What did you expect to happen? Debug logging should only be active in debug builds, not always-on in every build.

What actually happened? Any program using libt3widget (e.g. Tilde, see gphalkes/tilde#128) silently creates libt3widgetlog.txt in whatever directory it's run from, with no way to disable it short of patching the library and recompiling.

3. Steps to Reproduce

  1. Build libt3widget from src/Makefile as-is
  2. Run any program linked against it from an arbitrary directory
  3. Observe libt3widgetlog.txt appears in that directory

Reproducible consistently? Yes, by inspection of the unconditional flag, not just an occasional occurrence.

4. Version Information

Item Value
Project version master branch, 2026-06-18
Last known working version N/A, appears to have always been unconditional

5. Environment

N/A, this is independent of OS/environment, it's a build-time flag issue.

6. Relevant Logs and Output

N/A, no error, just unwanted file creation.

7. Relevant Configuration

src/Makefile, line 88:
CXXFLAGS += -D_T3_WIDGET_DEBUG

8. Suggested Fix

Gate the flag behind a make variable rather than removing debug capability entirely, e.g.:

ifeq ($(DEBUG),1)
CXXFLAGS += -D_T3_WIDGET_DEBUG
endif

This keeps the logging available for anyone actively debugging (make DEBUG=1), while making a default make build behave as a normal release build with no stray log files. Happy to put together a small PR for this if it's a welcome change.

9. Additional Context

Found while investigating gphalkes/tilde#128, which reports both log.txt and libt3widgetlog.txt being created on every run. This issue accounts for the libt3widgetlog.txt half of that report.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions