Syntax error: word unexpected (expecting ")")

An answer to this seems to be posted in the instructions to which you linked.

Admittedly it's a long way down in the comments but it didn't take long to search for qmake: Syntax error: word unexpected.

Quote:

Tej says: January 4, 2013 at 12:20 pm

Ok, I have solved the Problem. Its very unfortunate that ppl did not tell what actually is the problem. Problem is we have to use Host qmake. For that whatever Export (export PATH=/usr/local/arm/4.3.2/bin:$PATH etc.) we did in step during tslib installation, we have to undo all of that. Thats it.

Hope that help someone

In case that's not clear, Tej suggests that it would seem that you're trying to run the cross-compiled qmake on the host system.


That's an error reported by the Almquist shell or any of its derivatives like Dash (and Dash happened to be the default implementation of /bin/sh on Ubuntu 10.04 (Lucid Lynx)) when a word is found while parsing the syntax of a script where a ) is expected instead, for instance like in this case statement:

dash -c 'case a in b c) :; esac'

dash: 1: Syntax error: word unexpected (expecting ")")

That's because after b , the only thing that is expected after is ), (though actually | would also be allowed) so that c word is unexpected.

dash -c 'myfunc( something'

dash: 1: Syntax error: word unexpected (expecting ")")

One case where that can happen is if the script has been written on or transferred through a Microsoft OS where text line endings are CRLF instead of just LF.

A

case a in b) cmd1;;
          c) cmd2
esac

script written on MS-DOS would appear as:

case a in b) cmd1;;<CR>
          c) cmd2<CR>
esac<CR>

on Unix and that c would be an extra word after the <CR> word.

Here that's unlikely as your error reports the problem being on the first line of the script and most scripts start with the #! /path/to/interpreter shebang line.

Another possibility is that that script you're trying to run has been written on the assumption that sh was bash and uses constructs that are not portable to other sh implementations.

Since you're using an outdated and no longer maintained OS, it's also possible that you're running into a bug in that version of Dash. You could run dpkg-reconfigure dash and tell the system not to use Dash for sh (but Bash instead) to see if that helps.

Again, it is unlikely to be on the first line.

What sounds more likely is that that qmake file is not a script, but a binary executable that is not recognised as such by the system, for instance because it is of a binary format for the wrong architecture or it has been corrupted in transfer.

In that case, when the system fails to recognise it as a native executable, the invoking application would try to run sh on it as if it was a shell script, and the presence of a ( character in the file could cause Dash to fail with such an error.

On my system:

dash /bin/touch

/bin/touch: 1: /bin/touch: Syntax error: word unexpected (expecting ")")

And if you look at the content of /bin/touch as if it were a script, you see:

^?ELF^B^A^A^@^@^@^@^@^@^@^@^@^B^@>^@^A^@^@^@5&@^@^@^@^@^@@^@^@^@^@^@^@^@(ô^@^@...

Tags:

Qt4

Arm