[GRASS-dev] build problems on Mac OS X 10.5.2.

Glynn Clements glynn at gclements.plus.com
Sun May 11 00:57:59 EDT 2008


John Kern wrote:

> I am trying to build Grass from source on Leopard(Mac OS X 10.5.2 with  
> gcc 4.0.1).
> 
> While PROJ.4 built and installed without problem,  configure failed  
> for GRASS proper. The resulting error is ...
> "checking External PROJ.4 version... configure: error: *** Could not  
> determine External PROJ.4 version."
> 
> Consider this line from the trace output of the configure script.
> 
> + eval echo configure:6910: '"${CC-cc}' -o conftest '$CFLAGS'  
> '$CPPFLAGS' '$LDFLAGS' 'conftest.$ac_ext' '$LIBS' '1>&5"'
> ++ echo configure:6910: 'gcc -o conftest.dSYM -g -O2      conftest.c   
> 1>&5'
> 
> The dSYM file extension on the output file is the critical bit. If the  
> output file ends with a dSYM file extension, only supporting data is  
> generated. No executable. (see example below). I worked around the  
> problem by deleting references to ${ac_exeext}.  What's the right fix  
> for the configure script? Apparently there is a supporting script to  
> autoconf which needs to be updated, right?

It's autoconf's AC_EXEEXT macro which is the problem. It attempts to
determine the executable suffix automatically, with the following
code:

: echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
: echo "configure:1009: checking for executable suffix" >&5
: 
: if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
:   ac_cv_exeext=.exe
: else
:   rm -f conftest*
:   echo 'int main () { return 0; }' > conftest.$ac_ext
:   ac_cv_exeext=
:   if { (eval echo configure:1017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
:     for file in conftest.*; do
:       case $file in
:       *.$ac_ext | *.c | *.o | *.obj) ;;
:       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
:       esac
:     done
:   else
:     { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
:   fi
:   rm -f conftest*
:   test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
: fi
: 
: EXEEXT=""
: test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
: echo "$ac_t""${ac_cv_exeext}" 1>&6
: ac_exeext=$EXEEXT

Essentially, it deletes conftest.*, compiles and links a test program
named "conftest", then searches for any files matching conftest.*
whose extension isn't recognised as an intermediate file. If any such
file exists, it is assumed to be the executable, and its suffix is
treated as the executable suffix.

Clearly this fails if linking produces any unexpected files, such as
conftest.dSYM (which presumably contains debug symbols).

We should probably eliminate the use of that macro in favour of a
simple "if cygwin or mingw then .exe else nothing" test. I don't know
of any other supported platform where executables have a suffix.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list