MinGW-w64 build of `wg_core` fails to link: `rstrtmgr` is only requested through `#pragma comment(lib)`

Open Beginner friendly
#274 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reading clean/installer/CMakeLists.txt and clean/installer/build-mingw.sh, then check how each build route links wg_core and uses LIBS. Add the Restart Manager library to both link configurations as described in the issue, and confirm the MinGW build links successfully.

Written by the indexing model from the issue text.

Description

Since the Restart Manager check in src/wg_core/record.cpp (#include <restartmanager.h> and
#pragma comment(lib, "rstrtmgr.lib")), a MinGW-w64 build fails at link time:

ld.lld: error: undefined symbol: RmStartSession
ld.lld: error: undefined symbol: RmRegisterResources
ld.lld: error: undefined symbol: RmGetList
ld.lld: error: undefined symbol: RmEndSession

#pragma comment(lib, ...) is an MSVC extension, so GCC and clang under MinGW ignore it. This hits the documented
MinGW routes: build-mingw.sh and the CMake build with a MinGW toolchain (also what clean/linux/run_wine_tests.py --tests launcher uses). The MSVC build is not affected.

Suggested fix: add rstrtmgr to target_link_libraries(wg_core PUBLIC ...) in clean/installer/CMakeLists.txt and
-lrstrtmgr to LIBS in clean/installer/build-mingw.sh (harmless with MSVC). Adding a MinGW build job to CI would
catch this kind of break; happy to send either as a small PR.

Dominant language
C++
Stars
12
Forks
2
Avg merge
3h 10m
Merged PRs (30d)
171

Getting set up

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 phantoslayer21/wronggpu

All issues in phantoslayer21/wronggpu

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.