BrainiumLLC / cargo-mobile

Rust on mobile made easy!
Apache License 2.0
1.24k stars 52 forks source link

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

Open davemackintosh opened 1 year ago

davemackintosh commented 1 year ago

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.

Cmdv commented 1 year ago

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

ld: library not found for -lnameofproj

If so I'm having the same issue 😞

davemackintosh commented 1 year ago

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?

Cmdv commented 1 year ago

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

davemackintosh commented 1 year ago

-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

Cmdv commented 1 year ago

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 :)