Skip to content

Linking dynamic plugins under Windows not supported #6195

@tcinbis

Description

@tcinbis

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.

  1. Clone fluent-bit and fluent-bit-plugin repos
  2. Install cmake via choco (choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System')
  3. Run cmake -G "NMake Makefiles" in the source repo
  4. Fix the code of the out_stdout2 according to this PR.
  5. Patch the CMakeLists.txt file to be able to find the missing header files from the source repo. (See CMakeLists.txt)
  6. In the plugin repo create a folder called build and change into it. Then run cmake -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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleWindowsBugs and requests about Windows platformsbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions