-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Bug Report
Describe the bug
Together with the fluent-bit-plugin repo, I tried to compile the out_stdout2 demo plugin under Windows. The dynamic plugin fails to build in the last stage where it tries to link it. It seems like the fluentbit library doesn't export function properly to work with DLLs (usually prefixed with __declspec(dllexport) I belive).
To Reproduce
All these commands assume that the basic build setup instructions for fluent-bit on Windows were followed and that they are being executed in a Developer PowerShell session.
- Clone fluent-bit and fluent-bit-plugin repos
- Install cmake via choco (
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System') - Run
cmake -G "NMake Makefiles"in the source repo - Fix the code of the
out_stdout2according to this PR. - Patch the
CMakeLists.txtfile to be able to find the missing header files from the source repo. (See CMakeLists.txt) - In the plugin repo create a folder called
buildand change into it. Then runcmake -G "NMake Makefiles" -DFLB_SOURCE='/path/to/your/source/repo' -DPLUGIN_NAME=out_stdout2 ../.
Expected behavior
It compiles successfully and creates a DLL which fluent-bit can load.
Your Environment
- Version used: 1.9.9
- Configuration: None
- Operating System and version: Windows 10
Additional context
This prevents us from writing any dynamically loaded plugins on Windows although the documentation states this as a feature.
Fyi the plugin loader in flb_plugin.c currently expects the loaded library to end with .so which is a bug in itself, but for now irrelevant since a simple renaming already serves as a workaround.