facebookarchive/witd

Having trouble building on Linux x64

martinfobian opened this issue · 5 comments

I can't get it to build properly. I'm running Linux Mint 17 (64bit) and this is the output I get:

    Updating git repository `https://github.com/wit-ai/libwit.git`
    Updating git repository `https://github.com/chris-morgan/rust-http`
    Updating git repository `https://github.com/servo/rust-url.git`
    Updating git repository `https://github.com/lifthrasiir/rust-encoding`
    Updating git repository `https://github.com/carllerche/curl-rust.git`
    Updating git repository `https://github.com/sfackler/rust-openssl.git`
   Compiling openssl v0.0.0 (https://github.com/sfackler/rust-openssl.git#19eab0e7)
   Compiling encoding v0.1.0 (https://github.com/lifthrasiir/rust-encoding#ff55916f)
     Running `rustc src/encoding/lib.rs --crate-name encoding --crate-type lib -g -C metadata=4805bc5305f7cd87 -C extra-filename=-4805bc5305f7cd87 --out-dir /home/martin/witd/target/deps --dep-info /home/martin/witd/target/.fingerprint/encoding-4805bc5305f7cd87/dep-lib-encoding -L /home/martin/witd/target/deps -L /home/martin/witd/target/deps`
     Running make
     Running `rustc src/lib.rs --crate-name openssl --crate-type lib -g -C metadata=fbe75530f7eda428 -C extra-filename=-fbe75530f7eda428 --out-dir /home/martin/witd/target/deps --dep-info /home/martin/witd/target/.fingerprint/openssl-fbe75530f7eda428/dep-lib-openssl -L /home/martin/witd/target/deps -L /home/martin/witd/target/deps -L /home/martin/witd/target/native/openssl-fbe75530f7eda428`
   Compiling url v0.1.0 (https://github.com/servo/rust-url.git#55b18b79)
     Running `rustc /home/martin/.cargo/git/checkouts/rust-url-1e22af4233079a1e/master/src/lib.rs --crate-name url --crate-type lib -g -C metadata=921578b148f50e06 -C extra-filename=-921578b148f50e06 --out-dir /home/martin/witd/target/deps --dep-info /home/martin/witd/target/.fingerprint/url-921578b148f50e06/dep-lib-url -L /home/martin/witd/target/deps -L /home/martin/witd/target/deps --extern encoding=/home/martin/witd/target/deps/libencoding-4805bc5305f7cd87.rlib`
   Compiling curl v0.0.1 (https://github.com/carllerche/curl-rust.git#6d47499a)
   Compiling http v0.1.0-pre (https://github.com/chris-morgan/rust-http#5bcd379e)
     Running sh prebuild.sh
     Running `rustc /home/martin/.cargo/git/checkouts/curl-rust-d58c8d47d4f53e8e/master/src/lib.rs --crate-name curl --crate-type lib -g -C metadata=f26177e15fbe6dda -C extra-filename=-f26177e15fbe6dda --out-dir /home/martin/witd/target/deps --dep-info /home/martin/witd/target/.fingerprint/curl-f26177e15fbe6dda/dep-lib-curl -L /home/martin/witd/target/deps -L /home/martin/witd/target/deps --extern url=/home/martin/witd/target/deps/liburl-921578b148f50e06.rlib`
     Running `rustc src/http/lib.rs --crate-name http --crate-type lib -g -C metadata=b27c1e7938f5a5d0 -C extra-filename=-b27c1e7938f5a5d0 --out-dir /home/martin/witd/target/deps --dep-info /home/martin/witd/target/.fingerprint/http-b27c1e7938f5a5d0/dep-lib-http -L /home/martin/witd/target/deps -L /home/martin/witd/target/deps -L /home/martin/witd/target/native/http-b27c1e7938f5a5d0 -L /home/martin/witd/target/native/openssl-fbe75530f7eda428 --extern openssl=/home/martin/witd/target/deps/libopenssl-fbe75530f7eda428.rlib --extern url=/home/martin/witd/target/deps/liburl-921578b148f50e06.rlib`
   Compiling libwit v0.0.1 (https://github.com/wit-ai/libwit.git#b34a8930)
     Running ./gen_vad.sh
     Running `rustc src/lib.rs --crate-name wit --crate-type rlib -g -C metadata=bd3a077b4ae65447 -C extra-filename=-bd3a077b4ae65447 --out-dir /home/martin/witd/target/deps --dep-info /home/martin/witd/target/.fingerprint/libwit-bd3a077b4ae65447/dep-lib-wit -L /home/martin/witd/target/deps -L /home/martin/witd/target/deps -L /home/martin/witd/target/native/libwit-bd3a077b4ae65447 --extern curl=/home/martin/witd/target/deps/libcurl-f26177e15fbe6dda.rlib --extern url=/home/martin/witd/target/deps/liburl-921578b148f50e06.rlib`
   Compiling witd v0.0.1 (file:///home/martin/witd)
     Running `rustc /home/martin/witd/src/main.rs --crate-name witd --crate-type bin -g --out-dir /home/martin/witd/target --dep-info /home/martin/witd/target/.fingerprint/witd-ff1152dc345e8b25/dep-bin-witd -L /home/martin/witd/target -L /home/martin/witd/target/deps -L /home/martin/witd/target/native/http-b27c1e7938f5a5d0 -L /home/martin/witd/target/native/openssl-fbe75530f7eda428 -L /home/martin/witd/target/native/libwit-bd3a077b4ae65447 --extern http=/home/martin/witd/target/deps/libhttp-b27c1e7938f5a5d0.rlib --extern wit=/home/martin/witd/target/deps/libwit-bd3a077b4ae65447.rlib`
error: linking with `cc` failed: exit code: 1
note: cc '-m64' '-L' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-o' '/home/martin/witd/target/witd' '/home/martin/witd/target/witd.o' '-Wl,--whole-archive' '-lmorestack' '-Wl,--no-whole-archive' '-nodefaultlibs' '-fno-lto' '-Wl,--gc-sections' '-pie' '-Wl,--as-needed' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libnative-4e7c5e5c.rlib' '/home/martin/witd/target/deps/libhttp-b27c1e7938f5a5d0.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtime-4e7c5e5c.rlib' '/home/martin/witd/target/deps/libopenssl-fbe75530f7eda428.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libdebug-4e7c5e5c.rlib' '/home/martin/witd/target/deps/libwit-bd3a077b4ae65447.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-4e7c5e5c.rlib' '/home/martin/witd/target/deps/libcurl-f26177e15fbe6dda.rlib' '/home/martin/witd/target/deps/liburl-921578b148f50e06.rlib' '/home/martin/witd/target/deps/libencoding-4805bc5305f7cd87.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserialize-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblog-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libregex-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libsync-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustrt-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode-4e7c5e5c.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-4e7c5e5c.rlib' '-L' '/home/martin/witd/target' '-L' '/home/martin/witd/target/deps' '-L' '/home/martin/witd/target/native/http-b27c1e7938f5a5d0' '-L' '/home/martin/witd/target/native/openssl-fbe75530f7eda428' '-L' '/home/martin/witd/target/native/libwit-bd3a077b4ae65447' '-L' '/home/martin/witd/.rust' '-L' '/home/martin/witd' '-Wl,--whole-archive' '-Wl,-Bstatic' '-Wl,--no-whole-archive' '-Wl,-Bdynamic' '-lrt' '-lssl' '-lcrypto' '-lsox' '-lcurl' '-lcurl' '-lcurl' '-lcurl' '-ldl' '-lpthread' '-lgcc_s' '-lpthread' '-lc' '-lm' '-lcompiler-rt'
note: /usr/bin/ld: /home/martin/witd/target/deps/libwit-bd3a077b4ae65447.rlib(r-vad-vad.o): relocation R_X86_64_PC32 against undefined Symbol `malloc@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Ungültiger Wert
collect2: error: ld returned 1 exit status

error: aborting due to previous error
Could not compile `witd`.

Caused by:
  Process didn't exit successfully: `rustc /home/martin/witd/src/main.rs --crate-name witd --crate-type bin -g --out-dir /home/martin/witd/target --dep-info /home/martin/witd/target/.fingerprint/witd-ff1152dc345e8b25/dep-bin-witd -L /home/martin/witd/target -L /home/martin/witd/target/deps -L /home/martin/witd/target/native/http-b27c1e7938f5a5d0 -L /home/martin/witd/target/native/openssl-fbe75530f7eda428 -L /home/martin/witd/target/native/libwit-bd3a077b4ae65447 --extern http=/home/martin/witd/target/deps/libhttp-b27c1e7938f5a5d0.rlib --extern wit=/home/martin/witd/target/deps/libwit-bd3a077b4ae65447.rlib` (status=101)

Any hints as to what I'm doing wrong are greatly appreciated.

Thanks for the report!

I couldn't reproduce the issue, but I pushed a tentative fix to libwit. Can you try building witd again? (delete your Cargo.lock file to make sure you get the latest version of libwit).

Please let me know if it fixes your issue.

Thanks for the quick reply. I completely removed all files and cloned the repo again. Also removed all Cargo.lock files I could find and removed ~/.cargo. Unfortunately, still no luck. Same error message as before. I'd be happy to provide any more system info that might be helpful to fix this problem.

Thanks for the update - I'll try to test it on Linux Mint 17 64 bits and see if I get the same problem.

I was able to reproduce your issue. I'm not sure why the fPIC flag is not passed to gcc by default, but I updated libwit to use it. It fixed the problem for me - let me know if it works for you! (again, you'll need to remove your Cargo.lock and do a cargo clean)

It works fine now. Thanks for your help!