php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39835 Configure script fails with expr: syntax error
Submitted: 2006-12-14 22:05 UTC Modified: 2006-12-23 01:00 UTC
Votes:11
Avg. Score:4.0 ± 0.9
Reproduced:10 of 11 (90.9%)
Same Version:0 (0.0%)
Same OS:1 (10.0%)
From: cheetah at tanabi dot org Assigned:
Status: No Feedback Package: *Compile Issues
PHP Version: 5.2.0 OS: Solaris 10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cheetah at tanabi dot org
New email:
PHP Version: OS:

 

 [2006-12-14 22:05 UTC] cheetah at tanabi dot org
Description:
------------
Two notes; I have tried this on two separate Solaris 10 machines and I get this exact same error on both.  On both machines, past versions of PHP have successfully compiled -- namely PHP 5.1.6 and a few earlier ones as well.

Not doing anything particularly special here other than a 64 bit build (we use a large memory application with this) WHICH worked perfectly fine with 5.1.6...  The flags to build 64 bit are in CFLAGS and LDFLAGS, namely -mcpu=ultrasparc -m64 here's what happens:

./configure --prefix=/usr/local/64 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-pgsql=/usr/local/64/pgsql --with-pdo-pgsql=/usr/local/64/pgsql --with-libxml-dir=/usr/local/64 --enable-ftp --without-iconv
loading cache ./config.cache
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for egrep... egrep
checking for a sed that does not truncate output... /usr/local/bin/sed
expr: syntax error
./configure: test: argument expected


'expr' shows up only about 60 billion times in the file, and I have been unable to reasonably isolate which one is actually failing.  Too bad shell scripts aren't nice enough to provide a line number! :)  I'm hoping someone can help me out here, and appologies if this has already been reported -- I did search the bug DB for quite awhile before posting :)


Thanks!


Reproduce code:
---------------
N/A

Expected result:
----------------
N/A

Actual result:
--------------
N/A

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-15 03:45 UTC] toomuchphp-phpbugs at yahoo dot com
I had the some problem on OS X upgrading to 5.2, you just need to upgrade your shell (e.g., bash).
 [2006-12-15 04:52 UTC] cheetah at tanabi dot org
Okay; I upgraded the bash on the system and made sure configure was using it (it was using /bin/sh, which is Sun's 'sh' and therefore could be problematic).  Bash is now at 3.2 and now when I run configure (same command as mentioned in the original bug):

loading cache ./config.cache
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for egrep... egrep
checking for a sed that does not truncate output... /usr/local/bin/sed
expr: syntax error
./configure: line 2333: test: =: unary operator expected
expr: syntax error
./configure: line 2339: test: =: unary operator expected
expr: syntax error
./configure: line 2346: test: =: unary operator expected
expr: syntax error
./configure: line 2339: test: =: unary operator expected
expr: syntax error
./configure: line 2346: test: =: unary operator expected
expr: syntax error
./configure: line 2339: test: =: unary operator expected
expr: syntax error
./configure: line 2346: test: =: unary operator expected
expr: syntax error
./configure: line 2339: test: =: unary operator expected
expr: syntax error
./configure: line 2346: test: =: unary operator expected
expr: syntax error
./configure: line 2339: test: =: unary operator expected
expr: syntax error
./configure: line 2346: test: =: unary operator expected
expr: syntax error
./configure: line 2339: test: =: unary operator expected
expr: syntax error
./configure: line 2346: test: =: unary operator expected
expr: syntax error
./configure: line 2339: test: =: unary operator expected
expr: syntax error
./configure: line 2346: test: =: unary operator expected
expr: syntax error
./configure: line 2339: test: =: unary operator expected
expr: syntax error
./configure: line 2346: test: =: unary operator expected
expr: syntax error
./configure: line 2339: test: =: unary operator expected
expr: syntax error
./configure: line 2346: test: =: unary operator expected
expr: syntax error
./configure: line 2339: test: =: unary operator expected
expr: syntax error
./configure: line 2346: test: =: unary operator expected


====

Then it continues on normally.  This problem looks like another problem I saw in the bug system, so I'll take a look around again for it.  The build was successful, so I'm inclined to not really care as much anymore :)  But if it's a real problem I'd like to help track it down all the same.
 [2006-12-15 09:59 UTC] tony2001@php.net
