Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure: error: cannot run /bin/sh

I am trying to build GNU toolchain for OpenRISC by following the guide given at http://openrisc.net/toolchain-build.html on Fedora Virtual Box Image.

I am getting error saying

Configure: error: cannot run /bin/sh ../gcc-svn/config.sub

when I try to configure gcc.

I am new to Linux. I could not find any solution online. Any help to solve the issue is highly appreciated.

like image 370
Chethan N Avatar asked Jun 11 '14 16:06

Chethan N


3 Answers

Open config.sub with a hex editor to see if the line endings are \r\n instead of just \n. If so, make a backup of the entire folder and then type:

dos2unix *

That will change all line endings from \r\n to \n, and it does it in place, overwriting each file. Then, again try:

./configure (with any options you desire)

I had this problem on cygwin for Windows where GitHub had converted all files to \r\n, so I had to convert them back with dos2unix.

like image 73
Dave Lampert Avatar answered Oct 07 '22 16:10

Dave Lampert


1.check and install libtools

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

2.try run "../gcc-svn/config.sub" through shell

/bin/bash ../gcc-svn/config.sub

see if shows as follows:

[root@centos jemalloc]# /bin/bash ./config.sub
: command not foundine 6:
: command not foundine 8:
: command not foundine 30:
: command not foundine 31:
: command not foundine 39:
: command not foundine 42:
: command not foundine 50:
: command not foundine 57:
: command not foundine 59:
: command not foundine 72:
: command not foundine 82:
: command not foundine 85:
'/config.sub.bak: line 88: syntax error near unexpected token in
'/config.sub.bak: line 88: ` case $1 in

3.find the system config.sub

 find / -name config.sub

it shows:

/usr/share/libtool/config/config.sub

compare the two config.sub to see if they are similar.

4.replace config.sub with system file

mv ../gcc-svn/config.sub ../gcc-svn/config.sub.bak
cp /usr/share/libtool/config/config.sub ../gcc-svn/config.sub 

mv ../gcc-svn/config.guess ../gcc-svn/config.guess.bak
cp /usr/share/libtool/config/config.guess ../gcc-svn/config.guess
  1. make to see if it works out.
like image 39
HuangFelix Avatar answered Oct 07 '22 15:10

HuangFelix


What is the first line of your ../gcc-svn/config.sub file? I'm guessing it may have a typo. It should be

#!/bin/sh

and not

/bin/sh

If it is

#!/bin/sh

Make sure that the file /bin/sh exists and is executable

ls -l /bin/sh

Should show something like

-rwxrwxrwx 1 root root 4 Feb  3  2009 /bin/sh
like image 1
ben Avatar answered Oct 07 '22 15:10

ben