getsentry / sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
https://sentry.io/for/cocoa/
MIT License
797 stars 315 forks source link

First install in visionOS project fails build with error: Unexpected duplicate tasks #4275

Closed longda closed 5 days ago

longda commented 1 month ago

Platform

visionOS

Environment

Production

Installed

Swift Package Manager

Version

8.33.0

Xcode Version

15.4

Did it work on previous versions?

Unknown, first install

Steps to Reproduce

  1. Install sentry-cocoa package via SPM as outlined here: https://docs.sentry.io/platforms/apple/guides/visionos/#install
  2. After adding sentry-cocoa package, can no longer build with error: Unexpected duplicate tasks

Expected Result

After install of sentry-cocoa package project should build cleanly.

Actual Result

Three errors appear:

  1. Unexpected duplicate tasks
  2. Multiple commands produce ... (appears related to copy commands)
  3. Multiple commands produce ... (appears related to copy commands)

Screenshot (product + project names redacted):

Image

Did not see any related solutions at: https://docs.sentry.io/platforms/apple/guides/visionos/troubleshooting/

Are you willing to submit a PR?

No response

philipphofmann commented 4 weeks ago

I get a different error when adding sentry-cocoa via SPM to an empty visionOS project. We have to investigate this and fix it. Thanks for reporting this, @longda. Furthermore, I'm surprised that our CI isn't failing. We should add a check to avoid such issues in the future.

ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found
Undefined symbols for architecture arm64:
  "std::__1::__shared_weak_count::__get_deleter(std::type_info const&) const", referenced from:
      vtable for std::__1::__shared_ptr_emplace<sentry::profiling::ThreadMetadataCache, std::__1::allocator<sentry::profiling::ThreadMetadataCache>> in Sentry[arm64][33](SentrySamplingProfiler.o)
      vtable for std::__1::__shared_ptr_emplace<sentry::profiling::SamplingProfiler, std::__1::allocator<sentry::profiling::SamplingProfiler>> in Sentry[arm64][163](SentryProfiler.o)

...
Complete Xcode Build Output

