Swift fails to find some of the static methods in classes from an imported package

I've encountered an odd problem:

I have a swift package that wraps a C++ library.
It exposes 2 targets: one with the c++ types (and error "wrapping" layer in c++) and a Swift one that has corresponding classes (but still mostly uses C++ types from the library).

When I import it into an App (or into a package with an executable target) Swift sometimes doesn't see some of the methods.

When I try to use a static method on some type, I get Type 'SomeSwiftClass' has no member named 'someStaticMethod(_:)'., Or it will see a deprecated method with different parameter labels and give Incorrect argument label in call (have 'commonLabel:newLabel:', expected 'commonLabel:oldLabel:'). instead.

Xcode code completion sees those methods and suggests them, but both it and the swift run command show those errors.

Sometimes it can be fixed by calling some other method from that target before this line, or calling something from the C++ target... Or by importing a package depends on this package and accessing those methods through that instead. Though this same thing can happen to that other package as well.

Has anyone encountered something similar before, or know what might be causing this?