Skip to content

fix(cpp): let concore.hpp build on Windows and macOS - #609

Open
Sahil-u07 wants to merge 1 commit into
ControlCore-Project:devfrom
Sahil-u07:fix/cpp-non-linux-build
Open

Sahil-u07 wants to merge 1 commit into
ControlCore-Project:devfrom
Sahil-u07:fix/cpp-non-linux-build

Conversation

@Sahil-u07

Copy link
Copy Markdown
Contributor

concore.hpp and concoredocker.hpp don't compile on Windows or macOS right now. ExtractNumeric returns key_t, which comes from <sys/ipc.h>, but that header is only included under #ifdef __linux__. So any C++ node fails to build outside Linux, including the windows build that mkconcore generates.

The value it returns is already stored in an int in the constructor, and the shared memory functions that actually need key_t are all inside the Linux guard, so I just changed the return type to int in both headers.

The existing C++ CI job only runs on Linux, which is why this wasn't caught. I added two jobs that build and run TestLiteralEvalCpp and TestConcoreHpp on Windows and macOS. On Windows it uses the MSYS2 UCRT64 gcc. I first tried the g++ that's already on the windows runner's PATH, but there std::ifstream reports success when opening a file that doesn't exist, which made one of the read status tests fail for reasons unrelated to concore.

Before

before

After

after

ExtractNumeric returned key_t, which comes from <sys/ipc.h>. That header
is only included under #ifdef __linux__, so concore.hpp and
concoredocker.hpp failed to compile anywhere else, including the
windows build that mkconcore generates. The value is already stored in
an int and the shared memory code that needs key_t is Linux only, so
just return int.

Added CI jobs that build and run the C++ tests on Windows (MSYS2 UCRT64
gcc) and macOS, since the existing C++ job only covers Linux.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant