configure: error: cannot run /bin/bash config/config.sub

本文详细介绍了在Linux环境下,使用./configure命令时遇到的各种错误及其解决方案,特别针对配置joy工具时出现的问题,提供了具体的步骤和命令,包括安装必要的依赖包和修复config.sub文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

linux下./configure 后可能会出现各种问题,缺少依赖包,或者版本 变量不一致等。不同的行为可能会产生同一错误,我是在安装 joy 工具时,遇到该报错。下面的方法不一定对你的问题一定有用,这就是个尝试的过程,只要能解决问题就好。
若你也是在安装 joy,可参考文章
操作环境:Ubuntu 16.04

问题描述

root@ubuntu:/home/joy# ./configure --enable-gzip
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/home/joy/config/missing: line 3: $'\r': command not found
......
checking for ranlib... ranlib
configure: error: cannot run /bin/bash config/config.sub

确保已经安装下列工具

    yum install libtool       
    yum install libtool-ltdl    
    yum install libtool-ltdl-devel

在终端运行如下命令,查看报错处

root@ubuntu:/home/joy# /bin/bash config/config.sub
config/config.sub: line 4: $'\r': command not found
config/config.sub: line 6: $'\r': command not found
config/config.sub: line 26: $'\r': command not found
config/config.sub: line 27: $'\r': command not found
config/config.sub: line 34: $'\r': command not found
config/config.sub: line 37: $'\r': command not found
config/config.sub: line 45: $'\r': command not found
config/config.sub: line 52: $'\r': command not found
config/config.sub: line 54: $'\r': command not found
config/config.sub: line 67: $'\r': command not found
config/config.sub: line 75: $'\r': command not found
config/config.sub: line 78: $'\r': command not found
config/config.sub: line 81: syntax error near unexpected token `$'in\r'
config/config.sub: line 81: `  case $1 in

找道系统中所有的 config.sub 文件,与自己目录下的进行比较

root@ubuntu:~# find / -name config.sub
/home/joy/config/config.sub
/usr/share/libtool/build-aux/config.sub
/usr/share/misc/config.sub
/mnt/hgfs/CDH-Hadoop/joy/config/config.sub

错误解决
用系统中的config.sub 文件替换

mv /home/joy/config/config.sub /home/joy/config/config.sub.bak
cp /usr/share/libtool/build-aux/config.sub /home/joy/config/config.sub

mv /home/joy/config/config.guess /home/joy/config/config.guess.bak
cp /usr/share/libtool/build-aux/config.guess /home/joy/config/config.guess

进行测试 报错消除

root@ubuntu:/home/joy# ./configure --enable-gzip
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/home/joy/config/missing: line 3: $'\r': command not found
/home/joy/config/missing: line 5: $'\r': command not found
......
checking for zlib.h... yes
checking for zlib.h... (cached) yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating safe_c_stub/Makefile
config.status: creating safe_c_stub/lib/Makefile
config.status: creating lib/Makefile
config.status: creating bin/Makefile
config.status: creating joy_config.h
config.status: executing depfiles commands
config.status: executing libtool commands

该文章大量参考 https://stackoverflow.com/questions/24168165/configure-error-cannot-run-bin-sh

作者:Solarzhou
来源:优快云
原文:https://blog.youkuaiyun.com/ZT7524/article/details/86516570
版权声明:本文为博主原创文章,转载请附上博文链接!

