6

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.

Chethan N
  • 1,110
  • 1
  • 9
  • 23

3 Answers3

9

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.

Dave Lampert
  • 191
  • 2
  • 3
3

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.
HuangFelix
  • 31
  • 3
  • 2
    I was trying to `./configure` a library and the _config.guess_ and _config.sub_ files where way outdated. Replaced both with the ones that came with libtools and it worked like a charm. Thank you! – Hernán Erasmo Jul 23 '15 at 15:18
1

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
ben
  • 111
  • 4
  • Dear me, I certainly hope it isn't world-writable! :) – Tom Zych Jun 11 '14 at 17:27
  • :D oversight. on my machine it was actually "lrwxrwxrwx 1 root root 4 Feb 3 2009 /bin/sh -> bash" but I thought that was confuse since it I didn't think it was usually a link. so I quickly deleted the "l" without thinking about the rest. Good point ;) – ben Jun 11 '14 at 21:07
  • 1
    The first line is #!/bin/sh and ls -l /bin/sh is giving the expected output. But the problem still exists. – Chethan N Jun 12 '14 at 06:48
  • Is the config.sub file executable? – ben Jun 16 '14 at 17:32