open-telemetry / opentelemetry-cpp

The OpenTelemetry C++ Client
https://opentelemetry.io/
Apache License 2.0
850 stars 403 forks source link

Some symbols are missing when compiling to iOS #2649

Closed owent closed 4 months ago

owent commented 5 months ago

Describe your environment

Target system: iOS.

Dependencies:

Steps to reproduce

'/opt/homebrew/Cellar/cmake/3.29.2/bin/cmake' '../../../../../third_party/packages/opentelemetry-cpp-v1.15.0' '-Wno-dev' '-DCMAKE_INSTALL_PREFIX=/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/ios-arm64-appleclang' '-G' 'Unix Makefiles' '-DCMAKE_MAKE_PROGRAM=/usr/bin/make' '-DCMAKE_EXE_LINKER_FLAGS=-pthread' '-DCMAKE_MODULE_LINKER_FLAGS=-pthread' '-DCMAKE_SHARED_LINKER_FLAGS=-pthread' '-DCMAKE_STATIC_LINKER_FLAGS=' '-DCMAKE_BUILD_RPATH=/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/ios-arm64-appleclang/lib64;/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/ios-arm64-appleclang/lib' '-DCMAKE_INSTALL_RPATH=@rpath;@rpath/../lib64;@rpath/../lib' '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=YES' '-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON' '-DCMAKE_EXPORT_PACKAGE_REGISTRY=OFF' '-DCMAKE_OSX_ARCHITECTURES=arm64' '-DCMAKE_OSX_DEPLOYMENT_TARGET=17.0' '-DCMAKE_OSX_SYSROOT=/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk' '-DCMAKE_FIND_PACKAGE_REDIRECTS_DIR=/Users/runner/work/cmake-toolset/cmake-toolset/test/build_jobs_dir/build_jobs_arm64/CMakeFiles/pkgRedirects' '-DCMAKE_AR=/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar' '-DCMAKE_RANLIB=/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib' '-DCMAKE_SYSTEM_NAME=iOS' '-DCMAKE_SYSTEM_PROCESSOR=aarch64' '-DCMAKE_C_FLAGS=-fPIC -fembed-bitcode=off -pthread' '-DCMAKE_C_FLAGS_DEBUG=-g' '-DCMAKE_C_FLAGS_RELEASE=-O3 -DNDEBUG' '-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG' '-DCMAKE_C_FLAGS_MINSIZEREL=-Os -DNDEBUG' '-DCMAKE_C_ARCHIVE_FINISH=<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>' '-DCMAKE_C_COMPILER=/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc' '-DCMAKE_CXX_FLAGS=-fPIC -fembed-bitcode=off -stdlib=libc++ -fexceptions -frtti -pthread' '-DCMAKE_CXX_FLAGS_DEBUG=-g -O0' '-DCMAKE_CXX_FLAGS_RELEASE=-O3 -DNDEBUG' '-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG' '-DCMAKE_CXX_FLAGS_MINSIZEREL=-Os -DNDEBUG' '-DCMAKE_CXX_ARCHIVE_FINISH=<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>' '-DCMAKE_CXX_COMPILER=/Applications/Xcode_15.0.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++' '-DCMAKE_MACOSX_BUNDLE=OFF' '-DCMAKE_POLICY_DEFAULT_CMP0091=NEW' '-DCMAKE_BUILD_TYPE=RelWithDebInfo' '-DCMAKE_C_STANDARD=11' '-DCMAKE_C_STANDARD=11' '-DCMAKE_CXX_STANDARD=20' '-DCMAKE_POLICY_DEFAULT_CMP0075=NEW' '-DCMAKE_POSITION_INDEPENDENT_CODE=ON' '-DCMAKE_SYSROOT=/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk' '-DCMAKE_MODULE_PATH=/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/ios-arm64-appleclang/share/cmake-3.29/Modules;/Users/runner/work/cmake-toolset/cmake-toolset/modules;libwebsockets_DIR-NOTFOUND;/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/ios-arm64-appleclang/lib/cmake/grpc/modules' '-DCMAKE_PREFIX_PATH=/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/ios-arm64-appleclang' '-DCMAKE_FIND_ROOT_PATH=/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/ios-arm64-appleclang;/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk;/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk' '-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=TRUE' '-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY' '-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY' '-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY' '-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER' '-DCMAKE_FIND_FRAMEWORK=FIRST' '-DCMAKE_FIND_APPBUNDLE=FIRST' '-DCMAKE_SYSTEM_FRAMEWORK_PATH=~/Library/Frameworks;/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/Library/Frameworks;/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/Network/Library/Frameworks;/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks;/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks;/Applications/Xcode_15.0.1.app/Contents/Developer/Library/Frameworks;/Library/Frameworks;/Network/Library/Frameworks;/System/Library/Frameworks' '-DCMAKE_SYSTEM_APPBUNDLE_PATH=/Applications;/Applications/Xcode_15.0.1.app/Contents/Applications;/Applications/Xcode_15.0.1.app/Contents/Developer/Applications' '-DCMAKE_SYSTEM_LIBRARY_PATH=/usr/lib/X11' '-DCMAKE_SYSTEM_INCLUDE_PATH=/usr/include/X11' '-DCMAKE_SYSTEM_LIBRARY_PATH=/usr/lib/X11' '-DCMAKE_SYSTEM_PREFIX_PATH=/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/usr;/usr/local;/usr;/;/opt/homebrew/Cellar/cmake/3.29.2;/usr/local;/usr/X11R6;/usr/pkg;/opt;/sw;/opt/local' '-DCMAKE_POSITION_INDEPENDENT_CODE=ON' '-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON' '-Dprotobuf_MODULE_COMPATIBLE=ON' '-DBUILD_TESTING=OFF' '-DWITH_EXAMPLES=OFF' '-DWITH_EXAMPLES_HTTP=OFF' '-DOPENTELEMETRY_INSTALL=ON' '-DWITH_ASYNC_EXPORT_PREVIEW=ON' '-DZLIB_ROOT=/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/usr' '-DWITH_STL=OFF' '-DWITH_ABSEIL=ON' '-DWITH_METRICS_EXEMPLAR_PREVIEW=ON' '-DWITH_OTLP_HTTP_SSL_PREVIEW=ON' '-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON' '-DWITH_LOGS_PREVIEW=ON' '-DProtobuf_PROTOC_EXECUTABLE=/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/darwin-arm64-appleclang/bin/protoc' '-DPROTOBUF_PROTOC_EXECUTABLE=/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/darwin-arm64-appleclang/bin/protoc' '-DWITH_OTLP_GRPC=ON' '-DgRPC_CPP_PLUGIN_EXECUTABLE=/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/darwin-arm64-appleclang/bin/grpc_cpp_plugin' '-D_gRPC_PROTOBUF_PROTOC_EXECUTABLE=/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/darwin-arm64-appleclang/bin/protoc' '-DWITH_OTLP_HTTP=ON' '-DWITH_ETW=OFF' '-DWITH_ELASTICSEARCH=ON' '-DWITH_ZIPKIN=ON' '-DWITH_ZPAGES=OFF' '-DWITH_PROMETHEUS=ON' '-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=/Users/runner/work/cmake-toolset/cmake-toolset/test/third_party/install/ios-arm64-appleclang/include' '-DBUILD_SHARED_LIBS=OFF'

/opt/homebrew/Cellar/cmake/3.29.2/bin/cmake --build . -j

What is the expected behavior? Build success

What is the actual behavior?

[100%] Linking CXX executable func_otlp_http
ld: warning: ignoring duplicate libraries: '../../sdk/src/trace/libopentelemetry_trace.a'
ld: Undefined symbols:
  _CFRelease, referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a[8](time_zone_lookup.cc.o)
  _CFStringGetCString, referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a[8](time_zone_lookup.cc.o)
  _CFStringGetLength, referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a[8](time_zone_lookup.cc.o)
  _CFStringGetMaximumSizeForEncoding, referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a[8](time_zone_lookup.cc.o)
  _CFTimeZoneCopyDefault, referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a[8](time_zone_lookup.cc.o)
  _CFTimeZoneGetName, referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a[8](time_zone_lookup.cc.o)
  _res_9_getservers, referenced from:
      _ares__init_by_sysconfig in libcares.a[74](ares_sysconfig.c.o)
  _res_9_ndestroy, referenced from:
      _ares__init_by_sysconfig in libcares.a[74](ares_sysconfig.c.o)
  _res_9_ninit, referenced from:
      _ares__init_by_sysconfig in libcares.a[74](ares_sysconfig.c.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Additional context

https://github.com/owent/cmake-toolset/actions/runs/8848386990/job/24298116374?pr=111