-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Compilation for Inventory Module on Windows Using MSVC #167
Comments
Compiler levelThe identified differences at a compiler level are:
AttributesGCC attributes are used for several uses in GCC based code, that are either incompatible or have no alternative in MSVC. Some possiblities are:
FlagsIn the case of flags, thechanges must be done at the cmakelist.txt files. Currently, there is no convention on how to apply them:
Currently, a mixture of both exits in all cmakelists.txt. pragmasAlthough pragmas are compiler options, these are used at a source code level. Their usage should consider if the pragma exists for both compilers, or use the same considerations as for the attributes. Source code levelSome incompatibilites at source code level were identified:
Language unsupported or incompatible featuresThere are some language features that are supported or even exclusive to GCC that are not supported by MSVC. Unavailable librariesSeveral libraries were provided by MinGW (POSIX for example), that are not available at MSVC. Different approaches can be presented to provide compatibility for the lack of libraries:
platformA_component.c
platformB_component.c
higher_level_code.c
pal_platformA.c
pal_platformB.c
ConclusionThe best approach, from my point of view, would be using the 4th strategie, since it is a tidier approach than the first 3, but doesn't increment the necessary time as the fifth strategy. |
Hi @ncvicchi , I share with you the changes with which I was able to continue using the agent in windows. Changes
Changes to the CMakefiles.txt files were made to make warnings (treated as errors) from To avoid previous problems related to these warnings treated as errors what I did was to install locally CC: @cborla |
Moved to on hold until the release testing stage is completed. |
On hold to work on higher priority tasks (release tasks) |
Description
Currently, several functions are mocked to enable the Wazuh agent to compile with the inventory module on Windows using MSVC. The code needs to be updated to replace the mocked functions with working implementations and ensure compatibility with MSVC.
The objective is to complete the simulated parts and allow the agent inventory module to successfully compile using MSVC on Windows, and have the same functionality as is available on the other operating systems.
Current Compilation Status:
At this point, the code compiles but remains non-functional, as many functions are mocked or replaced with placeholders. The goal is to finalize the compilation process while addressing MSVC-specific issues and resolving the mocked functionalities.
Tasks:
Replace Mocked Functions: Implement or find equivalents for the following mocked functions and types:
localtime_r
)opendir
,readdir
,closedir
, etc.)dirname
,PathFindFileNameA
,PathRemoveFileSpec
)ssize_t
,NETIOAPI_API
, etc.)strtok_r
)CMake Adjustments: Update the
CMakeLists.txt
files to handle MSVC-specific configurations, replacing GCC/MinGW flags and pragmas that are incompatible with MSVC.Normalize Preprocessor Directives: Standardize conditional behavior based on platform or compiler (
WIN32
,MSVC
,GCC
, etc.). Awaiting a definitionHandle Circular Inclusion Issues: Resolve the recursive circular inclusion problem in MSVC, which may require restructuring shared headers.
Testing: Re-enable tests for
AgentTest
andInventoryTest
once the implementation is complete.Document Compiler Flags: Update the documentation to reflect the required MSVC flags and any platform-specific settings.
Steps to Compile:
The text was updated successfully, but these errors were encountered: