Compile errors when building on mac · Issue #38 · nginxinc/nginx-otel (original) (raw)
I've been trying to build on mac for the past few hours, worked through a few bugs to get further in the script I'll outline below but couldn't get to a green build:
Targets not yet defined: absl::nullability, absl::prefetch, absl::common_policy_traits, absl::node_slot_policy...
To fix, I added find_package(absl CONFIG REQUIRED)
to line 4 of CMakeLists.txt
.
/tmp/nginx-otel/build/_deps/grpc-src/include/grpcpp/impl/codegen/security/auth_context.h:40:19: error: 'iterator<std::input_iterator_tag, const std::pair<grpc::string_ref, grpc::string_ref>>' is deprecated [-Werror,-Wdeprecated-declarations]
To fix, I commented out line 105 in CMakeLists.txt
to disable warnings (add_compile_options(-Wall -Wtype-limits -Werror)
)
[100%] Linking CXX shared module ngx_otel_module.so
ld: Undefined symbols:
_ngx_array_push, referenced from:
(anonymous namespace)::initModule(ngx_conf_s*) in http_module.cpp.o
(anonymous namespace)::initModule(ngx_conf_s*) in http_module.cpp.o
(anonymous namespace)::addSpanAttr(ngx_conf_s*, ngx_command_s*, void*) in http_module.cpp.o
_ngx_cached_time, referenced from:
(anonymous namespace)::onRequestEnd(ngx_http_request_s*) in http_module.cpp.o
_ngx_conf_log_error, referenced from:
(anonymous namespace)::mergeLocationConf(ngx_conf_s*, void*, void*) in http_module.cpp.o
(anonymous namespace)::setExporter(ngx_conf_s*, ngx_command_s*, void*) in http_module.cpp.o
(anonymous namespace)::setExporter(ngx_conf_s*, ngx_command_s*, void*)::$_2::__invoke(ngx_conf_s*, ngx_command_s*, void*) in http_module.cpp.o
_ngx_conf_parse, referenced from:
(anonymous namespace)::setExporter(ngx_conf_s*, ngx_command_s*, void*) in http_module.cpp.o
_ngx_conf_set_enum_slot, referenced from:
(anonymous namespace)::gCommands in http_module.cpp.o
_ngx_conf_set_msec_slot, referenced from:
(anonymous namespace)::gExporterCommands in http_module.cpp.o
_ngx_conf_set_size_slot, referenced from:
(anonymous namespace)::gExporterCommands in http_module.cpp.o
(anonymous namespace)::gExporterCommands in http_module.cpp.o
_ngx_conf_set_str_slot, referenced from:
(anonymous namespace)::gCommands in http_module.cpp.o
(anonymous namespace)::gExporterCommands in http_module.cpp.o
_ngx_connection_local_sockaddr, referenced from:
(anonymous namespace)::onRequestEnd(ngx_http_request_s*) in http_module.cpp.o
_ngx_current_msec, referenced from:
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*) in http_module.cpp.o
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*)::$_3::__invoke(ngx_event_s*) in http_module.cpp.o
_ngx_cycle, referenced from:
(anonymous namespace)::grpcLogHandler(gpr_log_func_args*) in http_module.cpp.o
(anonymous namespace)::protobufLogHandler(google::protobuf::LogLevel, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in http_module.cpp.o
BatchExporter::sendBatch(opentelemetry::proto::collector::trace::v1::ExportTraceServiceRequest&)::'lambda'(opentelemetry::proto::collector::trace::v1::ExportTraceServiceRequest, opentelemetry::proto::collector::trace::v1::ExportTraceServiceResponse, grpc::Status)::operator()(opentelemetry::proto::collector::trace::v1::ExportTraceServiceRequest, opentelemetry::proto::collector::trace::v1::ExportTraceServiceResponse, grpc::Status) const in http_module.cpp.o
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*)::$_3::__invoke(ngx_event_s*) in http_module.cpp.o
_ngx_event_timer_rbtree, referenced from:
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*) in http_module.cpp.o
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*) in http_module.cpp.o
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*)::$_3::__invoke(ngx_event_s*) in http_module.cpp.o
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*)::$_3::__invoke(ngx_event_s*) in http_module.cpp.o
_ngx_hash_find, referenced from:
(anonymous namespace)::setHeader(ngx_http_request_s*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::string_view) in http_module.cpp.o
_ngx_hash_key, referenced from:
(anonymous namespace)::ensureOtelCtx(ngx_http_request_s*) in http_module.cpp.o
(anonymous namespace)::ensureOtelCtx(ngx_http_request_s*) in http_module.cpp.o
(anonymous namespace)::setHeader(ngx_http_request_s*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::string_view) in http_module.cpp.o
_ngx_http_add_variable, referenced from:
(anonymous namespace)::addVariables(ngx_conf_s*) in http_module.cpp.o
(anonymous namespace)::addVariables(ngx_conf_s*) in http_module.cpp.o
(anonymous namespace)::addVariables(ngx_conf_s*) in http_module.cpp.o
(anonymous namespace)::addVariables(ngx_conf_s*) in http_module.cpp.o
_ngx_http_compile_complex_value, referenced from:
(anonymous namespace)::addSpanAttr(ngx_conf_s*, ngx_command_s*, void*) in http_module.cpp.o
_ngx_http_complex_value, referenced from:
(anonymous namespace)::onRequestStart(ngx_http_request_s*) in http_module.cpp.o
(anonymous namespace)::onRequestEnd(ngx_http_request_s*) in http_module.cpp.o
(anonymous namespace)::onRequestEnd(ngx_http_request_s*) in http_module.cpp.o
_ngx_http_core_module, referenced from:
(anonymous namespace)::initModule(ngx_conf_s*) in http_module.cpp.o
(anonymous namespace)::onRequestEnd(ngx_http_request_s*) in http_module.cpp.o
(anonymous namespace)::setHeader(ngx_http_request_s*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::string_view) in http_module.cpp.o
_ngx_http_module, referenced from:
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*) in http_module.cpp.o
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*)::$_3::__invoke(ngx_event_s*) in http_module.cpp.o
_ngx_http_set_complex_value_slot, referenced from:
(anonymous namespace)::gCommands in http_module.cpp.o
(anonymous namespace)::gCommands in http_module.cpp.o
_ngx_inet_get_port, referenced from:
(anonymous namespace)::onRequestEnd(ngx_http_request_s*) in http_module.cpp.o
(anonymous namespace)::onRequestEnd(ngx_http_request_s*) in http_module.cpp.o
_ngx_list_push, referenced from:
(anonymous namespace)::setHeader(ngx_http_request_s*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::string_view) in http_module.cpp.o
_ngx_log_error_core, referenced from:
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*) in http_module.cpp.o
(anonymous namespace)::exitWorkerProcess(ngx_cycle_s*) in http_module.cpp.o
(anonymous namespace)::onRequestEnd(ngx_http_request_s*) in http_module.cpp.o
(anonymous namespace)::onRequestEnd(ngx_http_request_s*) in http_module.cpp.o
(anonymous namespace)::grpcLogHandler(gpr_log_func_args*) in http_module.cpp.o
(anonymous namespace)::protobufLogHandler(google::protobuf::LogLevel, char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) in http_module.cpp.o
BatchExporter::sendBatch(opentelemetry::proto::collector::trace::v1::ExportTraceServiceRequest&)::'lambda'(opentelemetry::proto::collector::trace::v1::ExportTraceServiceRequest, opentelemetry::proto::collector::trace::v1::ExportTraceServiceResponse, grpc::Status)::operator()(opentelemetry::proto::collector::trace::v1::ExportTraceServiceRequest, opentelemetry::proto::collector::trace::v1::ExportTraceServiceResponse, grpc::Status) const in http_module.cpp.o
...
_ngx_palloc, referenced from:
(anonymous namespace)::setHeader(ngx_http_request_s*, opentelemetry::v1::nostd::string_view, opentelemetry::v1::nostd::string_view) in http_module.cpp.o
(anonymous namespace)::addSpanAttr(ngx_conf_s*, ngx_command_s*, void*) in http_module.cpp.o
_ngx_pcalloc, referenced from:
(anonymous namespace)::createMainConf(ngx_conf_s*) in http_module.cpp.o
(anonymous namespace)::createLocationConf(ngx_conf_s*) in http_module.cpp.o
_ngx_pnalloc, referenced from:
long (anonymous namespace)::hexIdVar<opentelemetry::v1::trace::TraceId>(ngx_http_request_s*, ngx_variable_value_t*, unsigned long) in http_module.cpp.o
long (anonymous namespace)::hexIdVar<opentelemetry::v1::trace::SpanId>(ngx_http_request_s*, ngx_variable_value_t*, unsigned long) in http_module.cpp.o
(anonymous namespace)::onRequestStart(ngx_http_request_s*) in http_module.cpp.o
_ngx_pool_cleanup_add, referenced from:
(anonymous namespace)::ensureOtelCtx(ngx_http_request_s*) in http_module.cpp.o
_ngx_rbtree_delete, referenced from:
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*) in http_module.cpp.o
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*)::$_3::__invoke(ngx_event_s*) in http_module.cpp.o
_ngx_rbtree_insert, referenced from:
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*) in http_module.cpp.o
(anonymous namespace)::initWorkerProcess(ngx_cycle_s*)::$_3::__invoke(ngx_event_s*) in http_module.cpp.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [ngx_otel_module.so] Error 1
make[1]: *** [CMakeFiles/ngx_otel_module.dir/all] Error 2
make: *** [all] Error 2
Being possible to compile on Mac.