Menu

#437 Expat 2.0 does not build on Mac OS X 10.4 / intel

Test Required
closed-fixed
5
2014-08-12
2007-01-30
No

Installing expat 2.0.0 on Mac OS X (i386-apple-darwin8.8.2) fails with the following error:

/bin/sh ./libtool --silent --mode=compile gcc -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -o lib/xmlparse.lo -c lib/xmlparse.c
lib/xmlparse.c:77:2: error: #error memmove does not exist on this platform, nor is a substitute available
make: *** [lib/xmlparse.lo] Error 1

Output of configure script:

checking build system type... i686-apple-darwin8.8.2
checking host system type... i686-apple-darwin8.8.2
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for a sed that does not truncate output... /usr/bin/sed
checking for egrep... grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -p
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether accepts -g... no
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm -p output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common
checking if gcc PIC flag -fno-common works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin8.8.2 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common
checking if g++ PIC flag -fno-common works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin8.8.2 dyld
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ANSI C... (cached) none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether gcc accepts -fexceptions... yes
checking for ANSI C header files... (cached) yes
checking whether byte ordering is bigendian... no
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for memmove... no
checking for bcopy... no
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking for off_t... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for getpagesize... no
checking for working mmap... no
checking for an ANSI C99-conforming __func__... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating expat_config.h
config.status: expat_config.h is unchanged

Discussion

  • Elias Pipping

    Elias Pipping - 2007-05-02

    Logged In: YES
    user_id=1697847
    Originator: NO

    works fine on my mac (Mac OS X 10.4.9, i386-apple-darwin8.9.1, latest version from cvs, developer tools 2.4.1)

    /bin/sh ./libtool --silent --mode=compile gcc -std=gnu99 -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -o lib/xmlparse.lo -c lib/xmlparse.c
    /bin/sh ./libtool --silent --mode=compile gcc -std=gnu99 -I./lib -I. -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions -DHAVE_EXPAT_CONFIG_H -o lib/xmltok.lo -c lib/xmltok.c
    ...

     
  • Matthias Wiesmann

    Logged In: YES
    user_id=117374
    Originator: YES

    I am using Mac ports (MacPorts 1.320). I know that expat builds correctly on PPC machines, as I use it on my G4 Powerbook.

     
  • Elias Pipping

    Elias Pipping - 2007-05-02

    Logged In: YES
    user_id=1697847
    Originator: NO

    You might want to consider running a selfupdate via 'sudo port selfupdate' to get MacPorts 1.4.3. The portfile itself basically hasn't changed for nearly a year, but the base-code has (significantly).

    Also, make sure you have the latest version of the Developer Tools installed, (on an intel mac the output of 'gcc --version' should be: i686-apple-darwin8-gcc-4.0.1 ... build 5367)

     
  • Elias Pipping

    Elias Pipping - 2007-05-02

    Logged In: YES
    user_id=1697847
    Originator: NO

    > I am using Mac ports (MacPorts 1.320). I know that expat builds correctly
    > on PPC machines, as I use it on my G4 Powerbook.

    I'm on an intel mac, too (see above).

     
  • Sebastian Pipping

    Logged In: YES
    user_id=1022691
    Originator: NO

    wiesmann, please let us know if it was your
    build environment's fault so we know if we
    can close the bug. Thank you!

    Sebastian

     
  • Hazael

    Hazael - 2007-05-08

    Logged In: YES
    user_id=1788089
    Originator: NO

    I have the same problem on a combination of Mac OS X 10.4.9 + expat (Macport version) + Intel C/C++ Compiler fo Mac.

    I really don't know who this error concerns to but it seems it is related with the Intecl C/C++ compilers more than anything else. The problem arises because the configure script can not find memmove and bcopy. I have extracted the code generated by autoconf to test for the presence of memmove and tried to compile it with gcc and icc. GCC has not problems compiling it which as expected means that expat can be compiled with gcc without any trouble.

    However, ICC (Intel compiler) can not compile the code which means that the configure test will fail and memmove is considered as not present in the system which in turn triggers compilation errors.

    autoconf uses the following compiler options to compile the test code:

    icc -o conftest -Wall -Wmissing-prototypes -Wstrict-prototypes -fexceptions ac_check_memmove.c

    And according to my research -fexceptions is the option making icc to fail. According to gcc documentation the -fexceptions option can make gcc to link the code to libstdc++ even when it is not a C++ program. However, it seems that icc does not do the same and outputs the following messages:
    ac_check_memmove.c(49): warning #310: old-style parameter list (anachronism)
    char memmove ();
    ^

    ac_check_memmove.c(49): warning #1419: external declaration in primary source file
    char memmove ();
    ^

    ac_check_memmove.c(67): remark #111: statement is unreachable
    return 0;
    ^

    ld: Undefined symbols:
    ___gxx_personality_v0

    The undefined symbol ___gxx_personality_v0 is, not surprisely, found at the libstdc++ library which is automatically included by gcc (trigger by the -fexceptions option) but not included by icc. If the option -lstdc++ is given manually to icc then the compilation succeeds.

    I think this explains the error and a quick solution for compiling expat will be adding -lstdc++ to the LDFLAGS environment variable at configuration time.

    LDFLAGS="-lstdc++" ./configure --prefix=/path/to/

     
  • Karl Waclawek

    Karl Waclawek - 2007-05-08

    Logged In: YES
    user_id=290026
    Originator: NO

    Thanks for the nice analysis!

    Now, the question is (not being a Unix build expert), what can be done
    at the configuration level to deal with that in Expat?

     
  • Hazael

    Hazael - 2007-05-09

    Logged In: YES
    user_id=1788089
    Originator: NO

    Hi there

    I am not a UNIX build expert either but I think we can come up with some solutions. Let me explain:

    Firstly, I have already filed a report on the Intel Support Site and as of today they have updated the report with the following text:

    "Thank you for the detail report. I was able to reproduce the problem, and the issue have been escalated. I will update this issue after our investigation.

    Intel Customer Support"

    As you can see they have not given away so much information other that the report has been escalated (whatever that means in their system).

    Secondly, the main thing is that Intel wants its compiler to be 100% compatible with gcc so anyone can easily migrate from gcc to icc. For this particular option -fexceptions icc is failing to do so. The way icc interoperate with gcc is by sort of posing as a gcc compiler. icc predefined some macros that are predefined by gcc (__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) so icc can be seen as gcc.

    After looking at expat's configure.in I found the following code:

    if test "$GCC" = yes ; then
    dnl
    dnl Be careful about adding the -fexceptions option; some versions of
    dnl GCC don't support it and it causes extra warnings that are only
    dnl distracting; avoid.
    dnl
    OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
    CFLAGS="$OLDCFLAGS -fexceptions"
    AC_MSG_CHECKING(whether gcc accepts -fexceptions)
    AC_TRY_COMPILE(,(void)1,
    AC_MSG_RESULT(yes),
    AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
    fi

    This code checks if GCC is present (using $GCC which is set by macro AC_PROG_CC which tests for the presence of __GNUC__) and adds some compilation options including -fexceptions (BTW: it would be ideal to know why this option is given as someone has already said that it is not such a good idea). The Intel Manual advices to set CC to icc and when autoconf is used to generate the configure script AC_PROG_CC will set GCC=yes (because icc predefines __GNUC__) and also set leaves CC untouched (CC=icc) (as indicated in the autoconf 2.61 manual).

    The code above will execute as GCC=yes is true and because icc does accept the option -fexceptions (although it does not handle it as expected) therefore the -fexceptions option is added to CFLAGS which, according with the autoconf manual, is used when compiling or linking programs to test for C features.

    The latter brings up the question: Why is the CFLAGS variable being modified in configure.in? Was whoever added it expecting that the compilation options would be used to compile the sources or did he/she know that these compilation options would affect the compilation of the sources as well as programs to test for C features (configure)?

    To the best of my understanding if one wants to compile the sources (e.g. lib/xmlparse.c) with some specific options then those options are given in the Makefile.am (if automake is being used) located in the directory where the sources are. The presence of CFLAGS in the configure.in may be because expat is not using automake (as far as I can see). However, I believe CFLAGS can still be given somewhere else.

    Then, our first problem is that the programs to test for C features are failing (memmove, bcopy, etc.) when compiling with icc because CFLAGS contains the -fexceptions option. There are different ways to solve this:

    a. Replace the following code at configure.in:
    if test "$GCC" = yes ; then
    dnl
    dnl Be careful about adding the -fexceptions option; some versions of
    dnl GCC don't support it and it causes extra warnings that are only
    dnl distracting; avoid.
    dnl
    OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
    CFLAGS="$OLDCFLAGS -fexceptions"
    AC_MSG_CHECKING(whether gcc accepts -fexceptions)
    AC_TRY_COMPILE(,(void)1,
    AC_MSG_RESULT(yes),
    AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
    fi

    >> WITH <<

    if test "$GCC" = yes ; then
    dnl
    dnl Be careful about adding the -fexceptions option; some versions of
    dnl GCC don't support it and it causes extra warnings that are only
    dnl distracting; avoid.
    dnl
    OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
    CFLAGS="$OLDCFLAGS -fexceptions"
    AC_MSG_CHECKING(whether $CC accepts -fexceptions)
    AC_TRY_LINK( , ,
    AC_MSG_RESULT(yes),
    AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
    fi

    The only two lines that change are AC_MSG_CHECKING... and AC_TRY_COMPILE... which now is using the macro AC_TRY_LINK. The reason for this is that -fexceptions only makes the Intel compiler fails when linking and not when compiling. This is the reason why the -fexceptions options is added when icc is used. By changing AC_TRY_COMPILE to AC_TRY_LINK (which implies a AC_TRY_COMPILE) the test will fail when using -fexceptions and this will prevent the -fexceptions option to be added. Also this solution has backwards compatibility with other GCC versions and when Intel fixes icc the -fexceptions option will be added as it would be supported.

    b. This solution involves to make a proper distinction between icc and gcc regarding the effords of icc to be seen as gcc. The line:
    if test "$GCC" = yes ; then

    can be changed for something that makes sure that the compiler is truly the gcc and not something else. One way would be to check is the __INTEL_COMPILER__ macro is defined. Then if this macro is defined and GCC = yes then we know that it is not the gcc compiler but something that is compatible.

    You folks are the right people to decide which way to go as you know the reasons why expat does not use automake, why -fexceptions is needed, etc.

    I have tried solution (a) and it worked fine on my system (of course I had to run autoconf after changing configure.in so that configure was updated) without any further changes. The configure script detects icc as my default compiler, identifies the -fexceptions option as NOT supported by icc and, finally, finds memmove and bcopy.

    Regards

     
  • Karl Waclawek

    Karl Waclawek - 2007-05-09

    Logged In: YES
    user_id=290026
    Originator: NO

    Thanks again for you exemplary feedback!

    > This code checks if GCC is present (using $GCC which is set by
    > macro AC_PROG_CC which tests for the presence of __GNUC__) and
    > adds some compilation options including -fexceptions
    > (BTW: it would be ideal to know why this option is given as\ > someone has already said that it is not such a good idea).

    I think the reason it to better interoperate with call-backs
    that throw exceptions, so that the exceptions can pass though
    to the original caller of XML_Parse(). Expat is called from other
    languages as well!

    > The latter brings up the question: Why is the CFLAGS variable
    > being modified in configure.in? Was whoever added it expecting
    > that the compilation options would be used to compile the sources
    > or did he/she know that these compilation options would affect
    > the compilation of the sources as well as programs to test for
    > C features (configure)?

    The CFLags can be modified as arguments to configure in order to
    build the UTF-16 version of Expat (libexpatw.so/dll). (see README).

    We are not using automake, because our main build expert (Greg Stein)
    has too many bad experiences with it, and for Expat he considers
    it overkill.

    I prefer your first fix option, and have applied it to
    configure.in rev. 1.45.

    Needs testing on other platforms.

     
  • Karl Waclawek

    Karl Waclawek - 2007-05-09
    • milestone: --> Test Required
    • status: open --> open-fixed
     
  • Matthias Wiesmann

    Logged In: YES
    user_id=117374
    Originator: YES

    I dont' think the problem is related to the build environnement. I have basically the same environnement (MacPorts 1.440) on a PPC PowerBook and an Intel Macbook. Expat builds fine on the PPC and fails on the Intel. The fact that the same problem arises with both ICC and GCC would indicate to me that configure has trouble with Darwin/Intel.

    I have attached the config.log file to this report.
    File Added: config.log

     
  • Matthias Wiesmann

    Config.log for expat compilation on Darwin/Intel with MacPorts

     
  • Karl Waclawek

    Karl Waclawek - 2007-05-09

    Logged In: YES
    user_id=290026
    Originator: NO

    Matthias,

    have you tried the latest configure.in from CVS?
    Just to make sure this didn't fix your problem.

     
  • Sebastian Pipping

    Logged In: YES
    user_id=1022691
    Originator: NO

    Matthias, is this issue still valid?

     
  • Karl Waclawek

    Karl Waclawek - 2012-03-03
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.