Rust-libp2p link error on ios: undefined symbols _kSCNetworkInterfaceTypeIrDA

I try to use rust-libp2p in my project on ios as following:

libp2p = { version = "0.53.2", features = ["tcp"]}

then the following error appears:

ld: Undefined symbols:
                       _kSCNetworkInterfaceTypeIrDA, referenced from:
                           system_configuration::network_configuration::SCNetworkInterfaceType::from_cfstring::hc44a3e2b89f201b4 in librust_lib.a[arm64][123](system_configuration-48a9d13717661e26.system_configuration.e30cfccd1f6797a8-cgu.0.rcgu.o)
                     clang: error: linker command failed with exit code 1 (use -v to see invocation)

On android/macos/windows it’s ok.

I 'd like to know how could I resolve this issue
many thanks

Hi @johnvo,

That’s an interesting error message that suggests there’s a version mismatch somewhere. As in, the rust library is referencing _kSCNetworkInterfaceTypeIrDA and that symbol isn’t available anymore. It makes sense because I don’t think any new hardware has been created with an IrDA network interface for many years.

I did some digging. The problem is in the system_configuration crate and not libp2p proper. I just pulled the latest rust-libp2p and ran cargo tree --all-features and I’m not seeing that crate in the dependency tree at all. In fact if you look at the error, it suggests that librust_lib.a is the culprit. I would guess that you just need to update your rust toolchain by running rustup update. If that doesn’t work then it might be that the standard library has an out-of-date dependency.

Here’s a commit: Update bindings and move private Bridge and deprecated IrDA interface… that happened about a month ago the code related to the missing symbol.

If you’d like further help, you might want to consider asking technical questions like this in the rust-libp2p technical discussion forums on Github: https://github.com/libp2p/rust-libp2p/discussions

Cheers! :beers:

2 Likes

Thanks for your help very much, I am sure that my rust toolchain is the latest, but I will try to reinstall it.

Let me know if that fixed it. I’m curious because in my free time I’m working with rust-libp2p in iOS apps build with Swift. I’m using Mozilla’s UniFFI tool to generate the bindings. Here’s an example of a rust component that uses UniFFI to expose an API to Swift. This also shows how to use a build.rs file to generate the Swift bindings and some of the tricks you can do on the Rust side to have an async/multi-threaded Rust component callable from Swift. This doesn’t have any of the Swift code and it doesn’t use rust-libp2p directly but it wouldn’t be very hard to add it.

Cheers! :beers:

The problem is still in resolving, but inspired from you, I ran cargo tree --all-features with dependency libp2p = {version = "0.53.2", features = ["tcp"]} in cargo.toml, I found that libp2p-tcp depends on system-configuration v0.5.1, and I can reproduce the problem just depend on system-configuration v0.5.1 , while the latest system-configuration is ok

1 Like