Linking with `cc`

Hey!
I am new to Rust and wanted to contribute to a project. When I tried building the cloned project, I received the following error which goes beyond my understanding of Rust:

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-arch" "x86_64" "-m64"
...
...
 = note: ld: malformed universal file: slice content is not mach-o or a static library file '/usr/local/lib/libosxfuse.dylib'
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

The way I understand is that the project is using some resources from C/C++ and hence needs to link through the given file (please correct me if I am wrong!)
I was able to locate the file on my computer but I am not entirely sure what is supposed to be in there or exactly what I should be looking at.

Any help and pointers are much appreciated!

Thanks in advance!

It says that it was trying to link that library but the file at that place isn't really a library. Can you run the file command on that file to obtain its precise type?

1 Like

Hey, thanks for the quick reply!

Yes, this is what I got:

libosxfuse.dylib: Mach-O universal binary with 4 architectures: [ppc_7400:Mach-O dynamically linked shared library ppc_7400
- Mach-O dynamically linked shared library ppc_7400] [ppc64:Mach-O dynamically linked shared library ppc64
- Mach-O dynamically linked shared library ppc64] [i386:Mach-O dynamically linked shared library i386
- Mach-O dynamically linked shared library i386] [x86_64:Mach-O 64-bit dynamically linked shared library x86_64
- Mach-O 64-bit dynamically linked shared library x86_64]
libosxfuse.dylib (for architecture ppc7400):	Mach-O dynamically linked shared library ppc_7400
libosxfuse.dylib (for architecture ppc64):	Mach-O dynamically linked shared library ppc64
libosxfuse.dylib (for architecture i386):	Mach-O dynamically linked shared library i386
libosxfuse.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64

Well, it is a library, then. A google search for the error message shows that it might be a problem with your C toolchain being too new. Can you try with an older version? (You're looking for "Xcode Command-Line Tools", which have nothing to do with Xcode, this is just a stupid name the Apple calls the standard Unix-y C/C++ toolchain.)

Ohh I see, okey so I am new to this and just wanted to clarify:

  1. Quick check in my terminal xcode-select -p gave me an output /Library/Developer/CommandLineTools which I assume means I have some version of Xcode Command-Line Tools.
  2. Since it could be too new, I need to remove it and install a specific older version?

Thanks again

Quick check, is your mac a M1/M2 one? It seems the dylib doesn't support it. ppc mentioned in the list means the PowerPC architecture. Last ppc mac were sold by Apple at late 2005.

I'm still an intel boy:) i5

That was already evident from the fact that there was a clang compiler and an ld linker on your system.

Yes, that's what I was trying to suggest based on the Stack Overflow answer linked above. However, I don't know if this is the actual problem, it's merely a shot in the dark on my part.

1 Like

Thanks for your shot in the dark :slight_smile: Turned out, I just had to re-install the newest version!

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.