Skip to content

Undefined symbols for architecture x86_64: "_git_branch_name_is_valid" #721

Open
@arxanas

Description

@arxanas

As of 0454efb, cargo test fails on macOS.

System details:

$ uname -a
Darwin waleedkhan-mbp 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
$ rustup show
Default host: x86_64-apple-darwin
rustup home:  /Users/Waleed/.rustup

stable-x86_64-apple-darwin (default)
rustc 1.52.1 (9bc8c42bb 2021-05-09)
```

Error message:

```
   Compiling git2 v0.13.20 (/Users/Waleed/workspace/git2-rs)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-arch" "x86_64" "-L" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.0.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.1.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.10.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.11.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.12.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.13.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.14.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.15.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.2.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.3.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.4.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.5.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.6.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.7.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.8.rcgu.o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.9.rcgu.o" "-o" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff" "/Users/Waleed/workspace/git2-rs/target/debug/deps/git2-77dec5eea979a8ff.u09cr4b2fds5ba9.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/Waleed/workspace/git2-rs/target/debug/deps" "-L" "/usr/local/Cellar/libgit2/1.1.0/lib" "-L" "/Users/Waleed/workspace/git2-rs/target/debug/build/libssh2-sys-34ee49cb41b19d75/out/build" "-L" "/usr/local/opt/openssl@1.1/lib" "-L" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libtest-db9eca8f5d08050d.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libterm-03ffa4db69efb895.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgetopts-01bd0f519f94c074.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunicode_width-7901380749915546.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_std-ab361ac62179dadb.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/liblog-135ef244209a85d4.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/liburl-b42a4cec8f8c5eb2.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libidna-5fae12f627455a64.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libunicode_normalization-74a564265e91967d.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libtinyvec-6c23dec31872fc26.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libtinyvec_macros-6a3d9893f1f74a5e.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libunicode_bidi-6d116929acb2ac5f.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libform_urlencoded-ab8796b5b8e83d73.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libpercent_encoding-2dbd0b5d1d2ba49f.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libmatches-a9016931447b6b5e.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libtempfile-1c9892031130ac2e.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/librand-0d9d2110c5342d0f.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/librand_chacha-64b398b5594e7be9.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libppv_lite86-df618e8854d7d514.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/librand_core-7696cd0ce21900dd.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libgetrandom-d9735d083523c02e.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libremove_dir_all-eb405c93cdca49aa.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libcfg_if-e10c2c6247528dd5.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/liblibgit2_sys-d2b2004c9dcf63c6.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/liblibssh2_sys-293c0a5bd68c1708.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libopenssl_sys-fe4003bb0719f60d.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/liblibz_sys-a8082fefcfc7e72e.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/liblibc-fc25c8b902b51cd0.rlib" "/Users/Waleed/workspace/git2-rs/target/debug/deps/libbitflags-7be09f63d9f2d764.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-9225b8e469c32698.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-2fe2b8cd4fa63c34.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libobject-80083cf4ee7ee3ff.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libaddr2line-ddf3832e718029e6.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libgimli-ba92c986e8ef2ca8.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-acd0bd456d8da820.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libhashbrown-55608c4156e4ecbb.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_alloc-4be618026614fdc7.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-fee25922260aa100.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcfg_if-38ba3c5cc408e14d.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-899852a009fbe35f.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-5687564a0ccea916.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-9ed2c58b16cff4ee.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-244bf5611f93ff45.rlib" "/Users/Waleed/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-70df686e6b4ebf5b.rlib" "-lgit2" "-lssl" "-lcrypto" "-lz" "-liconv" "-lSystem" "-lresolv" "-lc" "-lm" "-liconv"
  = note: Undefined symbols for architecture x86_64:
            "_git_branch_name_is_valid", referenced from:
                git2::branch::Branch::name_is_valid::hf21c1179aaf6f2cb in git2-77dec5eea979a8ff.git2.4s4bygf1-cgu.11.rcgu.o
          ld: symbol(s) not found for architecture x86_64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)
          

error: aborting due to previous error

error: could not compile `git2`

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions