天天看點

clang: error: unable to execute command: Executable “ld“ doesn‘t exist!

    如題所示,我在minix3中直接安裝了clang,然後使用如下指令編譯c程式報錯。

# clang hello.c -o hello
clang: error: unable to execute command: Executable "ld" doesn't exist!
clang: error: linker command failed with exit code 1 (use -v to see invocation)
# 
           

    提示說缺少ld,其實需要安裝binutils這個工具,可以通過pkgin_cd in binutils:

# pkgin_cd in binutils
Checking for CD in /dev/c0d2p2.
/dev/c0d2p2 is mounted on /mnt
Found.
database for /mnt/install/packages is up-to-date
calculating dependencies... done.

nothing to upgrade.
1 packages to be installed: binutils-2.23.2 (8912K to download, 35M to install)

proceed ? [Y/n] Y
downloading packages...
binutils-2.23.2.tgz                                                  100% 8912KB   8.7MB/s   8.7MB/s   00:01    
installing packages...
installing binutils-2.23.2...
pkg_install warnings: 0, errors: 0
reading local summary...
processing local summary...
updating database: 100%
marking binutils-2.23.2 as non auto-removable
# 
           

    這時候系統中就有了ld指令了。

clang: error: unable to execute command: Executable “ld“ doesn‘t exist!

    再次編譯,順利通過。

clang: error: unable to execute command: Executable “ld“ doesn‘t exist!

    其實,這個問題一般不會出現,是我自己少安裝了binutils,直接安裝了clang,不知道有沒有遇到同樣問題的同學。 

繼續閱讀