``` ld: warning: Could not find or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not found Undefined symbols for architecture arm64: "std::__1::__shared_weak_count::__get_deleter(std::type_info const&) const", referenced from: vtable for std::__1::__shared_ptr_emplace> in Sentry[arm64][33](SentrySamplingProfiler.o) vtable for std::__1::__shared_ptr_emplace> in Sentry[arm64][163](SentryProfiler.o) "std::exception::what() const", referenced from: vtable for std::__1::bad_function_call in Sentry[arm64][146](SentryBacktrace.o) "std::logic_error::logic_error(char const*)", referenced from: std::length_error::length_error[abi:v160006](char const*) in Sentry[arm64][47](SentryThreadMetadataCache.o) "std::length_error::~length_error()", referenced from: std::__1::__throw_length_error[abi:v160006](char const*) in Sentry[arm64][47](SentryThreadMetadataCache.o) "std::exception_ptr::~exception_ptr()", referenced from: CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "std::bad_array_new_length::bad_array_new_length()", referenced from: std::__throw_bad_array_new_length[abi:v160006]() in Sentry[arm64][47](SentryThreadMetadataCache.o) "std::bad_array_new_length::~bad_array_new_length()", referenced from: std::__throw_bad_array_new_length[abi:v160006]() in Sentry[arm64][47](SentryThreadMetadataCache.o) "std::__1::basic_string, std::__1::allocator>::resize(unsigned long, char)", referenced from: sentry::profiling::ThreadMetadataCache::metadataForThread(sentry::profiling::ThreadHandle const&) in Sentry[arm64][47](SentryThreadMetadataCache.o) "std::__1::basic_string, std::__1::allocator>::basic_string(std::__1::basic_string, std::__1::allocator> const&)", referenced from: sentry::profiling::ThreadMetadataCache::metadataForThread(sentry::profiling::ThreadHandle const&) in Sentry[arm64][47](SentryThreadMetadataCache.o) sentry::profiling::ThreadMetadataCache::metadataForThread(sentry::profiling::ThreadHandle const&) in Sentry[arm64][47](SentryThreadMetadataCache.o) sentry::profiling::ThreadMetadataCache::metadataForThread(sentry::profiling::ThreadHandle const&) in Sentry[arm64][47](SentryThreadMetadataCache.o) void std::__1::vector>::__construct_one_at_end[abi:v160006](sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const&&) in Sentry[arm64][47](SentryThreadMetadataCache.o) void std::__1::vector>::__push_back_slow_path(sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const&&) in Sentry[arm64][47](SentryThreadMetadataCache.o) std::__1::reverse_iterator std::__1::__uninitialized_allocator_move_if_noexcept[abi:v160006], std::__1::reverse_iterator, std::__1::reverse_iterator, std::__1::reverse_iterator>(std::__1::allocator&, std::__1::reverse_iterator, std::__1::reverse_iterator, std::__1::reverse_iterator) in Sentry[arm64][47](SentryThreadMetadataCache.o) std::__1::__function::__func<-[SentryProfiler start]::$_0, std::__1::allocator<-[SentryProfiler start]::$_0>, void (sentry::profiling::Backtrace const&)>::operator()(sentry::profiling::Backtrace const&) in Sentry[arm64][163](SentryProfiler.o) ... "std::__1::basic_string, std::__1::allocator>::operator=(std::__1::basic_string, std::__1::allocator> const&)", referenced from: sentry::profiling::ThreadMetadataCache::metadataForThread(sentry::profiling::ThreadHandle const&) in Sentry[arm64][47](SentryThreadMetadataCache.o) "std::__1::__shared_weak_count::__release_weak()", referenced from: sentry::profiling::SamplingProfiler::SamplingProfiler(std::__1::function, unsigned int) in Sentry[arm64][33](SentrySamplingProfiler.o) sentry::profiling::SamplingProfiler::~SamplingProfiler() in Sentry[arm64][33](SentrySamplingProfiler.o) std::__1::shared_ptr::~shared_ptr[abi:v160006]() in Sentry[arm64][33](SentrySamplingProfiler.o) -[SentryProfiler start] in Sentry[arm64][163](SentryProfiler.o) std::__1::shared_ptr::operator=[abi:v160006](std::__1::shared_ptr&&) in Sentry[arm64][163](SentryProfiler.o) void std::__1::shared_ptr::__enable_weak_this[abi:v160006](std::__1::enable_shared_from_this const*, sentry::profiling::SamplingProfiler*) in Sentry[arm64][163](SentryProfiler.o) void std::__1::shared_ptr::__enable_weak_this[abi:v160006](std::__1::enable_shared_from_this const*, sentry::profiling::SamplingProfiler*) in Sentry[arm64][163](SentryProfiler.o) ... "std::__1::__shared_weak_count::~__shared_weak_count()", referenced from: std::__1::__shared_ptr_emplace>::~__shared_ptr_emplace() in Sentry[arm64][33](SentrySamplingProfiler.o) std::__1::__shared_ptr_emplace>::~__shared_ptr_emplace() in Sentry[arm64][33](SentrySamplingProfiler.o) -[SentryProfiler start] in Sentry[arm64][163](SentryProfiler.o) std::__1::__shared_ptr_emplace>::~__shared_ptr_emplace() in Sentry[arm64][163](SentryProfiler.o) std::__1::__shared_ptr_emplace>::~__shared_ptr_emplace() in Sentry[arm64][163](SentryProfiler.o) "std::__1::mutex::lock()", referenced from: sentry::profiling::SamplingProfiler::stopSampling() in Sentry[arm64][33](SentrySamplingProfiler.o) sentry::profiling::SamplingProfiler::startSampling(std::__1::function) in Sentry[arm64][33](SentrySamplingProfiler.o) sentry::profiling::SamplingProfiler::isSampling() in Sentry[arm64][33](SentrySamplingProfiler.o) +[SentryTraceProfiler startWithTracer:] in Sentry[arm64][97](SentryTraceProfiler.o) +[SentryTraceProfiler isCurrentlyProfiling] in Sentry[arm64][97](SentryTraceProfiler.o) +[SentryTraceProfiler recordMetrics] in Sentry[arm64][97](SentryTraceProfiler.o) ___43+[SentryTraceProfiler scheduleTimeoutTimer]_block_invoke in Sentry[arm64][97](SentryTraceProfiler.o) ... "std::__1::mutex::unlock()", referenced from: sentry::profiling::SamplingProfiler::stopSampling() in Sentry[arm64][33](SentrySamplingProfiler.o) sentry::profiling::SamplingProfiler::stopSampling() in Sentry[arm64][33](SentrySamplingProfiler.o) sentry::profiling::SamplingProfiler::startSampling(std::__1::function) in Sentry[arm64][33](SentrySamplingProfiler.o) sentry::profiling::SamplingProfiler::startSampling(std::__1::function) in Sentry[arm64][33](SentrySamplingProfiler.o) sentry::profiling::SamplingProfiler::isSampling() in Sentry[arm64][33](SentrySamplingProfiler.o) +[SentryTraceProfiler startWithTracer:] in Sentry[arm64][97](SentryTraceProfiler.o) +[SentryTraceProfiler startWithTracer:] in Sentry[arm64][97](SentryTraceProfiler.o) +[SentryTraceProfiler startWithTracer:] in Sentry[arm64][97](SentryTraceProfiler.o) ... "std::__1::mutex::~mutex()", referenced from: sentry::profiling::SamplingProfiler::SamplingProfiler(std::__1::function, unsigned int) in Sentry[arm64][33](SentrySamplingProfiler.o) sentry::profiling::SamplingProfiler::~SamplingProfiler() in Sentry[arm64][33](SentrySamplingProfiler.o) __GLOBAL__sub_I_SentryTraceProfiler.mm in Sentry[arm64][97](SentryTraceProfiler.o) __GLOBAL__sub_I_SentryContinuousProfiler.mm in Sentry[arm64][112](SentryContinuousProfiler.o) __GLOBAL__sub_I_SentryProfiledTracerConcurrency.mm in Sentry[arm64][161](SentryProfiledTracerConcurrency.o) -[SentryProfilerState .cxx_destruct] in Sentry[arm64][214](SentryProfilerState.o) "std::exception::~exception()", referenced from: std::__1::bad_function_call::~bad_function_call() in Sentry[arm64][146](SentryBacktrace.o) std::__1::bad_function_call::~bad_function_call() in Sentry[arm64][146](SentryBacktrace.o) "std::set_terminate(void (*)())", referenced from: setEnabled(bool) in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) setEnabled(bool) in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "std::current_exception()", referenced from: CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "std::terminate()", referenced from: ___clang_call_terminate in Sentry[arm64][33](SentrySamplingProfiler.o) "typeinfo for std::__1::__shared_weak_count", referenced from: typeinfo for std::__1::__shared_ptr_emplace> in Sentry[arm64][33](SentrySamplingProfiler.o) typeinfo for std::__1::__shared_ptr_emplace> in Sentry[arm64][163](SentryProfiler.o) "typeinfo for char*", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for std::length_error", referenced from: std::__1::__throw_length_error[abi:v160006](char const*) in Sentry[arm64][47](SentryThreadMetadataCache.o) "typeinfo for std::bad_array_new_length", referenced from: std::__throw_bad_array_new_length[abi:v160006]() in Sentry[arm64][47](SentryThreadMetadataCache.o) "typeinfo for std::exception", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) typeinfo for std::__1::bad_function_call in Sentry[arm64][146](SentryBacktrace.o) "typeinfo for char", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for double", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for long double", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for float", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for unsigned char", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for int", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for unsigned int", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for long", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for unsigned long", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for short", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for unsigned short", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for long long", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "typeinfo for unsigned long long", referenced from: GCC_except_table7 in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "vtable for __cxxabiv1::__class_type_info", referenced from: typeinfo for std::__1::__function::__base in Sentry[arm64][163](SentryProfiler.o) typeinfo for -[SentryProfiler start]::$_0 in Sentry[arm64][163](SentryProfiler.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for __cxxabiv1::__si_class_type_info", referenced from: typeinfo for std::__1::__shared_ptr_emplace> in Sentry[arm64][33](SentrySamplingProfiler.o) typeinfo for std::__1::bad_function_call in Sentry[arm64][146](SentryBacktrace.o) typeinfo for std::__1::__shared_ptr_emplace> in Sentry[arm64][163](SentryProfiler.o) typeinfo for std::__1::__function::__func<-[SentryProfiler start]::$_0, std::__1::allocator<-[SentryProfiler start]::$_0>, void (sentry::profiling::Backtrace const&)> in Sentry[arm64][163](SentryProfiler.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "vtable for std::length_error", referenced from: std::length_error::length_error[abi:v160006](char const*) in Sentry[arm64][47](SentryThreadMetadataCache.o) NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. "operator delete(void*)", referenced from: -[SentryTransactionContext getThreadInfo] in Sentry[arm64][30](SentryTransactionContext.o) sentry::profiling::SamplingProfiler::startSampling(std::__1::function) in Sentry[arm64][33](SentrySamplingProfiler.o) sentry::profiling::SamplingProfiler::startSampling(std::__1::function) in Sentry[arm64][33](SentrySamplingProfiler.o) sentry::profiling::(anonymous namespace)::deleteParams(void*) in Sentry[arm64][33](SentrySamplingProfiler.o) std::__1::__shared_ptr_emplace>::~__shared_ptr_emplace() in Sentry[arm64][33](SentrySamplingProfiler.o) std::__1::__shared_ptr_emplace>::__on_zero_shared_weak() in Sentry[arm64][33](SentrySamplingProfiler.o) std::__1::vector>::__destroy_vector::operator()[abi:v160006]() in Sentry[arm64][33](SentrySamplingProfiler.o) ... "operator new(unsigned long)", referenced from: sentry::profiling::SamplingProfiler::SamplingProfiler(std::__1::function, unsigned int) in Sentry[arm64][33](SentrySamplingProfiler.o) sentry::profiling::SamplingProfiler::startSampling(std::__1::function) in Sentry[arm64][33](SentrySamplingProfiler.o) std::__1::__allocation_result>::pointer> std::__1::__allocate_at_least[abi:v160006]>(std::__1::allocator&, unsigned long) in Sentry[arm64][47](SentryThreadMetadataCache.o) std::__1::__allocation_result>::pointer> std::__1::__allocate_at_least[abi:v160006]>(std::__1::allocator&, unsigned long) in Sentry[arm64][146](SentryBacktrace.o) -[SentryProfiler start] in Sentry[arm64][163](SentryProfiler.o) std::__1::__function::__func<-[SentryProfiler start]::$_0, std::__1::allocator<-[SentryProfiler start]::$_0>, void (sentry::profiling::Backtrace const&)>::__clone() const in Sentry[arm64][163](SentryProfiler.o) sentry::profiling::ThreadHandle::current() in Sentry[arm64][188](SentryThreadHandle.o) ... "___cxa_allocate_exception", referenced from: std::__1::__throw_length_error[abi:v160006](char const*) in Sentry[arm64][47](SentryThreadMetadataCache.o) std::__throw_bad_array_new_length[abi:v160006]() in Sentry[arm64][47](SentryThreadMetadataCache.o) std::__1::__throw_bad_function_call[abi:v160006]() in Sentry[arm64][146](SentryBacktrace.o) "___cxa_begin_catch", referenced from: ___clang_call_terminate in Sentry[arm64][33](SentrySamplingProfiler.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) ... "___cxa_current_exception_type", referenced from: CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "___cxa_end_catch", referenced from: CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "___cxa_free_exception", referenced from: std::__1::__throw_length_error[abi:v160006](char const*) in Sentry[arm64][47](SentryThreadMetadataCache.o) "___cxa_rethrow", referenced from: CPPExceptionTerminate() in Sentry[arm64][94](SentryCrashMonitor_CPPException.o) "___gxx_personality_v0", referenced from: /Users/philipp.hofmann/Library/Developer/Xcode/DerivedData/VisionOSSPM-chhkchblzgncmqbvmhzilukspizr/Build/Products/Debug-xrsimulator/Sentry.framework/Sentry[arm64][163](SentryProfiler.o) ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ```

HaibinWangAe commented 6 days ago

Observed the same error while building for iOS.

Turns out you cannot use Sentry and Sentry-Dynamic at the same time. Sentry and Sentry-SwiftUI works fine. Document should be updated of the SPM changes.

brustolin commented 6 days ago

Turns out you cannot use Sentry and Sentry-Dynamic at the same time

You're right, those are the same libraries, but different linking types (static and dynamic).

We will revisit the docs.

Thanks for pointing this out.

brustolin commented 6 days ago

@longda can you confirm that this is also your problem?

longda commented 6 days ago

@brustolin Yes, that was the issue! Only Sentry-Dynamic worked for me on VisionOS but it does work! Thank you! 🙏

brustolin commented 5 days ago

@longda Thanks for the reply.