From c73d0292f08856247b03092c4704ccf3087ead25 Mon Sep 17 00:00:00 2001 From: owent Date: Tue, 6 Jul 2021 11:01:20 +0800 Subject: [PATCH 1/2] Fix issue 892 Signed-off-by: owent --- bazel/curl.BUILD | 28 ++++++++++++++++++++++++---- examples/http/BUILD | 2 +- exporters/elasticsearch/BUILD | 6 +++--- ext/src/http/client/curl/BUILD | 2 +- ext/test/w3c_tracecontext_test/BUILD | 6 +++--- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/bazel/curl.BUILD b/bazel/curl.BUILD index 58c71748d4..630e075b01 100644 --- a/bazel/curl.BUILD +++ b/bazel/curl.BUILD @@ -6,13 +6,17 @@ package(features = ["no_copts_tokenization"]) config_setting( name = "windows", - values = {"cpu": "x64_windows"}, + constraint_values = [ + "@bazel_tools//platforms:windows", + ], visibility = ["//visibility:private"], ) config_setting( name = "osx", - values = {"cpu": "darwin"}, + constraint_values = [ + "@bazel_tools//platforms:osx", + ], visibility = ["//visibility:private"], ) @@ -27,11 +31,27 @@ cc_library( ]), copts = CURL_COPTS + [ "-DOS=\"os\"", - "-DCURL_EXTERN_SYMBOL=__attribute__((__visibility__(\"default\")))", + # "-DCURL_EXTERN_SYMBOL=__attribute__((__visibility__(\"default\")))", ], + defines = ["CURL_STATICLIB"], includes = [ "include/", "lib/", ], + linkopts = select({ + "//:windows": [ + "-DEFAULTLIB:ws2_32.lib", + "-DEFAULTLIB:advapi32.lib", + "-DEFAULTLIB:crypt32.lib", + "-DEFAULTLIB:Normaliz.lib", + ], + "//:osx": [ + "-framework SystemConfiguration", + "-lpthread", + ], + "//conditions:default": [ + "-lpthread", + ], + }), visibility = ["//visibility:public"], -) \ No newline at end of file +) diff --git a/examples/http/BUILD b/examples/http/BUILD index 6f0618fd85..809a69484e 100644 --- a/examples/http/BUILD +++ b/examples/http/BUILD @@ -6,7 +6,7 @@ cc_binary( ], # TODO: Move copts/linkopts for static CURL usage into shared bzl file. copts = [ - "-DCURL_STATICLIB", + # "-DCURL_STATICLIB", "-DWITH_CURL", ], linkopts = select({ diff --git a/exporters/elasticsearch/BUILD b/exporters/elasticsearch/BUILD index dd6547d511..6da2512700 100644 --- a/exporters/elasticsearch/BUILD +++ b/exporters/elasticsearch/BUILD @@ -9,9 +9,9 @@ cc_library( "include/opentelemetry/exporters/elasticsearch/es_log_exporter.h", "include/opentelemetry/exporters/elasticsearch/es_log_recordable.h", ], - copts = [ - "-DCURL_STATICLIB", - ], + # copts = [ + # "-DCURL_STATICLIB", + # ], linkopts = select({ "//bazel:windows": [ "-DEFAULTLIB:advapi32.lib", diff --git a/ext/src/http/client/curl/BUILD b/ext/src/http/client/curl/BUILD index 6d484d3770..95dc543038 100644 --- a/ext/src/http/client/curl/BUILD +++ b/ext/src/http/client/curl/BUILD @@ -8,7 +8,7 @@ cc_library( ], # TODO: Move copts/linkopts for static CURL usage into shared bzl file. copts = [ - "-DCURL_STATICLIB", + # "-DCURL_STATICLIB", "-DWITH_CURL", ], include_prefix = "src/http/client/curl", diff --git a/ext/test/w3c_tracecontext_test/BUILD b/ext/test/w3c_tracecontext_test/BUILD index 19407e6b91..0e2b7f77be 100644 --- a/ext/test/w3c_tracecontext_test/BUILD +++ b/ext/test/w3c_tracecontext_test/BUILD @@ -4,9 +4,9 @@ cc_binary( "main.cc", ], # TODO: Move copts/linkopts for static CURL usage into shared bzl file. - copts = [ - "-DCURL_STATICLIB", - ], + # copts = [ + # "-DCURL_STATICLIB", + # ], linkopts = select({ "//bazel:windows": [ "-DEFAULTLIB:advapi32.lib", From 6d15c6aa0b54798c3dd32e68d7b2c337cbbaa362 Mon Sep 17 00:00:00 2001 From: owent Date: Tue, 6 Jul 2021 14:50:40 +0800 Subject: [PATCH 2/2] Remove the useless comments Signed-off-by: owent --- bazel/curl.BUILD | 1 - examples/http/BUILD | 2 -- exporters/elasticsearch/BUILD | 3 --- ext/src/http/client/curl/BUILD | 2 -- ext/test/w3c_tracecontext_test/BUILD | 4 ---- 5 files changed, 12 deletions(-) diff --git a/bazel/curl.BUILD b/bazel/curl.BUILD index 630e075b01..2c668b895c 100644 --- a/bazel/curl.BUILD +++ b/bazel/curl.BUILD @@ -31,7 +31,6 @@ cc_library( ]), copts = CURL_COPTS + [ "-DOS=\"os\"", - # "-DCURL_EXTERN_SYMBOL=__attribute__((__visibility__(\"default\")))", ], defines = ["CURL_STATICLIB"], includes = [ diff --git a/examples/http/BUILD b/examples/http/BUILD index 809a69484e..90624c1cb3 100644 --- a/examples/http/BUILD +++ b/examples/http/BUILD @@ -4,9 +4,7 @@ cc_binary( "client.cc", "tracer_common.h", ], - # TODO: Move copts/linkopts for static CURL usage into shared bzl file. copts = [ - # "-DCURL_STATICLIB", "-DWITH_CURL", ], linkopts = select({ diff --git a/exporters/elasticsearch/BUILD b/exporters/elasticsearch/BUILD index 6da2512700..29e9262b59 100644 --- a/exporters/elasticsearch/BUILD +++ b/exporters/elasticsearch/BUILD @@ -9,9 +9,6 @@ cc_library( "include/opentelemetry/exporters/elasticsearch/es_log_exporter.h", "include/opentelemetry/exporters/elasticsearch/es_log_recordable.h", ], - # copts = [ - # "-DCURL_STATICLIB", - # ], linkopts = select({ "//bazel:windows": [ "-DEFAULTLIB:advapi32.lib", diff --git a/ext/src/http/client/curl/BUILD b/ext/src/http/client/curl/BUILD index 95dc543038..33ab814b91 100644 --- a/ext/src/http/client/curl/BUILD +++ b/ext/src/http/client/curl/BUILD @@ -6,9 +6,7 @@ cc_library( "http_client_curl.cc", "http_client_factory_curl.cc", ], - # TODO: Move copts/linkopts for static CURL usage into shared bzl file. copts = [ - # "-DCURL_STATICLIB", "-DWITH_CURL", ], include_prefix = "src/http/client/curl", diff --git a/ext/test/w3c_tracecontext_test/BUILD b/ext/test/w3c_tracecontext_test/BUILD index 0e2b7f77be..e52c943fe3 100644 --- a/ext/test/w3c_tracecontext_test/BUILD +++ b/ext/test/w3c_tracecontext_test/BUILD @@ -3,10 +3,6 @@ cc_binary( srcs = [ "main.cc", ], - # TODO: Move copts/linkopts for static CURL usage into shared bzl file. - # copts = [ - # "-DCURL_STATICLIB", - # ], linkopts = select({ "//bazel:windows": [ "-DEFAULTLIB:advapi32.lib",