cargo-mobile icon indicating copy to clipboard operation
cargo-mobile copied to clipboard

iOS doesn't seem to copy over the dylib properly?

Open davemackintosh opened this issue 3 years ago • 5 comments

I've tried each example but I always seem to get the same error on running.

I get "Library not loaded .dylib`

I can see that the libname.a and libname.dyld are built and where they should be but when I cargo apple open the libname.a file is red in the file explorer and running errors about the library not being loaded.

I've manually added both to the project and tried to re-run and get the same no matter what I try.

On a side note, the template appears to be wrong as well. Defaulting to a deployment target of iOS 9 which also needs changing.

davemackintosh avatar Jan 05 '23 14:01 davemackintosh

@davemackintosh do you get an error in the lines of:

ld: library not found for -lnameofproj

If so I'm having the same issue 😞

Cmdv avatar Jan 18 '23 20:01 Cmdv

The particular error I was getting escapes me but it was an error todo with the lib that cargo builds not being where the Xcode project expects it to be. Yours sounds like a linker error which is likely a missing package on your system?

davemackintosh avatar Jan 18 '23 20:01 davemackintosh

the package that's missing is the name of the project prefixed with -l 🤷 not a clue what that means tbh I can see things named libXXX but nothing else

Cmdv avatar Jan 19 '23 17:01 Cmdv

-l is a linker argument which combines symbols from multiple output files into one binary file. Sounds like your build is failing whereas my build appears to work but the actual library built isn’t where Xcode is told it is

davemackintosh avatar Jan 19 '23 18:01 davemackintosh

ah ok just that my libname.a file is also red in the file explorer in Xcode and I don't get any other build errors prior to this. I've also opened an issue related to my scenario in a fork of this project that seems to be more active :)

Cmdv avatar Jan 19 '23 19:01 Cmdv