8000 Error compiling test program using fluent-bit API with fluent-bit.h and g++ compiler · Issue #9746 · fluent/fluent-bit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Error compiling test program using fluent-bit API with fluent-bit.h and g++ compiler #9746

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

Closed
PBC-Logos opened this issue Dec 18, 2024 · 3 comments

Comments

@PBC-Logos
Copy link
PBC-Logos commented Dec 18, 2024

Fluent-bit is compiled under linux (Ubuntu 24.04 LTS) from source (tag v3.2.2) Using a C-compiler (gcc) test program compiles fine Using g++ I get compile errors from mpack.h complaining about conflicting declarations (see example below)

This my simple program:

#include <fluent-bit.h> 
#include <fluent-bit/flb_sds.h>

void flb_test_line_format()
{
    flb_ctx_t *ctx;

    /* Create context */
    ctx = flb_create();
    flb_service_set(ctx, "flush", "1", "grace", "1",
                    "log_level", "error",
                    NULL);
}

int main()
{
    return 0;
} 

This is part of the reported errors from g++:

In file included from /home/pbc/fluent-bit/lib/ctraces/include/ctraces/ctraces.h:31, 
from /home/pbc/fluent-bit/include/fluent-bit/flb_input_trace.h:24, 
from /home/pbc/fluent-bit/include/fluent-bit/flb_input.h:41, 
from /home/pbc/fluent-bit/include/fluent-bit/flb_engine.h:25, 
from /home/pbc/fluent-bit/include/fluent-bit/flb_output.h:38: /home/pbc/fluent-bit/lib/mpack-amalgamation-1.1.1/src/mpack/mpack.h: At global scope: /home/pbc/fluent-bit/lib/mpack-amalgamation-1.1.1/src/mpack/mpack.h:4206:19: error: conflicting declaration of C function ‘void mpack_write(mpack_writer_t*, int16_t)’ 4206 | MPACK_INLINE void mpack_write(mpack_writer_t* writer, int16_t value) { | ^~~~~~~~~~~ /home/pbc/fluent-bit/lib/mpack-amalgamation-1.1.1/src/mpack/mpack.h:4202:19: note: previous declaration ‘void mpack_write(mpack_writer_t*, int8_t)’ 4202 | MPACK_INLINE void mpack_write(mpack_writer_t* writer, int8_t value) {

mpack.h wants to overload functions which is allowed with g++, but it seems this is run with extern "C" although the extern "C" is ended immediately above the overloaded functions.

What am I missing here?

All headers are included from the fluent-bit repository the same way as the c-files in tests/runtime are compiled (tested with make VERBOSE=1)

@tony1411742631
Copy link
tony1411742631 commented Feb 21, 2025

Has this problem been resolved? I encountered a similar error.

In file included from external/fluent_bit/include/fluent-bit.h:41:  
In file included from external/fluent_bit/include/fluent-bit/flb_output.h:38:  
In file included from external/fluent_bit/include/fluent-bit/flb_engine.h:25:  
In file included from external/fluent_bit/include/fluent-bit/flb_input.h:41:  
In file included from external/fluent_bit/include/fluent-bit/flb_input_trace.h:24:  
In file included from external/fluent_bit/include/ctraces/ctraces/ctraces.h:31:  
external/fluent_bit/include/mpack/mpack/mpack.h:4206:19: error: conflicting types for 'mpack_write'  
MPACK_INLINE void mpack_write(mpack_writer_t* writer, int16_t value) {  
                  ^  
external/fluent_bit/include/mpack/mpack/mpack.h:4202:19: note: previous definition is here  
MPACK_INLINE void mpack_write(mpack_writer_t* writer, int8_t value) {  
                  ^```

Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

@github-actions github-actions bot added the Stale label May 23, 2025
Copy link
Contributor

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants
0