Skip to content

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

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.

Activity

  1. jperkin commented on Sep 18, 2018

    @jperkin
    Collaborator

    The error here is this line:

      = note: ld: fatal: file crt1.o: open failed: No such file or directory
    

    This file belongs in /usr/lib and needs to be provided by the OS, I think on OmniOS it is in the "gcc-runtime" package but I am not sure. Install the relevant package and things should work.

  2. rmustacc commented on Sep 18, 2018

    @rmustacc
  3. priyadarshan commented on Sep 19, 2018

    @priyadarshan
    Author

    Thank you for quick reply. After installing proper OmniOS tooling, ld error disappear, while cc failed error remains, with no explanation. It seems there's some kind of "impedence mismatch" between pkgsrc and OmniOS native packages. I will investigate this further and report back.

  4. priyadarshan commented on Oct 6, 2018

    @priyadarshan
    Author

    I am back as promised. It turns out it was not a missing dependency, but rather an issue with nix missing Illumos/Solaris Bindings.

    Since I am able to compile smoothly other rust apps, like ripgrep's latest version, I hope that issue will solve this as well.

  5. changed the title [-]"Linking with cc failed" - trying to cargo compile rust-based find-fd[/-] [+]"Linking with cc failed" - trying to cargo compile rust-based find-fd on OmniOS[/+] on Oct 6, 2018
  6. added a commit that references this issue on Dec 1, 2018
  7. papertigers commented on Jan 14, 2019

    @papertigers

    @priyadarshan btw here are the missing pieces in libc needed by nix:
    papertigers/libc@6b9b207

    I have also hacked nix to a state where it can compile and I was able to successfully build fd-find on illumos. It seems to function correctly and all of its tests pass via cargo test.

    Next steps:

    • Validate the libc crate changes look sane. I used awk to generate some of it.
    • Fix nix properly. Currently a lot of tests fail on my first pass.
  8. priyadarshan commented on Jan 15, 2019

    @priyadarshan
    Author

    Thank you so much for the enormous work.
    I am sure many, including the open nix issue will benefit.

  9. added a commit that references this issue on Mar 26, 2019
  10. added a commit that references this issue on Apr 10, 2019
  11. added a commit that references this issue on Sep 2, 2019
  12. added a commit that references this issue on Oct 20, 2019
  13. added a commit that references this issue on Jan 3, 2020
  14. added a commit that references this issue on Jan 11, 2020
  15. 115 remaining items

  16. added a commit that references this issue on Jun 9, 2026
  17. added a commit that references this issue on Jul 30, 2026
  18. added a commit that references this issue on Aug 26, 2026
  19. added a commit that references this issue on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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