Sounds like very annoying sort of issue... Have you tried patching this via a script or manually for the start?
ar x libtreble.a ar c libtreble.a *.o Also, the good question to ask how those non-traditional files in a static library archive are use... I would assume that compilers other then rustc would not be able to make any use of it whatsoever. — Ilya Dmitrichenko On 7 October 2014 21:03, Tahia Khan <[email protected]> wrote: > Hey all! Rust newbie here. I'm having some problems including a static Rust > library inside of an Objective-C project on XCode. > > I was looking through rustc source code (specifically /back/link.rs) and I > saw that rlibs and staticlibs are built very similarly (in fact link_rlib is > called inside of link_staticlib). According to the comments above the > link_rlib function in link.rs, non-object "magical files" are tacked onto > the end of archive files for rlibs/staticlibs. I inspected my staticlib with > otool and confirmed that there are a bunch of non-object files at the end: > > libtreble.a(r-std-std-4e7c5e5c.0.bytecode.deflate): is not an object file > libtreble.a(r-rand-rand-4e7c5e5c.0.bytecode.deflate): is not an object file > libtreble.a(r-sync-sync-4e7c5e5c.0.bytecode.deflate): is not an object file > libtreble.a(r-rustrt-rustrt-4e7c5e5c.0.bytecode.deflate): is not an object > file > libtreble.a(r-collections-collections-4e7c5e5c.0.bytecode.deflate): is not > an object file > libtreble.a(r-alloc-alloc-4e7c5e5c.0.bytecode.deflate): is not an object > file > libtreble.a(r-libc-libc-4e7c5e5c.0.bytecode.deflate): is not an object file > libtreble.a(r-unicode-unicode-4e7c5e5c.0.bytecode.deflate): is not an object > file > libtreble.a(r-core-core-4e7c5e5c.0.bytecode.deflate): is not an object file > > When I try to build my Xcode project, my build fails with the following > error: > > ld: in > [path-to-library]/rust-from-c/libtreble.a(r-std-std-4e7c5e5c.0.bytecode.deflate), > archive member 'r-std-std-4e7c5e5c.0.bytecode.deflate' with length 999896 is > not mach-o or llvm bitcode for architecture x86_64 > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > It looks like the Xcode linker hits the very first non-object file then > isn't able to determine the architecture of the archive. Does anyone know if > there's some way to exclude these non-object files in a staticlib/rlib? Or > if there's some other way to avoid this build issue with the XCode linker? > > Cheers, > Tahia > > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev > _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
