Repository: rust
Issue: ".rlib: error adding symbols: File format not recognize" error on linux
Labels: A-linkage,O-linux

I'm unable to compile a rust program that compiles fine on macos.

```
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/usr/local/rustup/toolchains/1.29.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.15kq92zzbmxot4k9.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.16u6js6g0l3k1ic6.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.181cuta0v63atwcm.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.1c4sbqhvukbgthag.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.1im38lueib99jsk0.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.1kduva7sc7em934m.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.1mvmz58owquyropc.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.1vut2eft6nlujjxr.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.1y16o1qfye96o7m0.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.1zwd8n7bcl3vhvvh.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.23tqyymcb18u96mb.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.2imnh2vhxcqrizhm.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.2jqywn86b2gsqohu.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.2lyh15q6cjwzy18c.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.2qhkzqx5zqexj20y.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.3ayaeypdcro9d6yk.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.3py0d821mvt07s4n.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.3rngp6bm2u2q5z0y.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.3wta9ctgdrpkmlpr.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.44bsbddupzfao2om.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.48721dc4k5qxei0u.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.49a7n47po4ttqjl7.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.49lx1q7cxvpykyv0.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.4b8ptp1vn215jmoe.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.4ezmh1vbs95c5ack.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.4oc10dk278mpk1vy.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.4vp4wqj2v29i7mgy.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.4xq48u46a1pwiqn7.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.4ybye971cqflgun6.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.4yh8x2b62dcih00t.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.4ypvbwho0bu5tnww.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.56dly8q07ws8ucdq.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.57qy3vyd9bhiuaon.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.5gf6du7k58s78kob.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.8xzrsc1ux72v29j.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.98g0d9x8aw3akpe.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.9elsx31vb4it187.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.c6lbtaiefvx3wya.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.oa3rad818d8sgn4.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.spyjbt69vcsrx9q.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.y08g5q2x813c4wx.rcgu.o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.z9ox7biyn1otfln.rcgu.o" "-o" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba" "/usr/src/myapp/target/debug/deps/create_snapshot-60efbce147cacbba.crate.allocator.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/usr/src/myapp/target/debug/deps" "-L" "/usr/src/myapp/target/debug/build/libfly-2ef616123afaf643/out" "-L" "/usr/src/myapp/libfly/third_party/v8/out.gn/x64.release/obj" "-L" "/usr/src/myapp/target/debug/build/libsqlite3-sys-7ac6aaa28420bed7/out" "-L" "/usr/src/myapp/target/debug/build/backtrace-sys-dc873d7131d9513f/out" "-L" "/usr/local/rustup/toolchains/1.29.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/usr/src/myapp/target/debug/deps/liblibfly-973820a835f9f432.rlib" "/usr/src/myapp/target/debug/deps/liblibc-40d568469a8c2e87.rlib" "-Wl,--start-group" "/usr/local/rustup/toolchains/1.29.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-9318d1aa9575dbf9.rlib" "/usr/local/rustup/toolchains/1.29.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-e3cd3f44688b2d97.rlib" "/usr/local/rustup/toolchains/1.29.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-2f4890fbea3bd5e0.rlib" "/usr/local/rustup/toolchains/1.29.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-a0ddde720c2c46c5.rlib" "/usr/local/rustup/toolchains/1.29.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-9c41ffe739844496.rlib" "/usr/local/rustup/toolchains/1.29.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-af766b046896c123.rlib" "/usr/local/rustup/toolchains/1.29.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-00b776688b98de66.rlib" "/usr/local/rustup/toolchains/1.29.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-d05a4396ceff8bc8.rlib" "-Wl,--end-group" "/usr/local/rustup/toolchains/1.29.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-fe16a4dcdcd95bab.rlib" "-Wl,-Bdynamic" "-lstdc++" "-lutil" "-lutil" "-ldl" "-lrt" "-lpthread" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: /usr/src/myapp/target/debug/deps/liblibfly-973820a835f9f432.rlib: error adding symbols: File format not recognized
         collect2: error: ld returned 1 exit status
```

I tried this on debian stretch (using the official docker rust image) and ubuntu xenial (in a non-docker environment.) I tried both debug and release targets.

if I `nm` on that file, I get a lot of these "File format not recognize" next to the lib filenames.

I asked around on IRC and nobody could help.

The project can be found here: https://github.com/superfly/fly.rs (very much a work in progress)

It links to V8 statically, but I don't think that's the problem. I tried both pre-compiled V8 and compiling V8 in docker right before compiling the project with rust.

What can cause this?