configure: error: /bin/sh must be GNU Bash

本文解决了在进行configure时遇到的错误:/bin/sh必须为GNU Bash的问题。通过使用Ubuntu中的update-alternatives机制,将/bin/sh指向bash而非默认的dash,从而避免了configure过程中的错误。

今天在做configure 的时候,报错configure: error: /bin/sh must be GNU Bash。

百度瞬间废物,什么资料也查不到,最好google 立马解决问题,

https://developer.windriver.com/thread/1195


/bin/sh needs to point to bash and by default Ubuntu points sh at dash. You can make the change either by brute-force (i.e. just change the link for /bin/sh) or use the 'update-alternatives' mechanism in ubuntu:

 

sudo update-alternatives --install /bin/sh sh /bin/dash 1
sudo update-alternatives --install /bin/sh sh /bin/bash 1

sudo update-alternatives --config sh

 

Select the entry for /bin/bash and to make sure, try '/bin/sh --version'.

 

If sh is pointing at bash, you'll get a version message (GNU bash, version 4.1.5... ), if it's pointing at dash, you'll get a message like: /bin/sh: Illegal option --


# Makefile for OpenWrt # # Copyright (C) 2007 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # TOPDIR:=${CURDIR} LC_ALL:=C LANG:=C T_PRODUCT_CONFIG_DIR:=$(TOPDIR)/product_config export TOPDIR LC_ALL LANG T_PRODUCT_CONFIG_DIR ifndef PR_NAME ifeq (build_product_info.tmp, $(wildcard build_product_info.tmp)) include build_product_info.tmp else $(error "Must specify PR_NAME. Usage: make PR_NAME=c200v1") endif else $(shell echo "export PR_NAME=$(PR_NAME)" > build_product_info.tmp) endif world: include $(TOPDIR)/include/host.mk ifneq ($(OPENWRT_BUILD),1) # XXX: these three lines are normally defined by rules.mk # but we can't include that file in this context empty:= space:= $(empty) $(empty) _SINGLE=export MAKEFLAGS=$(space); override OPENWRT_BUILD=1 export OPENWRT_BUILD GREP_OPTIONS= export GREP_OPTIONS include $(TOPDIR)/include/debug.mk include $(TOPDIR)/include/depends.mk include $(TOPDIR)/include/toplevel.mk else include rules.mk include $(INCLUDE_DIR)/depends.mk include $(INCLUDE_DIR)/subdir.mk include target/Makefile include package/Makefile include tools/Makefile include toolchain/Makefile $(toolchain/stamp-install): $(tools/stamp-install) $(target/stamp-compile): $(toolchain/stamp-install) $(tools/stamp-install) $(BUILD_DIR)/.prepared $(package/stamp-cleanup): $(target/stamp-compile) $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-install): $(package/stamp-compile) $(package/stamp-rootfs-prepare): $(package/stamp-install) $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) printdb: @true prepare: $(target/stamp-compile) clean: FORCE if [ -n "$(CONFIG_RTOS)" ]; then \ $(_SINGLE)$(SUBMAKE) target/rtos/clean; \ elif [ -e $(T_PRODUCT_CONFIG_DIR)/$(PR_NAME)/buildroot.config ]; then \ $(_SINGLE)$(SUBMAKE) target/linux/clean; \ fi rm -rf $(BUILD_DIR) $(TMP_DIR) $(BIN_DIR) $(BUILD_LOG_DIR) ifneq ($(AMS_PULL),no) rm -rf tp_package/ams endif find $(STAGING_DIR) -maxdepth 1 -mindepth 1 ! -name ccache | xargs rm -rf rm -rf .config dirclean: clean rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) $(BUILD_DIR_TOOLCHAIN) rm -rf $(TMP_DIR) ifndef DUMP_TARGET_DB $(BUILD_DIR)/.prepared: Makefile @mkdir -p $$(dirname $@) @touch $@ tmp/.prereq_packages: .config unset ERROR; \ for package in $(sort $(prereq-y) $(prereq-m)); do \ $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \ done; \ if [ -n "$$ERROR" ]; then \ echo "Package prerequisite check failed."; \ false; \ fi touch $@ endif # check prerequisites before starting to build prereq: $(target/stamp-prereq) tmp/.prereq_packages @if [ ! -f "$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)" ]; then \ echo 'ERROR: Missing site config for target "$(REAL_GNU_TARGET_NAME)" !'; \ echo ' The missing file will cause configure scripts to fail during compilation.'; \ echo ' Please provide a "$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)" file and restart the build.'; \ exit 1; \ fi prepare: .config $(tools/stamp-install) $(toolchain/stamp-install) world: prepare $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) $(target/stamp-install) FORCE $(_SINGLE)$(SUBMAKE) -r package/index # update all feeds, re-create index files, install symlinks package/symlinks: $(SCRIPT_DIR)/feeds update -a $(SCRIPT_DIR)/feeds install -a # re-create index files, install symlinks package/symlinks-install: $(SCRIPT_DIR)/feeds update -i $(SCRIPT_DIR)/feeds install -a # remove all symlinks, don't touch ./feeds package/symlinks-clean: $(SCRIPT_DIR)/feeds uninstall -a .PHONY: clean dirclean prereq prepare world package/symlinks package/symlinks-install package/symlinks-clean endif 这里面会pullams吗
最新发布
11-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值