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

Missing symbols when an SPM target has no sources #6164

Open
NachoSoto opened this issue Apr 9, 2024 · 3 comments
Open

Missing symbols when an SPM target has no sources #6164

NachoSoto opened this issue Apr 9, 2024 · 3 comments
Labels
type:bug Something isn't working

Comments

@NachoSoto
Copy link

What happened?

https://github.com/Datadog/dd-sdk-ios makes Tuist break when using this dependency.

How do we reproduce it?

Create a project with this dependency:

Package.swift

let package = Package(
  name: "Package",
  platforms: [
    .iOS(.v16)
  ],
  products: [
   ...
  ],
  dependencies: [
    .package(
      url: "https://github.com/Datadog/dd-sdk-ios.git",
      from: "2.5.0"),
  ],
  targets: [
    .target(
      name: "Target",
      dependencies: [
        .product(
          name: "DatadogCore",
          package: "dd-sdk-ios",
          condition: .when(platforms: [.iOS, .macCatalyst])),
        .product(
          name: "DatadogLogs",
          package: "dd-sdk-ios",
          condition: .when(platforms: [.iOS, .macCatalyst])),
        .product(
          name: "DatadogTrace",
          package: "dd-sdk-ios",
          condition: .when(platforms: [.iOS, .macCatalyst])),
        .product(
          name: "DatadogRUM",
          package: "dd-sdk-ios",
          condition: .when(platforms: [.iOS, .macCatalyst])),
      ]
    )
  ]
)

Run tuist install && tuist generate

Error log

Undefined symbol: std::__1::__shared_weak_count::__get_deleter(std::type_info const&) const
Undefined symbol: std::exception::what() const
Undefined symbol: std::logic_error::logic_error(char const*)
Undefined symbol: std::length_error::~length_error()
Undefined symbol: std::bad_array_new_length::bad_array_new_length()
Undefined symbol: std::bad_array_new_length::~bad_array_new_length()
Undefined symbol: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>::resize(unsigned long, char)
Undefined symbol: 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&)
Undefined symbol: 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&)
Undefined symbol: std::__1::__shared_weak_count::__release_weak()
Undefined symbol: std::__1::__shared_weak_count::~__shared_weak_count()
Undefined symbol: std::__1::mutex::lock()
Undefined symbol: std::__1::mutex::unlock()
Undefined symbol: std::__1::mutex::~mutex()
Undefined symbol: std::exception::~exception()
Undefined symbol: std::set_terminate(void (*)())
Undefined symbol: std::terminate()
Undefined symbol: typeinfo for std::__1::__shared_weak_count
Undefined symbol: typeinfo for char*
Undefined symbol: typeinfo for std::length_error
Undefined symbol: typeinfo for std::bad_array_new_length
Undefined symbol: typeinfo for std::exception
Undefined symbol: typeinfo for char
Undefined symbol: typeinfo for double
Undefined symbol: typeinfo for long double
Undefined symbol: typeinfo for float
Undefined symbol: typeinfo for unsigned char
Undefined symbol: typeinfo for int
Undefined symbol: typeinfo for unsigned int
Undefined symbol: __swift_FORCE_LOAD_$_swiftCompatibility56
Undefined symbol: __swift_FORCE_LOAD_$_swiftCompatibilityConcurrency
Linker command failed with exit code 1 (use -v to see invocation)

macOS version

14.4.1

Tuist version

4.9.0

Xcode version

15.2.0

@NachoSoto NachoSoto added the type:bug Something isn't working label Apr 9, 2024
@NachoSoto
Copy link
Author

Is there an easy way at least to modify compilation flags when creating the project for these targets?

@fortmarek
Copy link
Member

You can update the target settings, and thus also compiler flags, using the targetSettings from PackageSettings.

Would you mind adding a zip with a reproducible project? 🙏

@fortmarek fortmarek changed the title Link failures depending on Datadog MIssing symbols when an SPM target has no sources Apr 22, 2024
@fortmarek
Copy link
Member

tuist-bug-repro (2).zip

@NachoSoto provided us with the above sample. The issue is because of LibraryTarget that has no sources. If sources are added to the target, the symbol issues are resolved. It's likely we're doing some configuration only if a file has sources – further investigation is needed.

@NachoSoto NachoSoto changed the title MIssing symbols when an SPM target has no sources Missing symbols when an SPM target has no sources Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants