[GH-ISSUE #3093] hc_persist_parity.cpp calls POSIX setenv/unsetenv: target does not build with MSVC, ctest reports 2 tests Not Run #1237

Closed
opened 2026-11-04 01:49:38 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @gputier on GitHub (Oct 18, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3093

Context

On main at 477ac13c (2026-10-16), tag v0.1.45, the Windows build (Release, CUDA 13.4, sm_120, RTX 5090) fails to compile src/kernels/hc_persist_parity.cpp with MSVC. Lines 55-56:

if (off) unsetenv("STRATA_HC_PERSIST"); else setenv("STRATA_HC_PERSIST", "1", 1);

setenv and unsetenv are POSIX functions. MSVC does not declare them. The compiler reports:

hc_persist_parity.cpp(55): error C3861: 'unsetenv': identifier not found
hc_persist_parity.cpp(56): error C3861: 'setenv': identifier not found

Consequence

The hc_persist_parity target does not build on Windows. ctest marks hc_persist_parity and hc_persist_default_off as "Not Run" (CMakeLists.txt lines 1115-1119). The engine itself is not affected, since STRATA_HC_PERSIST is off by default. The test was added by cea3d61b, after 0.1.42.

Proposed fix

The repository already handles this case elsewhere. set_env in src/kernels/decode_cluster_parity.cpp lines 46-52 calls _putenv_s(name, value) under _WIN32 and setenv(name, value, 1) on other platforms. The same guard applies here. On Windows, _putenv_s with an empty value removes the variable (documented behavior), so the --off case maps to it:

#ifdef _WIN32
    if (off) _putenv_s("STRATA_HC_PERSIST", "");
    else _putenv_s("STRATA_HC_PERSIST", "1");
#else
    if (off) unsetenv("STRATA_HC_PERSIST");
    else setenv("STRATA_HC_PERSIST", "1", 1);
#endif
Originally created by @gputier on GitHub (Oct 18, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3093 ## Context On `main` at 477ac13c (2026-10-16), tag v0.1.45, the Windows build (Release, CUDA 13.4, sm_120, RTX 5090) fails to compile `src/kernels/hc_persist_parity.cpp` with MSVC. Lines 55-56: ```cpp if (off) unsetenv("STRATA_HC_PERSIST"); else setenv("STRATA_HC_PERSIST", "1", 1); ``` `setenv` and `unsetenv` are POSIX functions. MSVC does not declare them. The compiler reports: ``` hc_persist_parity.cpp(55): error C3861: 'unsetenv': identifier not found hc_persist_parity.cpp(56): error C3861: 'setenv': identifier not found ``` ## Consequence The `hc_persist_parity` target does not build on Windows. ctest marks `hc_persist_parity` and `hc_persist_default_off` as "Not Run" (CMakeLists.txt lines 1115-1119). The engine itself is not affected, since `STRATA_HC_PERSIST` is off by default. The test was added by cea3d61b, after 0.1.42. ## Proposed fix The repository already handles this case elsewhere. `set_env` in `src/kernels/decode_cluster_parity.cpp` lines 46-52 calls `_putenv_s(name, value)` under `_WIN32` and `setenv(name, value, 1)` on other platforms. The same guard applies here. On Windows, `_putenv_s` with an empty value removes the variable (documented behavior), so the `--off` case maps to it: ```cpp #ifdef _WIN32 if (off) _putenv_s("STRATA_HC_PERSIST", ""); else _putenv_s("STRATA_HC_PERSIST", "1"); #else if (off) unsetenv("STRATA_HC_PERSIST"); else setenv("STRATA_HC_PERSIST", "1", 1); #endif ```
Author
Owner

@Niko1221 commented on GitHub (Oct 19, 2026):

Thanks for taking the time to report this.

We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.

To reopen it takes about two minutes:

  1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see.
  2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other].
  3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system.
  4. Comment /reopen. A check runs and either reopens the issue or lists what is still missing.

The rules are in CONTRIBUTING.md.

<!-- gh-comment-id:6271469508 --> @Niko1221 commented on GitHub (Oct 19, 2026): Thanks for taking the time to report this. We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected. To reopen it takes about two minutes: 1. Re-test on 0.2.0-beta. It may already be fixed. Write down what you see. 2. Start the title with its area: [Engine], [GUI], [TUI], [Benchmark], [Docs] or [Other]. 3. Fill in the parts of the issue form: what happened, the Strata version, your graphics card, memory and system. 4. Comment `/reopen`. A check runs and either reopens the issue or lists what is still missing. The rules are in [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#1237
No description provided.