Skip to content
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

Fix compilation in MacOS #2954

Merged
merged 1 commit into from
Jan 21, 2021
Merged

Fix compilation in MacOS #2954

merged 1 commit into from
Jan 21, 2021

Conversation

rofafor
Copy link
Contributor

@rofafor rofafor commented Jan 19, 2021

The current master doesn't compile with my MacOS (Big Sur, XCode 12.3) setup.

Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin20.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  1. Missing include prevents compilation:
[ 44%] Building C object src/CMakeFiles/fluent-bit-static.dir/flb_coro.c.o
In file included from /Users/a113889/Code/workspace/rofa/fluent-bit/src/flb_coro.c:22:
/Users/a113889/Code/workspace/rofa/fluent-bit/include/fluent-bit/flb_thread_storage.h:48:8: error: unknown type name 'pthread_key_t'
extern FLB_TLS_DEFINE(struct flb_worker, flb_worker_ctx)
       ^
/Users/a113889/Code/workspace/rofa/fluent-bit/include/fluent-bit/flb_thread_storage.h:43:36: note: expanded from macro 'FLB_TLS_DEFINE'
#define FLB_TLS_DEFINE(type, name) pthread_key_t name;
                                   ^
1 error generated.
make[2]: *** [src/CMakeFiles/fluent-bit-static.dir/flb_coro.c.o] Error 1
make[1]: *** [src/CMakeFiles/fluent-bit-static.dir/all] Error 2
make: *** [all] Error 2
  1. Wrong compiler flags prevents linking:
[ 84%] Linking C executable ../bin/fluent-bit
duplicate symbol '_mk_tls_cache_gmtext' in:
    ../library/libfluent-bit.a(flb_config.c.o)
    ../library/libfluent-bit.a(flb_engine.c.o)
...
duplicate symbol '_mk_tls_sched_worker_node' in:
    ../library/libfluent-bit.a(flb_config.c.o)
    ../lib/monkey/library/monkey-liana.a(liana.c.o)
ld: 420 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/fluent-bit] Error 1
make[1]: *** [src/CMakeFiles/fluent-bit-bin.dir/all] Error 2
make: *** [all] Error 2

Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • [N/A] Example configuration file for the change
  • [N/A] Debug log output from testing the change
  • [N/A] Attached Valgrind output that shows no leaks or memory corruption was found

Documentation

  • [N/A] Documentation required for this feature

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Signed-off-by: Rolf Ahrenberg <[email protected]>
@bluebike
Copy link
Contributor

PR worked in macOS catalina (10.15)

Just had to export MACOSX_DEPLOYMENT_TARGET=10.15

Note. In my case, if I have /usr/local/bin (with homebrew stuff) in beginning of PATH, make fails. Has been same all the time... strange.

@edsiper edsiper merged commit 89aa3ed into fluent:master Jan 21, 2021
@edsiper
Copy link
Member

edsiper commented Jan 21, 2021

thanks!

@rofafor rofafor deleted the feature/darwin branch January 21, 2021 08:00
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.

3 participants