Menu

#396 4.9.0 cannot build cairo

v1.0 (example)
closed-fixed
nobody
5
2015-02-14
2014-05-13
Wesley
No

I'm trying to build cairo 1.12.16 with MinGW-w64 4.9.0 sjlj win32 v3 r1.
When CCLDing cairo-test-suite.exe, it failed to find some references. But it's OK with the latest 4.8.2.
Here is the end of the log.


CC cairo-boilerplate-script.lo
CC cairo-boilerplate-ps.lo
CC cairo-boilerplate-pdf.lo
CC cairo-boilerplate-svg.lo
CC cairo-boilerplate-constructors.lo
CCLD any2ppm.exe
CCLD libcairoboilerplate.la
make[5]: Leaving directory /libs/cairo/cairo-1.12.16/boilerplate' CCLD cairo-test-suite.exe C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccOhvHvW.ltrans0.ltrans.o:ccOhvHvW.ltrans0.o:(.text+0x19ac): undefined reference tocairo_boilerplate_xasprintf'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccOhvHvW.ltrans0.ltrans.o:ccOhvHvW.ltrans0.o:(.text+0x19c6): undefined reference to cairo_boilerplate_xasprintf' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccOhvHvW.ltrans0.ltrans.o:ccOhvHvW.ltrans0.o:(.text+0x1adb): undefined reference tocairo_boilerplate_content_name'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccOhvHvW.ltrans0.ltrans.o:ccOhvHvW.ltrans0.o:(.text+0x1e23): undefined reference to cairo_boilerplate_content_name' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccOhvHvW.ltrans0.ltrans.o:ccOhvHvW.ltrans0.o:(.text+0x1e53): undefined reference tocairo_boilerplate_xasprintf'
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccOhvHvW.ltrans0.ltrans.o:ccOhvHvW.ltrans0.o:(.text+0x1f56): undefined reference to cairo_boilerplate_xasprintf' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccOhvHvW.ltrans0.ltrans.o:ccOhvHvW.ltrans0.o:(.text+0x1f8d): undefined reference tocairo_boilerplate_xasprintf'
C:/MinGW/bin/../lib/gcc/i686-w64-mingw32/4.9.0/../../../../i686-w64-mingw32/bin/ld.exe: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\ccOhvHvW.ltrans0.ltrans.o: bad reloc address 0x0 in section .data' collect2.exe: error: ld returned 1 exit status make[4]: *** [cairo-test-suite.exe] Error 1 make[4]: Leaving directory/libs/cairo/cairo-1.12.16/test'
make[3]: [all-recursive] Error 1
make[3]: Leaving directory /libs/cairo/cairo-1.12.16/test' make[2]: *** [all] Error 2 make[2]: Leaving directory/libs/cairo/cairo-1.12.16/test'
make[1]:
[all-recursive] Error 1
make[1]: Leaving directory `/libs/cairo/cairo-1.12.16'
make: *** [all] Error 2


I also found a problem of some one else.
http://autobuild.buildroot.org/results/7cb/7cb863398a55340ccb186714fdfaf4d365b5d298/build-end.log
It seems to be a bug of GCC 4.9.0 itself because of that guy is using Linux (on MicroBlazee). But in case of you know something about that.
Thank you.

Discussion

  • Gerrit M. Albrecht

    Same problem here. Since gcc 4.9.0 (MinGW-w64 i686-4.9.0-release-posix-dwarf-rt_v3-rev2) it doesn't build anymore. With the old 4.8.1 it worked well.

    in "build/test" directory:
    $ make cairo-test-suite.exe
    CCLD cairo-test-suite.exe
    D:\TEMP\ccSpJ2Er.ltrans0.ltrans.o:ccSpJ2Er.ltrans0.o:(.text.startup+0x15e1): undefined reference to _cairo_getopt' D:\TEMP\ccSpJ2Er.ltrans0.ltrans.o:ccSpJ2Er.ltrans0.o:(.text.startup+0x1ed5): undefined reference tocairo_boilerplate_content_name'
    d:/dev/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.9.0/../../../../i686-w64-mingw32/bin/ld.exe: D:\TEMP\ccSpJ2Er.ltrans0.ltrans.o: bad reloc address 0x1ed5 in section .text.startup' collect2.exe: error: ld returned 1 exit status Makefile:1498: recipe for targetcairo-test-suite.exe' failed
    make: *** [cairo-test-suite.exe] Error 1

    Here I've other missing dependencies, however, maybe it's the same reason.

    How to compile:

    First I've done a "make -n" to check the command line. It was hard to read because of some pages of .o files. They had to be removed first (reduced to *.o). I recognized, that there were two main() functions now. grep found: any2ppm-any2ppm.o. I removed the file (it's belongs to another exe): rm any2ppm*.o. Now the command line was short, but the error message was not gone...

    ../libtool --silent --tag=CC    --mode=link i686-w64-mingw32-gcc   -D_REENTRANT  -m32 -march=i686 -mtune=i686 -pipe -Wall -O2 -mms-bitfields  -m32 -pipe -L/open-egovernment/lib  -o cairo-test-suite.exe *.o -lpthread ../test/pdiff/libpdiff.la  ../boilerplate/libcairoboilerplate.la ../src/libcairo.la -lm
    

    I removed the missing dependencies by adding ../boilerplate/cairo-boiler
    plate*.o . The command line already contained libcairoboilerplate.la and the symbol is in the lib - why was it not found?

    Now there was a missing pdiff_compare. Okay, same again with pdiff/*.o. The new command line was:

    ../libtool --silent --tag=CC    --mode=link i686-w64-mingw32-gcc   -D_REENTRANT  -m32 -march=i686 -mtune=i686 -pipe -Wall -O2 -mms-bitfields  -m32 -pipe -L/open-egovernment/lib  -o cairo-test-suite.exe *.o ../boilerplate/cairo-boilerplate*.o -lpthread pdiff/*.o ../test/pdiff/libpdiff.la  ../boilerplate/libcairoboilerplate.la ../src/libcairo.la -lm
    

    and that linked well.

    The other exe files have the same linking problems. The .la file is given and it refers to the corresponding .a file but not all symbols could be found. Maybe because the new -flto flag causes libs which contain less information than the single object files. Do we want this? A workaround could be CFLAGS+=" -fno-lto " and then configure...

     

    Last edit: Gerrit M. Albrecht 2014-06-19
  • Alexandre Pereira Nunes

    It seems like a bug in cairo's own build scripts. By what I grasped, it seems like an unintented use of -flto, which is brough in when it shouldn't.

    As of gcc 4.9.0, -flto no longer implies the behavior of -ffat-lto-objects, i.e. -fno-fat-lto-objects is standard, so if the remaining Makefiles and such don't use the gcc wrappers around ar, ranlib & nm, hell may follow. Also, the weird code that forcibly enables lto doesn't imply -fuse-linker-plugin.

    Passing -fno-lto should suffice, tough what I'm trying to to is provide -ffat-lto-objects and -fuse-linker-plugin and see how far that goes.

     
  • Alexandre Pereira Nunes

    This worked:
    --- mingw64-x-cairo-1.12.14.orig/build/configure.ac.warnings
    +++ mingw64-x-cairo-1.12.14/build/configure.ac.warnings
    @@ -39,7 +39,7 @@ dnl options. Namely, the following:
    dnl -flto working really needs a test link, not just a compile

    safe_MAYBE_WARN="$MAYBE_WARN"
    -MAYBE_WARN="$MAYBE_WARN -flto"
    +MAYBE_WARN="$MAYBE_WARN -flto -ffat-lto-objects -fuse-linker-plugin"
    AC_TRY_LINK([],
    int main(int argc, char **argv) { return 0; }
    ,[],[
    --- mingw64-x-cairo-1.12.14.orig/configure
    +++ mingw64-x-cairo-1.12.14/configure
    @@ -18162,7 +18162,7 @@ MAYBE_WARN="$MAYBE_WARN -erroff=E_ENUM_T

    safe_MAYBE_WARN="$MAYBE_WARN"
    -MAYBE_WARN="$MAYBE_WARN -flto"
    +MAYBE_WARN="$MAYBE_WARN -flto -ffat-lto-objects -fuse-linker-plugin"
    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    / end confdefs.h. /

     
  • Kai Tietz

    Kai Tietz - 2015-01-20
    • status: open --> closed-fixed
     
  • Kai Tietz

    Kai Tietz - 2015-01-20

    Issue seems to be fixed by gcc for 5.x so I will close bug here. If bug remains to be present for newer gcc-versions, please report there. This bug seeems to be unrelated to mingw-w64 itself.

     

Log in to post a comment.