make[1]: Entering directory '/openwrt/openwrt-15.05.1' make[2]: Entering directory '/openwrt/openwrt-15.05.1/package/helloworld/helloworld' rm -f /openwrt/openwrt-15.05.1/bin/ar71xx/packages/base/helloworld_* rm -f /openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/stamp/._installed rm -f /openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/packages/.list /openwrt/openwrt-15.05.1/staging_dir/host/packages/.list rm -rf /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/helloworld-1.0 make[2]: Leaving directory '/openwrt/openwrt-15.05.1/package/helloworld/helloworld' make[1]: Leaving directory '/openwrt/openwrt-15.05.1' make[1]: Entering directory '/openwrt/openwrt-15.05.1' make[2]: Entering directory '/openwrt/openwrt-15.05.1/package/libs/toolchain' mkdir -p /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain touch /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/.prepared_0c0f7031f78967ca687e5628984dfab9 rm -f /openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/stamp/.toolchain_installed (cd /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/./; if [ -x ./configure ]; then find /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/ -name config.guess | xargs -r chmod u+w; find /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/ -name config.guess | xargs -r -n1 cp --remove-destination /openwrt/openwrt-15.05.1/scripts/config.guess; find /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/ -name config.sub | xargs -r chmod u+w; find /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/ -name config.sub | xargs -r -n1 cp --remove-destination /openwrt/openwrt-15.05.1/scripts/config.sub; AR="mips-openwrt-linux-uclibc-gcc-ar" AS="mips-openwrt-linux-uclibc-gcc -c -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float" LD=mips-openwrt-linux-uclibc-ld NM="mips-openwrt-linux-uclibc-gcc-nm" CC="mips-openwrt-linux-uclibc-gcc" GCC="mips-openwrt-linux-uclibc-gcc" CXX="mips-openwrt-linux-uclibc-g++" RANLIB="mips-openwrt-linux-uclibc-gcc-ranlib" STRIP=mips-openwrt-linux-uclibc-strip OBJCOPY=mips-openwrt-linux-uclibc-objcopy OBJDUMP=mips-openwrt-linux-uclibc-objdump SIZE=mips-openwrt-linux-uclibc-size CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 " CPPFLAGS="-I/openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/include -I/openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/include -I/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/usr/include -I/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include " LDFLAGS="-L/openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/lib -L/openwrt/openwrt-15.05.1/staging_dir/target-mips_34kc_uClibc-0.9.33.2/lib -L/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/usr/lib -L/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib " ./configure --target=mips-openwrt-linux --host=mips-openwrt-linux --build=x86_64-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls ; fi; ) rm -f /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/.configured_* touch /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/.configured_yyy cp -fpR /openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libuClibc-*.so /openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libcrypt-*.so /openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libm-*.so /openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libpthread-*.so /openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/ cp: cannot stat '/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libuClibc-*.so': No such file or directory cp: cannot stat '/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libcrypt-*.so': No such file or directory cp: cannot stat '/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libm-*.so': No such file or directory cp: cannot stat '/openwrt/openwrt-15.05.1/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/lib/libpthread-*.so': No such file or directory Makefile:636: recipe for target '/openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/.built' failed make[2]: *** [/openwrt/openwrt-15.05.1/build_dir/target-mips_34kc_uClibc-0.9.33.2/toolchain/.built] Error 1 make[2]: Leaving directory '/openwrt/openwrt-15.05.1/package/libs/toolchain' package/Makefile:191: recipe for target 'package/libs/toolchain/compile' failed make[1]: *** [package/libs/toolchain/compile] Error 2 make[1]: Leaving directory '/openwrt/openwrt-15.05.1' /openwrt/openwrt-15.05.1/include/toplevel.mk:181: recipe for target 'package/helloworld/compile' failed make: *** [package/helloworld/compile] Error 2
08-08
/config.guess: unable to guess system type This script, last modified 2003-01-30, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from ftp://ftp.gnu.org/pub/gnu/config/ If the version you run (./config.guess) is already up to date, please send the following data and any information you think might be pertinent to <config-patches@gnu.org> in order to provide the needed information to handle your system. config.guess timestamp = 2003-01-30 uname -m = aarch64 uname -r = 4.19.90-89.11.v2401.ky10.aarch64 uname -s = Linux uname -v = #1 SMP Thu Apr 25 18:20:10 CST 2024 /usr/bin/uname -p = aarch64 /bin/uname -X = hostinfo = /bin/universe = /usr/bin/arch -k = /bin/arch = aarch64 /usr/bin/oslevel = /usr/convex/getsysinfo = UNAME_MACHINE = aarch64 UNAME_RELEASE = 4.19.90-89.11.v2401.ky10.aarch64 UNAME_SYSTEM = Linux UNAME_VERSION = #1 SMP Thu Apr 25 18:20:10 CST 2024 Config.guess failed to determine the host type. You need to specify one. Usage: configure [OPTIONS] [HOST] Options: [defaults in brackets] --prefix=MYDIR install into MYDIR [/usr/local] --exec-prefix=MYDIR install host-dependent files into MYDIR [/usr/local] --help print this message [normal config] --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [determined via config.guess] --norecursion configure this directory only [recurse] --program-prefix=FOO prepend FOO to installed program names [""] --program-suffix=FOO append FOO to installed program names [""] --program-transform-name=P transform installed names by sed pattern P [""] --site=SITE configure with site-specific makefile for SITE --srcdir=DIR find the sources in DIR [. or ..] --target=TARGET configure for TARGET [TARGET=HOST] --tmpdir=TMPDIR create temporary files in TMPDIR [/tmp] --nfp configure for software floating point [hard float] --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR) --without-FOO package FOO is NOT available --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR) --disable-FOO do not include feature FOO Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.
最新发布
08-22
(Zmamba) zhangzeyuan@DESKTOP-8B20VC8:~$ sudo apt install ubuntu-drivers-common Reading package lists... Done Building dependency tree... Done Reading state information... Done Suggested packages: python3-aptdaemon.pkcompat The following NEW packages will be installed: ubuntu-drivers-common 0 upgraded, 1 newly installed, 0 to remove and 100 not upgraded. 8 not fully installed or removed. Need to get 59.4 kB of archives. After this operation, 300 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 ubuntu-drivers-common amd64 1:0.9.6.2~0.22.04.8 [59.4 kB] Fetched 59.4 kB in 1s (50.2 kB/s) Preconfiguring packages ... Selecting previously unselected package ubuntu-drivers-common. (Reading database ... 85780 files and directories currently installed.) Preparing to unpack .../ubuntu-drivers-common_1%3a0.9.6.2~0.22.04.8_amd64.deb ... Unpacking ubuntu-drivers-common (1:0.9.6.2~0.22.04.8) ... Setting up ubuntu-drivers-common (1:0.9.6.2~0.22.04.8) ... Created symlink /etc/systemd/system/display-manager.service.wants/gpu-manager.service → /lib/systemd/system/gpu-manager.service. Unit /lib/systemd/system/gpu-manager.service is added as a dependency to a non-existent unit display-manager.service. Created symlink /etc/systemd/system/oem-config.service.wants/gpu-manager.service → /lib/systemd/system/gpu-manager.service. Unit /lib/systemd/system/gpu-manager.service is added as a dependency to a non-existent unit oem-config.service. Setting up nvidia-dkms-535 (535.54.03-0ubuntu1) ... A modprobe blacklist file has been created at /etc/modprobe.d to prevent Nouveau from loading. This can be reverted by deleting the following file: /etc/modprobe.d/nvidia-graphics-drivers.conf A new initrd image has also been created. To revert, please regenerate your initrd by running the following command after deleting the modprobe.d file: `/usr/sbin/initramfs -u` ***************************************************************************** *** Reboot your computer and verify that the NVIDIA graphics driver can *** *** be loaded. *** ***************************************************************************** INFO:Enable nvidia DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here Removing old nvidia-535.54.03 DKMS files... Deleting module nvidia-535.54.03 completely from the DKMS tree. Loading new nvidia-535.54.03 DKMS files... It is likely that 5.10.16.3-microsoft-standard-WSL2 belongs to a chroot's host Building for 5.15.0-141-generic Building for architecture x86_64 Building initial module for 5.15.0-141-generic ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-dkms-535.0.crash' Error! Bad return status for module build on kernel: 5.15.0-141-generic (x86_64) Consult /var/lib/dkms/nvidia/535.54.03/build/make.log for more information. dpkg: error processing package nvidia-dkms-535 (--configure): installed nvidia-dkms-535 package post-installation script subprocess returned error exit status 10 dpkg: dependency problems prevent configuration of cuda-drivers-535: cuda-drivers-535 depends on nvidia-dkms-535 (>= 535.54.03); however: Package nvidia-dkms-535 is not configured yet. dpkg: error processing package cuda-drivers-535 (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of cuda-drivers: cuda-drivers depends on cuda-drivers-535 (= 535.54.03-1); however: Package cuda-drivers-535 is not configured yet. dpkg: error processing package cuda-drivers (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of nvidia-driver-535: nvidia-driver-535 depends on nvidia-dkms-535 (= 535.54.03-0ubuntu1); however: Package nvidia-dkms-535 is not configured yet. dpkg: error processing package nvidia-driver-535 (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of cuda-runtNo apport report written because the error message indicates its a followup error from a previous failure. No apport report written because the error message indicates its a followup error from a previous failure. No apport report written because MaxReports is reached already No apport report written because MaxReports is reached already No apport report written because MaxReports is reached already No apport report written because MaxReports is reached already No apport report written because MaxReports is reached already ime-12-2: cuda-runtime-12-2 depends on cuda-drivers (>= 535.54.03); however: Package cuda-drivers is not configured yet. dpkg: error processing package cuda-runtime-12-2 (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of cuda-12-2: cuda-12-2 depends on cuda-runtime-12-2 (>= 12.2.0); however: Package cuda-runtime-12-2 is not configured yet. dpkg: error processing package cuda-12-2 (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of cuda: cuda depends on cuda-12-2 (>= 12.2.0); however: Package cuda-12-2 is not configured yet. dpkg: error processing package cuda (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of cuda-demo-suite-12-2: cuda-demo-suite-12-2 depends on cuda-runtime-12-2; however: Package cuda-runtime-12-2 is not configured yet. dpkg: error processing package cuda-demo-suite-12-2 (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: nvidia-dkms-535 cuda-drivers-535 cuda-drivers nvidia-driver-535 cuda-runtime-12-2 cuda-12-2 cuda cuda-demo-suite-12-2 E: Sub-process /usr/bin/dpkg returned an error code (1) (Zmamba) zhangzeyuan@DESKTOP-8B20VC8:~$ 怎么解决
06-13
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值