Skip to content

undefined reference to `git_branch_name_is_valid' #853

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

Closed
leecannon opened this issue Aug 17, 2021 · 12 comments · Fixed by #898
Closed

undefined reference to `git_branch_name_is_valid' #853

leecannon opened this issue Aug 17, 2021 · 12 comments · Fixed by #898
Milestone

Comments

@leecannon
Copy link

Describe the bug
After commit d42b003 (found by git bisect) compilation fails with the error:

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/home/lee/src/gitui/target/release/deps/gitui-949dd8264f23690b.gitui.f8472fbe-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/home/lee/src/gitui/target/release/deps" "-L" "/usr/lib" "-L" "/home/lee/src/gitui/target/release/build/libssh2-sys-0a8acf086ff3fcc8/out/build" "-L" "/home/lee/src/gitui/target/release/build/openssl-sys-5066e3da5d8b1711/out/openssl-build/install/lib" "-L" "/home/lee/src/gitui/target/release/build/sys-info-0e15c68dea07eaab/out" "-L" "/home/lee/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/rustcDHIJrs/libsys_info-9829c21529521aca.rlib" "/tmp/rustcDHIJrs/liblibssh2_sys-839056c310076187.rlib" "/tmp/rustcDHIJrs/libopenssl_sys-62ae95b1ef6c5efb.rlib" "-Wl,--start-group" "-Wl,--end-group" "/home/lee/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-96219fb718f2f3e8.rlib" "-Wl,-Bdynamic" "-lgit2" "-lz" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/lee/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/lee/src/gitui/target/release/deps/gitui-949dd8264f23690b" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs"
  = note: /usr/bin/ld: /home/lee/src/gitui/target/release/deps/gitui-949dd8264f23690b.gitui.f8472fbe-cgu.0.rcgu.o: in function `gitui::app::App::draw_popups':
          gitui.f8472fbe-cgu.0:(.text._ZN5gitui3app3App11draw_popups17h582edd87cb015eb4E+0x3692): undefined reference to `git_branch_name_is_valid'
          collect2: error: ld returned 1 exit status

  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile `gitui` due to previous error

Context (please complete the following information):

  • OS/Distro + Version: Arch
  • GitUI Version: master
  • Rust version: 1.56.0-nightly (0035d9dce 2021-08-16)
  • libgit2 version: 1.1.1
  • gcc version: 11.1.0
@extrawurst
Copy link
Collaborator

extrawurst commented Aug 17, 2021

That’s an upstream issue: rust-lang/git2-rs#721
You essentially cannot link against some system libgit2 version

@alerque
Copy link
Contributor

alerque commented Aug 23, 2021

Just bumped into this issue trying to update the official package for Arch Linux. It would be much appreciated if we could refrain from relying on things that are not released in dependencies yet. Keeping a devel branch with the goodies to be merged as soon as upstream releases them would be preferable.

Is there any chance of working around this by making some adjustments and not using any of the APIs in unreleased versions yet? Is the functionality so critical it can't be accomplished another way?

@extrawurst
Copy link
Collaborator

extrawurst commented Sep 2, 2021

we will soon get a new git2-rs release providing us with the necessary functions. will followup with a release myself then to fix these issues.

relevant upstream PR: rust-lang/git2-rs#744

@extrawurst
Copy link
Collaborator

ok we are getting closer. only a git2-rs release missing: rust-lang/git2-rs#745

after that I will do a release and bundling up a gitui release in distros should be easier again

@extrawurst extrawurst added this to the v0.17.1 milestone Sep 5, 2021
@extrawurst
Copy link
Collaborator

in the light of this: libgit2/libgit2sharp#1907 (comment)
I might wait a week to see if libgit2 releases a patch version that changes the memory layout again.

@jairbubbles
Copy link

I don't know if you've seen but the new method git_branch_name_is_valid was not exported correctly in v1.2.0 (see libgit2/libgit2#6032)

@extrawurst
Copy link
Collaborator

I don't know if you've seen but the new method git_branch_name_is_valid was not exported correctly in v1.2.0 (see libgit2/libgit2#6032)

actually git_remote_name_is_valid was exported incorrectly so it should not affect us

extrawurst pushed a commit that referenced this issue Sep 8, 2021
@extrawurst extrawurst mentioned this issue Sep 8, 2021
@jairbubbles
Copy link

You're totally right! 😅

extrawurst pushed a commit that referenced this issue Sep 8, 2021
@extrawurst
Copy link
Collaborator

@leecannon @alerque can you verify this on current master before I box it up into a release?

@alerque
Copy link
Contributor

alerque commented Sep 9, 2021

I can confirm the current Git HEAD builds against system-installed libgit2 now as long as the latter is v1.2.0 not v1.1.1.

@dm9pZCAq
Copy link
Contributor

for me it's again segfaults

> $CARGO_HOME/bin/gitui -V
gitui 0.17.1

> $CARGO_HOME/bin/gitui
segmentation fault  $CARGO_HOME/bin/gitui
> lddtree $CARGO_HOME/bin/gitui
gitui => /home/v/.cache/cargo/bin/gitui (interpreter => /lib/ld-musl-x86_64.so.1)
    libgit2.so.1.2 => /usr/lib/libgit2.so.1.2
        libssl.so.1.1 => /usr/lib/libssl.so.1.1
        libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1
        libpcre.so.1 => /lib/libpcre.so.1
        libhttp_parser.so.2.9 => /usr/lib/libhttp_parser.so.2.9
        libz.so.1 => /lib/libz.so.1
        libssh2.so.1 => /usr/lib/libssh2.so.1
    libgcc_s.so.1 => /usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.0/libgcc_s.so.1
    libc.so => /usr/lib/libc.so

@alerque
Copy link
Contributor

alerque commented Sep 10, 2021

Segfaulting is a different issue. The issue above is it wouldn't even build. Segfaulting at runtime is different and you should open a separate issue about your problem.

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

Successfully merging a pull request may close this issue.

5 participants