rust-libp2p icon indicating copy to clipboard operation
rust-libp2p copied to clipboard

link error on ios: undefined symbols _kSCNetworkInterfaceTypeIrDA

Open saintEvol opened this issue 1 year ago • 8 comments

Summary

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 when I try to run my app on ios or ios simulator:

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

Expected behavior

run on ios successfully

Actual behavior

link error appears as following:

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)

Relevant log output

No response

Possible Solution

No response

Version

No response

Would you like to work on fixing this bug ?

No

saintEvol avatar Feb 04 '24 03:02 saintEvol

Hmm the last time ive ran libp2p on ios I never seen this error, though it been awhile. Could you describe your building environment like the version of macos youre using, etc?

dariusc93 avatar Feb 04 '24 06:02 dariusc93

Hmm the last time ive ran libp2p on ios I never seen this error, though it been awhile. Could you describe your building environment like the version of macos youre using, etc?

thanks for your reply, the building environment is as following:

macos: sonoma 14.2.1 xcode: 15.2 the libp2p is used in a project created by flutter_rust_bridge_codegen create, as I know, in this case, rust is built by cargokit

saintEvol avatar Feb 04 '24 07:02 saintEvol

I'm facing the same problem.

santoshakil avatar Feb 06 '24 17:02 santoshakil

This is very likely an upstream bug of the system_configuration crate (see the stack trace). Can you reproduce the problem if you just depend on that one?

thomaseizinger avatar Feb 12 '24 01:02 thomaseizinger

This is very likely an upstream bug of the system_configuration crate (see the stack trace). Can you reproduce the problem if you just depend on that one?

i just tested with system-configuration = {version = "0.6.0"} and successful on ios, before that I have updated the rust toolchain to the latest. But when I try to use libp2p, the same problem still exist.

saintEvol avatar Feb 17 '24 10:02 saintEvol

This is very likely an upstream bug of the system_configuration crate (see the stack trace). Can you reproduce the problem if you just depend on that one?

i just tested with system-configuration = {version = "0.6.0"} and successful on ios, before that I have updated the rust toolchain to the latest. But when I try to use libp2p, the same problem still exist.

I just found that the libp2p-tcp v0.41.0 depends on if-watch 3.2.0 which depends onsystem-configuration v0.5.1 via command cargo tree --all-features and when I switch to that version, the problem is reproduced, so I guess that maybe the problem is that the libp2p-tcp depends on the improper version of system-configuration

saintEvol avatar Feb 17 '24 10:02 saintEvol

PRs for bumping dependencies are welcome: https://github.com/mxinden/if-watch/

thomaseizinger avatar Feb 19 '24 06:02 thomaseizinger

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

github-actions[bot] avatar Feb 26 '24 00:02 github-actions[bot]

This issue was closed because it is missing author input.

github-actions[bot] avatar Mar 05 '24 00:03 github-actions[bot]

Hello, the author of the if-watch crate which is the source of this issue is no longer maintaining said crate which means that this issue is still unresolved and rust-libp2p cannot compile for iOS. Are the maintainers of this library willing to migrate the if-watch dependency to a new fork to resolve this issue?

chanderlud avatar Jul 01 '24 18:07 chanderlud

I'm trying to solve it this way 1、download https://github.com/mxinden/if-watch 2、<flutterProject>/rust/Cargo.toml [path.crates-io] if-watch = {path = <localpath>} 3、if-watch/src/apple.rs remove system-configuration code 4、flutter_rust_bridge_codegen generate && flutter run -v (can see rust some error)

kucaca avatar Aug 21 '24 08:08 kucaca