Skip to content

"Linking with cc failed" - trying to cargo compile rust-based find-fd on OmniOS #145

@priyadarshan

Description

@priyadarshan

I need to run rust-based fd-find.

Instead of bothering the super-busy Joyent/pkgsrc devs (by the way thank you for ripgrep!), I thought of compiling it using cargo.

On OmniOS r151026 with pkgsrc 2018Q2,

root@omnios:~# uname -a
SunOS omnios 5.11 omnios-r151026-d258f672aa i86pc i386 i86pc

I have successfully installed rust and gcc,

root@omnios:~# rustc --version
rustc 1.27.0
root@omnios:~# cc --version
cc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Also, I have this as $PATH

root@omnios:~# echo $PATH
/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin

Still, trying to install fd-find using cargo I get errors like error: linking with cc failed: exit code: 1,

root@fido:~# cargo install fd-find
    Updating registry `https://github.com/rust-lang/crates.io-index`
  Installing fd-find v7.1.0
   Compiling semver-parser v0.7.0
   Compiling version_check v0.1.4
   Compiling void v1.0.2
   Compiling rand_core v0.2.1
   Compiling libc v0.2.43
   Compiling stable_deref_trait v1.1.1
   Compiling cfg-if v0.1.5
   Compiling ucd-util v0.1.1
   Compiling unicode-width v0.1.5
   Compiling regex v1.0.5
   Compiling nodrop v0.1.12
   Compiling scopeguard v0.3.3
   Compiling nix v0.11.0
   Compiling crossbeam-utils v0.5.0
   Compiling ansi_term v0.11.0
   Compiling strsim v0.7.0
   Compiling bitflags v1.0.4
   Compiling vec_map v0.8.1
   Compiling memoffset v0.2.1
   Compiling utf8-ranges v1.0.1
   Compiling same-file v1.0.3
   Compiling fnv v1.0.6
   Compiling log v0.4.5
   Compiling owning_ref v0.3.3
   Compiling arrayvec v0.4.7
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" "-L" "/opt/local/lib/rustlib/x86_64-sun-solaris/lib" "/tmp/cargo-installWG6UWN/release/build/nix-aacaf4418f670152/build_script_build-aacaf4418f670152.build_script_build0-c1f9b7886081f32c63a6dc6adfadc212.rs.rcgu.o" "/tmp/cargo-installWG6UWN/release/build/nix-aacaf4418f670152/build_script_build-aacaf4418f670152.build_script_build1-c1f9b7886081f32c63a6dc6adfadc212.rs.rcgu.o" "-o" "/tmp/cargo-installWG6UWN/release/build/nix-aacaf4418f670152/build_script_build-aacaf4418f670152" "/tmp/cargo-installWG6UWN/release/build/nix-aacaf4418f670152/build_script_build-aacaf4418f670152.crate.allocator.rcgu.o" "-Wl,-z" "-Wl,ignore" "-nodefaultlibs" "-L" "/tmp/cargo-installWG6UWN/release/deps" "-L" "/opt/local/lib/rustlib/x86_64-sun-solaris/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/opt/local/lib/rustlib/x86_64-sun-solaris/lib/libstd-e3cf0fe0847ed813.rlib" "/opt/local/lib/rustlib/x86_64-sun-solaris/lib/libpanic_unwind-d20975b11a4ea47b.rlib" "/opt/local/lib/rustlib/x86_64-sun-solaris/lib/libunwind-340827095a1c5df9.rlib" "/opt/local/lib/rustlib/x86_64-sun-solaris/lib/liballoc_system-3cef478229e227eb.rlib" "/opt/local/lib/rustlib/x86_64-sun-solaris/lib/liblibc-ec41d1fdd7710214.rlib" "/opt/local/lib/rustlib/x86_64-sun-solaris/lib/liballoc-90d8f0bc63b583d9.rlib" "/opt/local/lib/rustlib/x86_64-sun-solaris/lib/libcore-aa4dc5503cc5c8c8.rlib" "-Wl,--end-group" "/opt/local/lib/rustlib/x86_64-sun-solaris/lib/libcompiler_builtins-06be8eed06a72164.rlib" "-Wl,-Bdynamic" "-l" "socket" "-l" "posix4" "-l" "pthread" "-l" "resolv" "-l" "ssp" "-l" "umem" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread"
  = note: ld: fatal: file crt1.o: open failed: No such file or directory
          collect2: error: ld returned 1 exit status


   Compiling unreachable v1.0.0
error: aborting due to previous error

[more similar errors]

It seems like cargo does not see cc?

Could somebody point to me pages or tips on how to solve this?

It would be good for others to know too, as quite a few very nice tools are developed in rust nowadays.

Thank you in advance.

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