MSVC build is broken (undeclared `DTLS_DEBUG_BUF_SIZE`)
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- c, cmake
- Domain
- build-system
Research direction
Start with dtls_debug.c, comparing the preprocessor condition around the DTLS_DEBUG_BUF_SIZE declaration (around lines 250–279) with its use around lines 397–403. Reproduce with the CMake configure and build commands on Windows with MSVC; the issue is done when that build succeeds. Pull request #296 is already open for this issue.
Written by the indexing model from the issue text.
Description
The MSVC-Build is currently (develop: https://github.com/eclipse-tinydtls/tinydtls/commit/d9738c31c374d879140f408ac81f2752eacaed4d) broken. It looks like a 4-year-old regression (see below).
Observation
Building with basic cmake commands under Win11 with VS2026:
$ rm -rf build/; cmake -B build && cmake --build build
-- Building for: Visual Studio 18 2026
-- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.51.36256.0
-- The CXX compiler identification is MSVC 19.51.36256.0
[...]
D:\github\eclipse-tinydtls\tinydtls\dtls_debug.c(402,16): error C2065: 'DTLS_DEBUG_BUF_SIZE': undeclared identifier [D:\github\eclipse-tinydtls\tinydtls\build\tinydtls.vcxproj]
D:\github\eclipse-tinydtls\tinydtls\dtls_debug.c(402,16): error C2057: expected constant expression [D:\github\eclipse-tinydtls\tinydtls\build\tinydtls.vcxproj]
D:\github\eclipse-tinydtls\tinydtls\dtls_debug.c(402,16): error C2466: cannot allocate an array of constant size 0 [D:\github\eclipse-tinydtls\tinydtls\build\tinydtls.vcxproj]
D:\github\eclipse-tinydtls\tinydtls\dtls_debug.c(402,8): error C2133: 'message': unknown size [D:\github\eclipse-tinydtls\tinydtls\build\tinydtls.vcxproj]
Build fails because of error C2065: 'DTLS_DEBUG_BUF_SIZE': undeclared identifier.
Analysis
The indentifier DTLS_DEBUG_BUF_SIZE is undeclared in this constellation because
-
It gets declared inside a preprocessor condition
#if !defined(WITH_CONTIKI) && !defined(_MSC_VER):
https://github.com/eclipse-tinydtls/tinydtls/blob/d9738c31c374d879140f408ac81f2752eacaed4d/dtls_debug.c#L250-L279 -
It gets used inside a different preprocessor condition
#ifndef WITH_CONTIKI
https://github.com/eclipse-tinydtls/tinydtls/blob/d9738c31c374d879140f408ac81f2752eacaed4d/dtls_debug.c#L397-L403
This means that the identifier is undeclared when building without contiki with the MSVC compiler.
It has probably been this way since the introduction of DTLS_DEBUG_BUF_SIZE in 2022: https://github.com/eclipse-tinydtls/tinydtls/commit/70a2b397af0b69488380689087fbc0562cebd497 (unconfirmed).
Conclusion
I'm not sure what the correct fix would be, but changing the latter condition to equal the former at least builds without errors again.
- Dominant language
- C
- Stars
- 122
- Forks
- 67
- Avg merge
- 6d 8h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from eclipse-tinydtls/tinydtls
-
ECDHE_ECDSA ClientKeyExchange rejected as too short when DTLS_PSK_MAX_CLIENT_IDENTITY_LEN > 64Possibly taken A pull request linked to this issue is open or already merged. Openbug good first issue please retest
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
eclipse-tinydtls/tinydtls#298 · 2 comments ·
Maintainers usually reply within 2 days
-
`dtls_get_cookie`: dereference before the length check (currently masked by `dtls_create_cookie`)Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
eclipse-tinydtls/tinydtls#279 · 2 comments · 1 reaction ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 57/100
eclipse-tinydtls/tinydtls#278 · 3 comments · 1 reaction ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
eclipse-tinydtls/tinydtls#274 · 2 comments ·
Maintainers usually reply within 2 days
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
eclipse-tinydtls/tinydtls#273 · 2 comments ·
Maintainers usually reply within 2 days
All issues in eclipse-tinydtls/tinydtls
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
FujiNetWIFI/fujinet-lib#115 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
KalicoCrew/kalico#1012 ·
Maintainers usually reply within 1 day
-
[Fix proposed] macOS 10.9: crash on startup due to +[NSColor linkColor] (10.10+ API) in menu_macos.mmPossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
joncampbell123/dosbox-x#6664 ·
Maintainers usually reply within 1 day
-
bug intrinsic low priority rt_lib
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day