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

Fail to link, can't find libhttp_parser #97

Closed
gentoo90 opened this issue Jan 26, 2016 · 5 comments
Closed

Fail to link, can't find libhttp_parser #97

gentoo90 opened this issue Jan 26, 2016 · 5 comments

Comments

@gentoo90
Copy link

On linux cargo test fails to link executable.
Seems like it fails to find libhttp_parser.so which is installed in the system.

/home/user/git2-rs/target/debug/deps/liblibgit2_sys-71b7810ef1368bc1.rlib(http.c.o): In function `clear_parser_state':
/home/user/git2-rs/libgit2-sys/libgit2/src/transports/http.c:494: undefined reference to `http_parser_init'
/home/user/git2-rs/target/debug/deps/liblibgit2_sys-71b7810ef1368bc1.rlib(http.c.o): In function `http_connect':
/home/user/git2-rs/libgit2-sys/libgit2/src/transports/http.c:553: undefined reference to `http_should_keep_alive'
/home/user/git2-rs/target/debug/deps/liblibgit2_sys-71b7810ef1368bc1.rlib(http.c.o): In function `http_stream_read':
/home/user/git2-rs/libgit2-sys/libgit2/src/transports/http.c:707: undefined reference to `http_parser_execute'
/home/user/git2-rs/libgit2-sys/libgit2/src/transports/http.c:733: undefined reference to `http_errno_description'
/home/user/git2-rs/target/debug/deps/liblibgit2_sys-71b7810ef1368bc1.rlib(netops.c.o): In function `gitno_extract_url_parts':
/home/user/git2-rs/libgit2-sys/libgit2/src/netops.c:239: undefined reference to `http_parser_parse_url'

target/debug/build/libgit2-sys-edeca217c76a8f82/output ends with

cargo:root=/home/user/git2-rs/target/debug/build/libgit2-sys-edeca217c76a8f82/out
cargo:rustc-link-lib=static=git2
cargo:rustc-link-search=native=/home/user/git2-rs/target/debug/build/libgit2-sys-edeca217c76a8f82/out/lib

When 4d2b771 is reverted, links to libraries appear in output

cargo:root=/home/user/git2-rs/target/debug/build/libgit2-sys-edeca217c76a8f82/out
cargo:rustc-link-search=native=/home/user/git2-rs/target/debug/build/libgit2-sys-edeca217c76a8f82/out/lib
cargo:rustc-link-search=native=/usr/lib64
cargo:rustc-link-lib=static=git2
cargo:rustc-link-lib=http_parser
cargo:rustc-link-lib=rt
cargo:rustc-link-lib=ssl
cargo:rustc-link-lib=dl
cargo:rustc-link-lib=z
cargo:rustc-link-lib=crypto
cargo:rustc-link-lib=dl
cargo:rustc-link-lib=z

and linkage is successful .

@alexcrichton
Copy link
Member

Aha I had a feeling that something like this would crop up...

This'll probably need to be fixed by scraping the build logs of libgit2 or perhaps scraping the generated pkg-config file to see how http_parser was linked.

Out of curiosity, do you know why libhttp_parser.so is installed locally? Do you know what other package required it?

@gentoo90
Copy link
Author

  net-libs/http-parser-2.3 pulled in by:
    dev-libs/libgit2-0.22.3 requires net-libs/http-parser
    dev-util/cargo-0.8.0 requires net-libs/http-parser
    net-libs/nodejs-0.12.6 requires >=net-libs/http-parser-2.3

(Gentoo linux)

@gentoo90
Copy link
Author

Thanks!
Also, this breaks cargo build (this is how I encountered it in the first place). So please update cargo's Cargo.lock to use libgit2-sys-0.3.10

@alexcrichton
Copy link
Member

Sure thing! Done in rust-lang/cargo#2323

@mati865
Copy link
Contributor

mati865 commented Mar 12, 2017

Just got this error on MSYS2 when compiling rust from git:

   Compiling git2 v0.6.4
   Compiling git2-curl v0.7.0
   Compiling cargo v0.16.0
   Compiling cargo-vendor v0.1.4
error: linking with `gcc` failed: exit code: 1
  |
  = note: "gcc" "-Wl,--enable-long-section-names" "-fno-use-linker-plugin" "-Wl,--nxcompat" "-nostdlib" "-m64" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\crt2.o" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsbegin.o" "-L" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\cargo_vendor-9db4e1e45391d56f.0.o" "-o" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\cargo_vendor-9db4e1e45391d56f.exe" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps" "-L" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\build\\curl-sys-500ff2f52156f2b8\\out/lib" "-L" "D:/msys64/mingw64/lib" "-L" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\build\\libgit2-sys-459b0bc6c3aba77d\\out/lib" "-L" "D:/msys64/mingw64/lib" "-L" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\build\\miniz-sys-18005000ddedadf4\\out" "-L" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libcargo-bc6720b650434245.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libgit2-ac546bf781b273c2.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libsemver-ab1d0471a7a2c4c9.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libtoml-94ea404b50476639.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libfs2-354bb9cceea716cd.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libnum_cpus-40879e9ed1a40827.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libterm-dd8c12034267c7dc.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libglob-448fa4fbc5ac9e4c.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libdocopt-5ef8f439428b13b0.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libflate2-8c506f1983161f68.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libminiz_sys-371886580b0e42eb.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libbitflags-65ddff5d2b91509e.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libtempdir-0ee757a585f719dd.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\librand-c9d9fbdab2355ee4.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libmiow-3157ab2122d298f6.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libnet2-e9a973f97d2466e5.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libcfg_if-5cf5b4dd25466da1.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libws2_32-8de76b4497f9878c.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libcrates_io-e5ebefcb8977e0c2.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libcurl-789a1279d7426ca6.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\liburl-aa3392667e4f87a3.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libidna-3bab7d99255950c3.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libunicode_normalization-0297b14f098a4d93.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libunicode_bidi-b21b1d9dc1833286.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libmatches-8f1598a59712d6cc.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libcrossbeam-520d8a01e7456c39.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libtar-be87a3bdd93a6d72.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libfiletime-f10baa873e2ea264.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libadvapi32-8ecb182711f78ac7.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\liblog-d4c0e5c2504fbbea.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\librustc_serialize-2c0b16b7ceb9fdcb.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libstrsim-026a04a7e1ede61c.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\liblibgit2_sys-17ba92f06c6b0ba0.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libcurl_sys-a7b0a528cc0d32ba.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\liblibssh2_sys-ae40328ec3b126cc.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\liblibz_sys-b34e05ee2e9e1468.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libsemver_parser-afbabce0532432ec.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\liblazy_static-82c2efae9a7bf732.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libregex-bf57a839db75dbae.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libutf8_ranges-142806e76d52d8c6.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libregex_syntax-8b74a2985735b213.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libthread_local-a561abce7ea185f1.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libthread_id-e41c347f28e6505f.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libkernel32-835ed4d4f4dc2d3e.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libaho_corasick-c795bbd3a96f4a35.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libmemchr-4c3682d5f0e14581.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\liblibc-5dc7b85e748840b4.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libpsapi-599a35e95de34b61.rlib" "D:\\msys64\\tmp\\cargo-install.HeqskRREZaIC\\debug\\deps\\libwinapi-a5898d7aceb63fac.rlib" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd-473a5c2322edc7f1.rlib" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libpanic_unwind-5c49714323255c7d.rlib" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libunwind-632ff56638b27a36.rlib" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liblibc-9af115acacc5cd52.rlib" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\librand-3a553aceef79992f.rlib" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcollections-785d704504d3d468.rlib" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc-70e3a8889cacc3a4.rlib" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\liballoc_system-563316f603659d05.rlib" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libstd_unicode-abd1ed1cfebdc307.rlib" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcore-5958b9a97272f755.rlib" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\libcompiler_builtins-020c2d6ba8355e1b.rlib" "-l" "advapi32" "-l" "ws2_32" "-l" "advapi32" "-l" "winhttp" "-l" "rpcrt4" "-l" "ole32" "-l" "crypt32" "-l" "ws2_32" "-l" "crypt32" "-l" "ssh2" "-l" "ws2_32" "-l" "z" "-l" "kernel32" "-l" "psapi" "-l" "advapi32" "-l" "ws2_32" "-l" "userenv" "-l" "shell32" "-l" "gcc_eh" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "D:\\projekty\\msys2\\rust\\MINGW-packages\\mingw-w64-rust\\src\\build-x86_64-w64-mingw32\\build\\x86_64-pc-windows-gnu\\stage0\\lib\\rustlib\\x86_64-pc-windows-gnu\\lib\\rsend.o"
  = note: D:\msys64\tmp\cargo-install.HeqskRREZaIC\debug\deps\liblibgit2_sys-17ba92f06c6b0ba0.rlib(netops.c.obj): In function `gitno_extract_url_parts':
          C:/Users/mati865/.cargo/registry/src/github.com-1ecc6299db9ec823/libgit2-sys-0.6.7/libgit2/src/netops.c:239: undefined reference to `http_parser_parse_url'
          collect2.exe: error: ld returned 1 exit status


error: aborting due to previous error

error: failed to compile `cargo-vendor v0.1.4`, intermediate artifacts can be found at `D:\msys64\tmp\cargo-install.HeqskRREZaIC`

Caused by:
  Could not compile `cargo-vendor`.

Both libgit2 and http-parser are installed but in different path than the fix checks: /mingw64/lib/pkgconfig/libgit2.pc

I'd like to use rustbuild for MSYS2 Rust packages starting with next version but it have to compile in environment with (almost) all packages installed .

EDIT: Apparently path is fine but function is returning too soon.

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

3 participants