What kind of Bash are you using? What is the version #?
 [2006-12-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-03-13 15:23 UTC] v2 at petrov dot ks dot ua
Have same error when try to compile php-4.4.6

# ./configure
loading cache ./config.cache
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
expr: syntax error
./configure: test: =: unary operator expected
...




OS Red Hat 7.3

# bash --version
GNU bash, version 2.05a.0(1)-release (i686-pc-linux-gnu)
Copyright 2001 Free Software Foundation, Inc.

# expr --version
expr (GNU sh-utils) 2.0.11
Written by Mike Parker.
 [2007-06-12 09:49 UTC] aklx at ee dot cuhk dot edu dot hk
I had similar problem with php5.2.3 and php4.4.7. I was building php for my horde package and the following was observed when running configure(Sun Sparc Solaris 2.9):
# ./configure --prefix=/usr/local/php.5.23 
> --with-apxs=/usr/apache2/bin/apxs \
>   
> >> --with-gettext --with-dom \
> >> --with-iconv --enable-mbstring=all --enable-mbregex \ 
> >> --with-mysql=/usr/local/mysql
> >>     
> creating cache ./config.cache
> checking for Cygwin environment... no
> checking for mingw32 environment... no checking for egrep... egrep 
> checking for a sed that does not truncate output... /usr/local/bin/sed
> expr: syntax error
> ../configure: test: argument expected

I used gnu sed when I had the problem when using the Solairs sed.
 [2007-08-29 19:11 UTC] jd at cpanel dot net
Passing -- to mark the end of flags for expr doesn't work everywhere.

# expr --version | head -1                                                                                                                                     
expr (GNU coreutils) 5.2.1                                                                                                                                                          
# expr -- hello                                                                                                                                                
hello                                                                                                                                                                               

# expr --version | head -1                                                                                                                            
expr (GNU sh-utils) 2.0                                                                                                                                                             
# expr -- hello                                                                                                                                       
expr: syntax error
 [2007-08-29 19:38 UTC] jd at cpanel dot net
the expr info page suggests the expr tests in configure should be 
quoted with a leading space to avoid being interpreted as flags and 
remain as portable as possible:

diff -Nur php-5.2.3.orig/acinclude.m4 php-5.2.3/acinclude.m4
--- php-5.2.3.orig/acinclude.m4 2007-05-24 16:40:41.000000000 -0500
+++ php-5.2.3/acinclude.m4      2007-08-29 14:30:40.000000000 -0500
@@ -2504,20 +2504,20 @@
   done
 
   echo "'[$]0' \\" >> $1
-  if test `expr -- [$]0 : "'.*"` = 0; then
+  if test `expr " [$]0" : " '.*"` = 0; then
     CONFIGURE_COMMAND="$CONFIGURE_COMMAND '[$]0'"
   else 
     CONFIGURE_COMMAND="$CONFIGURE_COMMAND [$]0"
   fi
   for arg in $ac_configure_args; do
-     if test `expr -- $arg : "'.*"` = 0; then
-        if test `expr -- $arg : "--.*"` = 0; then
+     if test `expr " $arg" : " '.*"` = 0; then
+        if test `expr " $arg" : " --.*"` = 0; then
                  break;
         fi
         echo "'[$]arg' \\" >> $1
         CONFIGURE_COMMAND="$CONFIGURE_COMMAND '[$]arg'"
      else
-        if test `expr -- $arg : "'--.*"` = 0; then
+        if test `expr " $arg" : " '--.*"` = 0; then
                  break;
         fi
         echo "[$]arg \\" >> $1
 [2007-11-30 07:33 UTC] bill at bt-systems dot com
I encountered this problem on Solaris 10 x86 as well. My path specified /usr/ucb before /usr/bin. Apparently the version of expr in /usr/ucb is not compatible with PHP's configure script. Simply removing /usr/ucb from my path fixed the problem.
 [2016-07-19 14:32 UTC] strk at kbt dot io
Same syntax error with expr coming with BusyBox v1.24.2 (2016-06-23 08:49:16 GMT) multi-call binary.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 19:01:29 2024 UTC