Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visionOS app fails to build with latest Sentry version, previously succeeded #3809

Closed
sebj opened this issue Mar 31, 2024 · 9 comments · Fixed by #4462
Closed

visionOS app fails to build with latest Sentry version, previously succeeded #3809

sebj opened this issue Mar 31, 2024 · 9 comments · Fixed by #4462

Comments

@sebj
Copy link

sebj commented Mar 31, 2024

Platform

visionOS

Environment

Develop

Installed

Swift Package Manager

Version

8.22.4

Did it work on previous versions?

8.21.0

Steps to Reproduce

  1. Create a new VisionOS app project (Initial Scene: Window, Immersive Space Renderer: None for simplicity) in Xcode 15.3
  2. Add Sentry as a Swift Package Manager dependency
  3. Add only the first 'Sentry' product as a dependency for the app target
  4. Import Sentry and call SentrySDK.start { .. } (purely for testing purposes, I thew this into onAppear in ContentView in this fresh demo project)
  5. Build and run the app for the visionOS 1.1 simulator
  6. Observe the build fails

Expected Result

App builds and runs successfully on visionOS simulator

Actual Result

App fails to build and run on visionOS simulator.

Build errors:

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][158](SentryProfiler.o)
  "std::exception::what() const", referenced from:
      vtable for std::__1::bad_function_call in Sentry[arm64][141](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::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<char, std::__1::char_traits<char>, std::__1::allocator<char>>::resize(unsigned long, char)", referenced from:
      sentry::profiling::ThreadMetadataCache::metadataForThread(sentry::profiling::ThreadHandle const&) in Sentry[arm64][47](SentryThreadMetadataCache.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> 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<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const, std::__1::allocator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const>>::__construct_one_at_end[abi:v160006]<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const>(sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const&&) in Sentry[arm64][47](SentryThreadMetadataCache.o)
      void std::__1::vector<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const, std::__1::allocator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const>>::__push_back_slow_path<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const>(sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const&&) in Sentry[arm64][47](SentryThreadMetadataCache.o)
      std::__1::reverse_iterator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const*> std::__1::__uninitialized_allocator_move_if_noexcept[abi:v160006]<std::__1::allocator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const>, std::__1::reverse_iterator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const*>, std::__1::reverse_iterator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const*>, std::__1::reverse_iterator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const*>>(std::__1::allocator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const>&, std::__1::reverse_iterator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const*>, std::__1::reverse_iterator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const*>, std::__1::reverse_iterator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const*>) in Sentry[arm64][47](SentryThreadMetadataCache.o)
  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::operator=(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> 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<void (sentry::profiling::Backtrace const&)>, unsigned int) in Sentry[arm64][33](SentrySamplingProfiler.o)
      sentry::profiling::SamplingProfiler::~SamplingProfiler() in Sentry[arm64][33](SentrySamplingProfiler.o)
      std::__1::shared_ptr<sentry::profiling::ThreadMetadataCache>::~shared_ptr[abi:v160006]() in Sentry[arm64][33](SentrySamplingProfiler.o)
      -[SentryProfiler start] in Sentry[arm64][158](SentryProfiler.o)
      std::__1::shared_ptr<sentry::profiling::SamplingProfiler>::operator=[abi:v160006](std::__1::shared_ptr<sentry::profiling::SamplingProfiler>&&) in Sentry[arm64][158](SentryProfiler.o)
      void std::__1::shared_ptr<sentry::profiling::SamplingProfiler>::__enable_weak_this[abi:v160006]<sentry::profiling::SamplingProfiler, sentry::profiling::SamplingProfiler, void>(std::__1::enable_shared_from_this<sentry::profiling::SamplingProfiler> const*, sentry::profiling::SamplingProfiler*) in Sentry[arm64][158](SentryProfiler.o)
      void std::__1::shared_ptr<sentry::profiling::SamplingProfiler>::__enable_weak_this[abi:v160006]<sentry::profiling::SamplingProfiler, sentry::profiling::SamplingProfiler, void>(std::__1::enable_shared_from_this<sentry::profiling::SamplingProfiler> const*, sentry::profiling::SamplingProfiler*) in Sentry[arm64][158](SentryProfiler.o)
      ...
  "std::__1::__shared_weak_count::~__shared_weak_count()", referenced from:
      std::__1::__shared_ptr_emplace<sentry::profiling::ThreadMetadataCache, std::__1::allocator<sentry::profiling::ThreadMetadataCache>>::~__shared_ptr_emplace() in Sentry[arm64][33](SentrySamplingProfiler.o)
      std::__1::__shared_ptr_emplace<sentry::profiling::ThreadMetadataCache, std::__1::allocator<sentry::profiling::ThreadMetadataCache>>::~__shared_ptr_emplace() in Sentry[arm64][33](SentrySamplingProfiler.o)
      -[SentryProfiler start] in Sentry[arm64][158](SentryProfiler.o)
      std::__1::__shared_ptr_emplace<sentry::profiling::SamplingProfiler, std::__1::allocator<sentry::profiling::SamplingProfiler>>::~__shared_ptr_emplace() in Sentry[arm64][158](SentryProfiler.o)
      std::__1::__shared_ptr_emplace<sentry::profiling::SamplingProfiler, std::__1::allocator<sentry::profiling::SamplingProfiler>>::~__shared_ptr_emplace() in Sentry[arm64][158](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<void ()>) in Sentry[arm64][33](SentrySamplingProfiler.o)
      sentry::profiling::SamplingProfiler::isSampling() in Sentry[arm64][33](SentrySamplingProfiler.o)
      _trackProfilerForTracer in Sentry[arm64][156](SentryProfiledTracerConcurrency.o)
      _discardProfilerForTracer in Sentry[arm64][156](SentryProfiledTracerConcurrency.o)
      _profilerForFinishedTracer in Sentry[arm64][156](SentryProfiledTracerConcurrency.o)
      +[SentryProfiler startWithTracer:] in Sentry[arm64][158](SentryProfiler.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<void ()>) in Sentry[arm64][33](SentrySamplingProfiler.o)
      sentry::profiling::SamplingProfiler::startSampling(std::__1::function<void ()>) in Sentry[arm64][33](SentrySamplingProfiler.o)
      sentry::profiling::SamplingProfiler::isSampling() in Sentry[arm64][33](SentrySamplingProfiler.o)
      _trackProfilerForTracer in Sentry[arm64][156](SentryProfiledTracerConcurrency.o)
      _trackProfilerForTracer in Sentry[arm64][156](SentryProfiledTracerConcurrency.o)
      ...
  "std::__1::mutex::~mutex()", referenced from:
      sentry::profiling::SamplingProfiler::SamplingProfiler(std::__1::function<void (sentry::profiling::Backtrace const&)>, unsigned int) in Sentry[arm64][33](SentrySamplingProfiler.o)
      sentry::profiling::SamplingProfiler::~SamplingProfiler() in Sentry[arm64][33](SentrySamplingProfiler.o)
      __GLOBAL__sub_I_SentryProfiledTracerConcurrency.mm in Sentry[arm64][156](SentryProfiledTracerConcurrency.o)
      __GLOBAL__sub_I_SentryProfiler.mm in Sentry[arm64][158](SentryProfiler.o)
      -[SentryProfilerState .cxx_destruct] in Sentry[arm64][211](SentryProfilerState.o)
  "std::exception::~exception()", referenced from:
      std::__1::bad_function_call::~bad_function_call() in Sentry[arm64][141](SentryBacktrace.o)
      std::__1::bad_function_call::~bad_function_call() in Sentry[arm64][141](SentryBacktrace.o)
  "std::set_terminate(void (*)())", referenced from:
      setEnabled(bool) in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      setEnabled(bool) in Sentry[arm64][92](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<sentry::profiling::ThreadMetadataCache, std::__1::allocator<sentry::profiling::ThreadMetadataCache>> in Sentry[arm64][33](SentrySamplingProfiler.o)
      typeinfo for std::__1::__shared_ptr_emplace<sentry::profiling::SamplingProfiler, std::__1::allocator<sentry::profiling::SamplingProfiler>> in Sentry[arm64][158](SentryProfiler.o)
  "typeinfo for char*", referenced from:
      GCC_except_table5 in Sentry[arm64][92](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_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      typeinfo for std::__1::bad_function_call in Sentry[arm64][141](SentryBacktrace.o)
  "typeinfo for char", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for double", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for long double", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for float", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for unsigned char", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for int", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for unsigned int", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for long", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for unsigned long", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for short", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for unsigned short", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for long long", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "typeinfo for unsigned long long", referenced from:
      GCC_except_table5 in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "vtable for __cxxabiv1::__class_type_info", referenced from:
      typeinfo for std::__1::__function::__base<void (sentry::profiling::Backtrace const&)> in Sentry[arm64][158](SentryProfiler.o)
      typeinfo for -[SentryProfiler start]::$_0 in Sentry[arm64][158](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<sentry::profiling::ThreadMetadataCache, std::__1::allocator<sentry::profiling::ThreadMetadataCache>> in Sentry[arm64][33](SentrySamplingProfiler.o)
      typeinfo for std::__1::bad_function_call in Sentry[arm64][141](SentryBacktrace.o)
      typeinfo for std::__1::__shared_ptr_emplace<sentry::profiling::SamplingProfiler, std::__1::allocator<sentry::profiling::SamplingProfiler>> in Sentry[arm64][158](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][158](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<void ()>) in Sentry[arm64][33](SentrySamplingProfiler.o)
      sentry::profiling::SamplingProfiler::startSampling(std::__1::function<void ()>) in Sentry[arm64][33](SentrySamplingProfiler.o)
      sentry::profiling::(anonymous namespace)::deleteParams(void*) in Sentry[arm64][33](SentrySamplingProfiler.o)
      std::__1::__shared_ptr_emplace<sentry::profiling::ThreadMetadataCache, std::__1::allocator<sentry::profiling::ThreadMetadataCache>>::~__shared_ptr_emplace() in Sentry[arm64][33](SentrySamplingProfiler.o)
      std::__1::__shared_ptr_emplace<sentry::profiling::ThreadMetadataCache, std::__1::allocator<sentry::profiling::ThreadMetadataCache>>::__on_zero_shared_weak() in Sentry[arm64][33](SentrySamplingProfiler.o)
      std::__1::vector<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const, std::__1::allocator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const>>::__destroy_vector::operator()[abi:v160006]() in Sentry[arm64][33](SentrySamplingProfiler.o)
      ...
  "operator new(unsigned long)", referenced from:
      sentry::profiling::SamplingProfiler::SamplingProfiler(std::__1::function<void (sentry::profiling::Backtrace const&)>, unsigned int) in Sentry[arm64][33](SentrySamplingProfiler.o)
      sentry::profiling::SamplingProfiler::startSampling(std::__1::function<void ()>) in Sentry[arm64][33](SentrySamplingProfiler.o)
      std::__1::__allocation_result<std::__1::allocator_traits<std::__1::allocator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const>>::pointer> std::__1::__allocate_at_least[abi:v160006]<std::__1::allocator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const>>(std::__1::allocator<sentry::profiling::ThreadMetadataCache::ThreadHandleMetadataPair const>&, unsigned long) in Sentry[arm64][47](SentryThreadMetadataCache.o)
      std::__1::__allocation_result<std::__1::allocator_traits<std::__1::allocator<unsigned long>>::pointer> std::__1::__allocate_at_least[abi:v160006]<std::__1::allocator<unsigned long>>(std::__1::allocator<unsigned long>&, unsigned long) in Sentry[arm64][141](SentryBacktrace.o)
      -[SentryProfiler start] in Sentry[arm64][158](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][158](SentryProfiler.o)
      sentry::profiling::ThreadHandle::current() in Sentry[arm64][184](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][141](SentryBacktrace.o)
  "___cxa_begin_catch", referenced from:
      ___clang_call_terminate in Sentry[arm64][33](SentrySamplingProfiler.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      ...
  "___cxa_current_exception_type", referenced from:
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
  "___cxa_end_catch", referenced from:
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() in Sentry[arm64][92](SentryCrashMonitor_CPPException.o)
      CPPExceptionTerminate() (.cold.1) in Sentry[arm64][92](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][92](SentryCrashMonitor_CPPException.o)
  "___gxx_personality_v0", referenced from:
      /Users/seb/Library/Developer/Xcode/DerivedData/Test_Vision-gpfvgwnixlwldjbbhpzoagrflbyn/Build/Products/Debug-xrsimulator/Sentry.framework/Sentry[arm64][138](PrivateSentrySDKOnly.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Are you willing to submit a PR?

No response

@philipphofmann
Copy link
Member

@sebj, I can reproduce the problem. Using Sentry-Dynamic via SPM works, though. Maybe you can switch to that while we are working on a fix.

@fire-at-will
Copy link

I'm seeing the exact same error for my VisionOS builds 👀

@brustolin
Copy link
Contributor

brustolin commented Apr 3, 2024

I noticed that if you change SWIFT_OBJC_INTEROP_MODE to objcxx in the visionOS project, it works with Sentry static.
Its seems to me that Xcode is not linking with some c++ lib that it links by default for iOS projects, but I could not figure it out the root of the problem.

@armcknight can you give us a hand with this? You've work with C++ longer than us.

@armcknight armcknight self-assigned this Apr 3, 2024
@armcknight
Copy link
Member

I'm currently investigating this.

I was unable to reproduce the workaround mentioned by @philipphofmann , in my test app, of linking Sentry-Dynamic. @brustolin 's workaround did resolve the build errors, but that is not going to be a good solution unfortunately.

For the sake of comparison I created a test iOS app project with the same setup as the visionOS one, using SwiftUI, pulling in the Sentry SDK via SPM, validating that they have the same setting for SWIFT_OBJC_INTEROP_MODE, and the issue does not appear.

image image

Attached are the two projects I created to test.

iOS-SPM.zip
visionOS-SPM.zip

Digging in further, there are a few differences in the ld invocations between the projects, I'm not sure if this is relevant:

Ld /Users/andrewmcknight/Library/Developer/Xcode/DerivedD       |       Ld /Users/andrewmcknight/Library/Developer/Xcode/DerivedD
    cd /Users/andrewmcknight/Desktop/experiments/iOS-SPM	|           cd /Users/andrewmcknight/Desktop/experiments/visionOS
    /Applications/Xcode15.3/Xcode.app/Contents/Developer/       |           /Applications/Xcode15.3/Xcode.app/Contents/Developer/
-Xlinker							|       -Xlinker 
-reproducible							|       -reproducible 
-target								|       -target 
arm64-apple-ios17.4-simulator					|       arm64-apple-xros1.1 
-isysroot							|       -isysroot 
/Applications/Xcode15.3/Xcode.app/Contents/Developer/Plat       |       /Applications/Xcode15.3/Xcode.app/Contents/Developer/Plat
-O0								|       -O0 
-L/Users/andrewmcknight/Library/Developer/Xcode/DerivedDa       |       -L/Users/andrewmcknight/Library/Developer/Xcode/DerivedDa
-L/Users/andrewmcknight/Library/Developer/Xcode/DerivedDa       |       -L/Users/andrewmcknight/Library/Developer/Xcode/DerivedDa
-F/Users/andrewmcknight/Library/Developer/Xcode/DerivedDa       |       -F/Users/andrewmcknight/Library/Developer/Xcode/DerivedDa
-F/Users/andrewmcknight/Library/Developer/Xcode/DerivedDa       |       -F/Users/andrewmcknight/Library/Developer/Xcode/DerivedDa
-filelist							|       -F/Users/andrewmcknight/Library/Developer/Xcode/DerivedDa
/Users/andrewmcknight/Library/Developer/Xcode/DerivedData       |       -filelist 
-Xlinker							|       /Users/andrewmcknight/Library/Developer/Xcode/DerivedData
-rpath								|       -Xlinker 
-Xlinker							|       -rpath 
@executable_path/Frameworks					|       -Xlinker 
-dead_strip							|       /Users/andrewmcknight/Library/Developer/Xcode/DerivedData
-Xlinker							|       -Xlinker 
-object_path_lto						|       -rpath 
-Xlinker							|       -Xlinker 
/Users/andrewmcknight/Library/Developer/Xcode/DerivedData       |       @executable_path/Frameworks 
-Xlinker							|       -dead_strip 
-export_dynamic							|       -Xlinker 
-Xlinker							|       -object_path_lto 
-no_deduplicate							|       -Xlinker 
-Xlinker							|       /Users/andrewmcknight/Library/Developer/Xcode/DerivedData
-objc_abi_version						|       -Xlinker 
-Xlinker							|       -export_dynamic 
2								|       -Xlinker 
-fobjc-link-runtime						|       -no_deduplicate 
-L/Applications/Xcode15.3/Xcode.app/Contents/Developer/To       |       -fobjc-link-runtime 
-L/usr/lib/swift						|       -L/Applications/Xcode15.3/Xcode.app/Contents/Developer/To
-Xlinker							|       -L/usr/lib/swift 
-add_ast_path							|       -Xlinker 
-Xlinker							|       -add_ast_path 
/Users/andrewmcknight/Library/Developer/Xcode/DerivedData       |       -Xlinker 
-Xlinker							|       /Users/andrewmcknight/Library/Developer/Xcode/DerivedData
-sectcreate							|       -Wl,-no_warn_duplicate_libraries 
-Xlinker							|       -framework 
__TEXT								|       Sentry 
-Xlinker							|       -Xlinker 
__entitlements							|       -no_adhoc_codesign 
-Xlinker							|       -Xlinker 
/Users/andrewmcknight/Library/Developer/Xcode/DerivedData       |       -dependency_info 
-Xlinker							|       -Xlinker 
-sectcreate							|       /Users/andrewmcknight/Library/Developer/Xcode/DerivedData
-Xlinker							|       -o 
__TEXT								|       /Users/andrewmcknight/Library/Developer/Xcode/DerivedData
-Xlinker							|       -Xlinker 
__ents_der							|       -add_ast_path 
-Xlinker							|       -Xlinker 
/Users/andrewmcknight/Library/Developer/Xcode/DerivedData       |       /Users/andrewmcknight/Library/Developer/Xcode/DerivedData
-framework							<       
Sentry								<       
-Xlinker							<       
-no_adhoc_codesign						<       
-Xlinker							<       
-dependency_info						<       
-Xlinker							<       
/Users/andrewmcknight/Library/Developer/Xcode/DerivedData       <       
-o								<       
/Users/andrewmcknight/Library/Developer/Xcode/DerivedData       <       

Essentially, this is only in the iOS ld invocation:

-Xlinker
-objc_abi_version
-Xlinker
2
-Xlinker
-sectcreate
-Xlinker
__TEXT
-Xlinker
-sectcreate
-Xlinker
__TEXT
-Xlinker
__ents_der

and this is only in the visionOS one:

-Wl,no_warn_duplicate_libraries

Maybe we need to add something to the cxxSettings in our Package.swift, or tweak how we build the xcframework xrOS slice. Will need to dig into those further.

@NachoSoto
Copy link

I'm seeing the same thing. One thing I noticed is that the Package.swift doesn't declare compatibility with visionOS?

@vvbutko
Copy link

vvbutko commented Sep 10, 2024

Having the same issue when building visionOS app

@brustolin
Copy link
Contributor

Hello @vvbutko, have you tried using Sentry-Dynamic framework?

@vvbutko
Copy link

vvbutko commented Sep 10, 2024

@brustolin , yes, using Sentry-Dynamic resolves the issue.
Are there plans to fix this in the main framework or we should treat this as a permanent requirement for visionOS builds?

@brustolin
Copy link
Contributor

We do plan to fix it.
Unfortunately I dont have an ETA for it.

Btw, both frameworks are the same, one have static linking and the other one dynamic linking, so you're not loosing anything by using Sentry-Dynamic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Status: Done
Development

Successfully merging a pull request may close this issue.

8 participants