Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

hc_persist_parity.cpp calls POSIX setenv/unsetenv: target does not build with MSVC, ctest reports 2 tests Not Run

Closed Beginner friendly
#3,093 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cmake, cpp

Research direction

Read the environment-setting code in src/kernels/hc_persist_parity.cpp and compare it with set_env in src/kernels/decode_cluster_parity.cpp. Add the Windows-specific environment handling described in the issue, then build the hc_persist_parity target on Windows and run hc_persist_parity and hc_persist_default_off through ctest; both should run successfully.

Written by the indexing model from the issue text.

Description

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
Dominant language
C++
Stars
11.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Niko1221/Strata

All issues in Niko1221/Strata

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.