fluent / fluent-bit

Fast and Lightweight Logs and Metrics processor for Linux, BSD, OSX and Windows
https://fluentbit.io
Apache License 2.0
5.73k stars 1.56k forks source link

Build on macOS fails #9004

Open kiyutink opened 2 months ago

kiyutink commented 2 months ago

Bug Report

Describe the bug

following the instructions on https://docs.fluentbit.io/manual/installation/macos#get-the-source-and-build-it on macos 14.5.1 getting the following error:

Undefined symbols for architecture arm64:
  "_flb_ra_create", referenced from:
      _flb_mp_accessor_create in flb_mp.c.o
      _k8s_events_conf_create in libflb-plugin-in_kubernetes_events.a[2](kubernetes_events_conf.c.o)
      _flb_azure_conf_create in libflb-plugin-out_azure.a[2](azure_conf.c.o)
      _flb_es_conf_create in libflb-plugin-out_es.a[3](es_conf.c.o)
      _flb_es_conf_create in libflb-plugin-out_es.a[3](es_conf.c.o)
      _flb_es_conf_create in libflb-plugin-out_es.a[3](es_conf.c.o)
      _flb_http_conf_create in libflb-plugin-out_http.a[3](http_conf.c.o)
      _flb_http_conf_create in libflb-plugin-out_http.a[3](http_conf.c.o)
      ...
  "_flb_ra_create_str_from_list", referenced from:
      _create_label_map_entry in libflb-plugin-out_loki.a[2](loki.c.o)
  "_flb_ra_destroy", referenced from:
      _flb_mp_accessor_destroy in flb_mp.c.o
      _k8s_events_conf_destroy in libflb-plugin-in_kubernetes_events.a[2](kubernetes_events_conf.c.o)
      _flb_azure_conf_destroy in libflb-plugin-out_azure.a[2](azure_conf.c.o)
      _flb_es_conf_destroy in libflb-plugin-out_es.a[3](es_conf.c.o)
      _flb_es_conf_destroy in libflb-plugin-out_es.a[3](es_conf.c.o)
      _flb_http_conf_destroy in libflb-plugin-out_http.a[3](http_conf.c.o)
      _flb_http_conf_destroy in libflb-plugin-out_http.a[3](http_conf.c.o)
      ...
  "_flb_ra_get_kv_pair", referenced from:
      _flb_mp_accessor_keys_remove in flb_mp.c.o
      _post_all_requests in libflb-plugin-out_http.a[2](http.c.o)
      _post_all_requests in libflb-plugin-out_http.a[2](http.c.o)
      _log_record_set_body in libflb-plugin-out_opentelemetry.a[3](opentelemetry_logs.c.o)
      _cb_type_converter_filter in libflb-plugin-filter_type_converter.a[2](type_converter.c.o)
      _evaluate_condition_KEY_EXISTS in libflb-plugin-filter_modify.a[2](modify.c.o)
      _evaluate_condition_KEY_VALUE_EQUALS in libflb-plugin-filter_modify.a[2](modify.c.o)
      ...
  "_flb_ra_get_value_object", referenced from:
      _es_get_id_value in libflb-plugin-out_es.a[4](es.c.o)
      _pack_labels in libflb-plugin-out_loki.a[2](loki.c.o)
      _get_tenant_id_from_record in libflb-plugin-out_loki.a[2](loki.c.o)
      _os_get_id_value in libflb-plugin-out_opensearch.a[3](opensearch.c.o)
      _pack_map_meta in libflb-plugin-out_splunk.a[3](splunk.c.o)
      _pack_resource_labels in libflb-plugin-out_stackdriver.a[4](stackdriver.c.o)
      _get_otlp_group_metadata in libflb-plugin-out_opentelemetry.a[3](opentelemetry_logs.c.o)
      _get_otlp_group_metadata in libflb-plugin-out_opentelemetry.a[3](opentelemetry_logs.c.o)
      _get_otlp_group_metadata in libflb-plugin-out_opentelemetry.a[3](opentelemetry_logs.c.o)
      ...
  "_flb_ra_key_value_destroy", referenced from:
      _es_get_id_value in libflb-plugin-out_es.a[4](es.c.o)
      _es_get_id_value in libflb-plugin-out_es.a[4](es.c.o)
      _es_get_id_value in libflb-plugin-out_es.a[4](es.c.o)
      _pack_labels in libflb-plugin-out_loki.a[2](loki.c.o)
      _get_tenant_id_from_record in libflb-plugin-out_loki.a[2](loki.c.o)
      _get_tenant_id_from_record in libflb-plugin-out_loki.a[2](loki.c.o)
      _get_tenant_id_from_record in libflb-plugin-out_loki.a[2](loki.c.o)
      _get_tenant_id_from_record in libflb-plugin-out_loki.a[2](loki.c.o)
      ...
  "_flb_ra_regex_match", referenced from:
      _grep_filter_data in libflb-plugin-filter_log_to_metrics.a[2](log_to_metrics.c.o)
  "_flb_ra_subkey_count", referenced from:
      _insert_by_subkey_count in flb_mp.c.o
      _insert_by_subkey_count in flb_mp.c.o
  "_flb_ra_translate", referenced from:
      _azure_format in libflb-plugin-out_azure.a[3](azure.c.o)
      _elasticsearch_format in libflb-plugin-out_es.a[4](es.c.o)
      _pack_labels in libflb-plugin-out_loki.a[2](loki.c.o)
      _pack_labels in libflb-plugin-out_loki.a[2](loki.c.o)
      _opensearch_format in libflb-plugin-out_opensearch.a[3](opensearch.c.o)
      _opensearch_format in libflb-plugin-out_opensearch.a[3](opensearch.c.o)
      _extract_hec_token in libflb-plugin-out_splunk.a[3](splunk.c.o)
      ...
  "_flb_ra_translate_check", referenced from:
      _get_log_stream in libflb-plugin-out_cloudwatch_logs.a[3](cloudwatch_api.c.o)
      _get_log_stream in libflb-plugin-out_cloudwatch_logs.a[3](cloudwatch_api.c.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libfluent-bit.dylib] Error 1
make[1]: *** [src/CMakeFiles/fluent-bit-shared.dir/all] Error 2
make: *** [all] Error 2

Additional context I'm trying to pinpoint the codechange that caused https://github.com/fluent/fluent-bit/issues/8993 - for that i need to be able to build fluent-bit from sources

edsiper commented 2 months ago

if you do a basic cmake ../ inside build/ does it work ? (without setting any environment variable)

cosmo0920 commented 2 months ago

It seems that record accessor is not compiled correctly. Did you install bison and flex via homebrew?

kiyutink commented 2 months ago

if you do a basic cmake ../ inside build/ does it work ? (without setting any environment variable)

cmake succeeds (like in the other case too), but the subsequent make is where i get the errors

kiyutink commented 2 months ago

It seems that record accessor is not compiled correctly. Did you install bison and flex via homebrew?

Yep

➜  build git:(master) which flex
/opt/homebrew/opt/flex/bin/flex
➜  build git:(master) which bison
/opt/homebrew/opt/bison/bin/bison
edsiper commented 1 month ago

Make sure you have the proper versions:

~ $ flex --version
flex 2.6.4
~ $ bison --version
bison (GNU Bison) 3.8.2