Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo build fails with undefined references to http-parser functions #1029

Closed
seankelly opened this issue Dec 11, 2014 · 6 comments
Closed

Comments

@seankelly
Copy link

When building Cargo on Fedora 20, the final link fails with undefined references to http-parser definitions. The error message (backslashes added by me to make it easier to read) is:

    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling cargo v0.1.0 (file:///home/sean/projects/rust/cargo)
error: linking with `cc` failed: exit code: 1
note: cc '-Wl,--as-needed' '-m64' \
    '-L' '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' \
    '-o' '/home/sean/projects/rust/cargo/target/cargo' \
    '/home/sean/projects/rust/cargo/target/cargo.o' \
    '-Wl,--whole-archive' \
    '-lmorestack' \
    '-Wl,--no-whole-archive' \
    '-Wl,--gc-sections' \
    '-pie' \
    '-nodefaultlibs' \
    '/home/sean/projects/rust/cargo/target/libcargo-cb1fe80cc919bbc3.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libglob-939306db26ee8d93.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-4e7c5e5c.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libregistry-94229f942c615984.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libsemver-dd25c811d0e0fb2d.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libtoml-b7ada17e70343ce1.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libgit2-09174fe7d724f48b.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libtime-8bde1abd230448f0.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libflate2-5a9d56138eb3bd6b.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libminiz-sys-a684ca24728e1bf9.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/liblibgit2-sys-ce6d220b35959092.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/liblibssh2-sys-cf42cea080951617.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libcurl-0df19872d4b5399f.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libcurl-sys-151b74147b7ca2dd.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libopenssl-sys-c112af8ef9100c9f.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/liblibz-sys-23b647d1eda82285.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libtar-36ff090b04fc02d0.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/liburl-b469e1d44ac2e587.rlib' \
    '/home/sean/projects/rust/cargo/target/deps/libdocopt-64adc584d5ef7fee.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserialize-4e7c5e5c.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblog-4e7c5e5c.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libregex-4e7c5e5c.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-4e7c5e5c.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustrt-4e7c5e5c.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-4e7c5e5c.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-4e7c5e5c.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-4e7c5e5c.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-4e7c5e5c.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunicode-4e7c5e5c.rlib' \
    '/home/sean/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-4e7c5e5c.rlib' \
    '-L' '/home/sean/projects/rust/cargo/target' \
    '-L' '/home/sean/projects/rust/cargo/target/deps' \
    '-L' '/usr/lib64' \
    '-L' '/home/sean/projects/rust/cargo/target/build/libgit2-sys-ce6d220b35959092/out/lib' \
    '-L' '/home/sean/projects/rust/cargo/target/build/libssh2-sys-cf42cea080951617/out/lib' \
    '-L' '/usr/lib64' \
    '-L' '/home/sean/projects/rust/cargo/target/build/miniz-sys-a684ca24728e1bf9/out' \
    '-L' '/usr/lib64' \
    '-L' '/home/sean/projects/rust/cargo/target/build/time-8bde1abd230448f0/out' \
    '-L' '/home/sean/projects/rust/cargo/.rust' \
    '-L' '/home/sean/projects/rust/cargo' \
    '-Wl,--whole-archive' \
    '-Wl,-Bstatic' \
    '-Wl,--no-whole-archive' \
    '-Wl,-Bdynamic' '-lrt' '-lcurl' '-lssl' '-lcrypto' '-lz' '-ldl' '-lpthread' '-lrt' '-lgcc_s' '-lpthread' '-lc' '-lm' '-lcompiler-rt'
note: /home/sean/projects/rust/cargo/target/deps/liblibgit2-sys-ce6d220b35959092.rlib(r-git2-http.c.o): In function `clear_parser_state':
/home/sean/.cargo/git/checkouts/git2-rs-cf258e7bcbaee34d/master/libgit2-sys/libgit2/src/transports/http.c:476: undefined reference to `http_parser_init'
/home/sean/projects/rust/cargo/target/deps/liblibgit2-sys-ce6d220b35959092.rlib(r-git2-http.c.o): In function `http_connect':
/home/sean/.cargo/git/checkouts/git2-rs-cf258e7bcbaee34d/master/libgit2-sys/libgit2/src/transports/http.c:534: undefined reference to `http_should_keep_alive'
/home/sean/projects/rust/cargo/target/deps/liblibgit2-sys-ce6d220b35959092.rlib(r-git2-http.c.o): In function `http_stream_read':
/home/sean/.cargo/git/checkouts/git2-rs-cf258e7bcbaee34d/master/libgit2-sys/libgit2/src/transports/http.c:695: undefined reference to `http_parser_execute'
/home/sean/.cargo/git/checkouts/git2-rs-cf258e7bcbaee34d/master/libgit2-sys/libgit2/src/transports/http.c:717: undefined reference to `http_errno_description'
/home/sean/projects/rust/cargo/target/deps/liblibgit2-sys-ce6d220b35959092.rlib(r-git2-netops.c.o): In function `gitno_extract_url_parts':
/home/sean/.cargo/git/checkouts/git2-rs-cf258e7bcbaee34d/master/libgit2-sys/libgit2/src/netops.c:695: undefined reference to `http_parser_parse_url'
collect2: error: ld returned 1 exit status

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

To learn more, run the command again with --verbose.

Rust version (built from source):
$ rustc --version
rustc 0.13.0-dev (6f4c11be3 2014-12-05 20:23:10 +0000)

@alexcrichton
Copy link
Member

I think this is because libgit2 depends on http-parser and it's detected it on your system but not passing through the -l flags generated by libgit2. If you uninstall http-parser does Cargo build successfully? If so, this is probably a bug for git2-rs

@seankelly
Copy link
Author

Yes it does build successfully after removing http-parser.

@alexcrichton
Copy link
Member

Ok, it definitely looks like this is a bug in git2-rs's build script (see #1032 as well)

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Dec 12, 2014
@alexcrichton
Copy link
Member

Could you try checking out https://github.com/alexcrichton/cargo/tree/update-git2 and seeing if it works for you? (with http-parser installed).

@seankelly
Copy link
Author

Yep, that builds with http-parser installed.

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Dec 18, 2014
@alexcrichton
Copy link
Member

This fix was merged, thanks @seankelly again for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants