Bug 49669

Summary: 1.12.2 won't build on Solaris w/ Sun Studio cc. _cairo_unbounded_rectangle undefined symbol
Product: cairo Reporter: mark
Component: generalAssignee: Carl Worth <cworth>
Status: RESOLVED MOVED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: major    
Priority: medium    
Version: 1.12.2   
Hardware: SPARC   
OS: Solaris   
Whiteboard:
i915 platform: i915 features:

Description mark 2012-05-08 22:38:35 UTC
This root cause is likely the same as this bug
https://bugs.freedesktop.org/show_bug.cgi?id=48577

OS's:
SunOS host1 5.10 Generic_142901-13 i86pc i386 i86pc
SunOS host2 5.10 Generic_142909-17 sun4v sparc SUNW,T5240
SunOS host3 5.11 snv_134 i86pc i386 i86pc

Compilers:
cc: Sun C 5.11 SunOS_i386 145355-01 2010/10/11
cc: Sun C 5.11 SunOS_sparc 145354-01 2010/10/11
cc: Sun C 5.11 SunOS_i386 2010/08/13

This occurs for all of the above:

/bin/bash ../libtool  --tag=CC   --mode=link cc -xtarget=ultra -m64 -xcode=pic32  -L/usr/local/lib -I/usr/local/include -D_POSIX_PTHREAD_SEMANTICS  -I/usr/local/include -L/usr/local/lib -o cairo-analyse-trace cairo-analyse-trace.o cairo-error.o ../util/cairo-script/libcairo-script-interpreter.la ../util/cairo-missing/libcairo-missing.la libcairoperf.la ../boilerplate/libcairoboilerplate.la ../src/libcairo.la -lrt -lintl -lm
libtool: link: cc -xtarget=ultra -m64 -xcode=pic32 -I/usr/local/include -D_POSIX_PTHREAD_SEMANTICS -I/usr/local/include -o .libs/cairo-analyse-trace cairo-analyse-trace.o cairo-error.o  -L/usr/local/lib ../util/cairo-script/.libs/libcairo-script-interpreter.so ../util/cairo-missing/.libs/libcairo-missing.a ./.libs/libcairoperf.a ../boilerplate/.libs/libcairoboilerplate.a /var/tmp/cairo-1.12.2/src/.libs/libcairo.so -ldl ../src/.libs/libcairo.so /usr/local/lib/libpixman-1.so /usr/local/lib/libfontconfig.so /usr/local/lib/libexpat.so /usr/local/lib/libiconv.so /usr/local/lib/libfreetype.so -lbz2 /usr/local/lib/libpng14.so /usr/local/lib/libxcb-shm.so /usr/local/lib/libX11-xcb.so /usr/local/lib/libxcb-render.so /usr/local/lib/libXrender.so /usr/local/lib/libX11.so /usr/local/lib/libxcb.so /usr/local/lib/libXau.so /usr/local/lib/libXdmcp.so -lnsl -lsocket -lz -lrt /usr/local/lib/libintl.so -lc -lm -R/cairo/lib -R/usr/local/lib
ld: warning: file ../src/.libs/libcairo.so: linked to /var/tmp/cairo-1.12.2/src/.libs/libcairo.so: attempted multiple inclusion of file
Undefined                       first referenced
 symbol                             in file
_cairo_unbounded_rectangle          cairo-error.o  (symbol scope specifies local binding)
ld: fatal: Symbol referencing errors. No output written to .libs/cairo-analyse-trace
gmake[4]: *** [cairo-analyse-trace] Error 2
gmake[4]: Leaving directory `/var/tmp/cairo-1.12.2/perf'
gmake[3]: *** [all-recursive] Error 1
gmake[3]: Leaving directory `/var/tmp/cairo-1.12.2/perf'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/var/tmp/cairo-1.12.2/perf'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/var/tmp/cairo-1.12.2'
gmake: *** [all] Error 2
host2:/var/tmp/cairo-1.12.2 root#
Comment 1 Chris Wilson 2012-05-09 01:20:42 UTC
Different bug; still the same idiotic compiler. ;-)
Comment 2 Uli Schlachter 2012-05-09 01:32:00 UTC
Google suggests that -xO1 enables dead code optimization and makes the problem go away:
https://forums.oracle.com/forums/thread.jspa?threadID=2019321

To avoid having to fix this problem over and over again, can't we force optimization with sun CC? (and revert the earlier commit which splitted up includes into "-inline.h" and "-private.h")

@mark: Could you test if passing CFLAGS=-xO1 to configure really makes this problem go away?
Comment 3 mark 2013-08-26 05:39:48 UTC
The use of -xO1 resulted in another build error, during the `make install'. This was on X86 Solaris 10 and 11. On Solaris 10 SPARC it had the same issue.

The compiler is now Sun Studio 12.3, and the machines are quite patched up.

On Solaris 11 x86:

    setenv CC "cc -xc99 -xO1"
    setenv CXX "CC -xc99 -xO1"
    setenv CFLAGS "-L/usr/local/lib -I/usr/local/include"
    setenv CPPFLAGS "-I/usr/local/include"
    cd /var/tmp
    rm -rf /cairo cairo-1.12.14
    unxz -c /usr/local/src/graphics/cairo-1.12.14.tar.xz | tar -xvf -
    mkdir /cairo
    cd cairo-1.12.14
    ./configure --prefix=/cairo \
        --enable-xml \
        --enable-xlib-xcb \
        --disable-silent-rules \
        --with-x
    gmake
    gmake install

Making install in cairo-gobject
gmake[4]: Entering directory `/var/tmp/cairo-1.12.14/util/cairo-gobject'
gmake[5]: Entering directory `/var/tmp/cairo-1.12.14/util/cairo-gobject'
 ../../build/install-sh -c -d '/cairo/lib'
 /bin/sh ../../libtool   --mode=install /usr/local/bin/ginstall -c   libcairo-gobject.la '/cairo/lib'
libtool: install: warning: relinking `libcairo-gobject.la'
libtool: install: (cd /var/tmp/cairo-1.12.14/util/cairo-gobject; /bin/sh /var/tmp/cairo-1.12.14/libtool  --tag CC --mode=relink cc -xc99 -xO1 -D_REENTRANT -I/usr/local/include/pixman-1 -I/usr/local/include -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/local/include/libpng16 -I/usr/local/include -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -I/usr/local/include -I/usr/local/include -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -I/usr/local/include -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -I/usr/local/include -erroff=E_ENUM_TYPE_MISMATCH_ARG -erroff=E_ENUM_TYPE_MISMATCH_OP -Wp,-D_FORTIFY_SOURCE=2 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -L/usr/local/lib -I/usr/local/include -D_POSIX_PTHREAD_SEMANTICS -version-info 11202:14:11200 -no-undefined -o libcairo-gobject.la -rpath /cairo/lib libcairo_gobject_la-cairo-gobject-enums.lo libcairo_gobject_la-cairo-gobject-structs.lo ../../src/libcairo.la -L/usr/local/lib -lpixman-1 -L/usr/local/lib -lfontconfig -L/usr/local/lib -lfreetype -L/usr/local/lib -lpng16 -L/usr/local/lib -lxcb-shm -lxcb -L/usr/local/lib -lX11-xcb -lX11 -lxcb -L/usr/local/lib -lxcb-render -lxcb -L/usr/local/lib -lXrender -lX11 -L/usr/local/lib -lX11 -lXext -lz -lz -lz -L/usr/local/lib -lgobject-2.0 -lglib-2.0 -lintl -lrt -lm )
libtool: relink: cc -xc99 -xO1 -G -z defs -h libcairo-gobject.so.2 -o .libs/libcairo-gobject.so.2.11200.14  .libs/libcairo_gobject_la-cairo-gobject-enums.o .libs/libcairo_gobject_la-cairo-gobject-structs.o   -R/cairo/lib -R/usr/local/lib -L/usr/local/lib -L/cairo/lib -lcairo -lpixman-1 -lfontconfig -lfreetype -lpng16 -lxcb-shm -lX11-xcb -lxcb-render -lxcb -lXrender -lX11 -lXext -lz -lgobject-2.0 -lglib-2.0 -lintl -lrt -lm -lc   
Undefined                       first referenced
 symbol                             in file
cairo_region_destroy                .libs/libcairo_gobject_la-cairo-gobject-structs.o
cairo_device_reference              .libs/libcairo_gobject_la-cairo-gobject-structs.o
cairo_region_reference              .libs/libcairo_gobject_la-cairo-gobject-structs.o
cairo_device_destroy                .libs/libcairo_gobject_la-cairo-gobject-structs.o
ld: fatal: symbol referencing errors. No output written to .libs/libcairo-gobject.so.2.11200.14
libtool: install: error: relink `libcairo-gobject.la' with the above command before installing it
gmake[5]: *** [install-libLTLIBRARIES] Error 1
gmake[5]: Leaving directory `/var/tmp/cairo-1.12.14/util/cairo-gobject'
gmake[4]: *** [install-am] Error 2
gmake[4]: Leaving directory `/var/tmp/cairo-1.12.14/util/cairo-gobject'
gmake[3]: *** [install-recursive] Error 1
gmake[3]: Leaving directory `/var/tmp/cairo-1.12.14/util'
gmake[2]: *** [install] Error 2
gmake[2]: Leaving directory `/var/tmp/cairo-1.12.14/util'
gmake[1]: *** [install-recursive] Error 1
gmake[1]: Leaving directory `/var/tmp/cairo-1.12.14'
gmake: *** [install] Error 2
Comment 4 mark 2013-08-26 09:04:16 UTC
Ignore the cairo_region and cairo_device symbol cut-and-paste above, I neglected to pkgrm cairo 1.8.10 from the system first. Those libs were getting picked up during the install phase.

This URL however says -xO2 does the dead code cleanup so I'm using that instead.

http://docs.oracle.com/cd/E19205-01/819-5265/bjavm/index.html

The end status is -xO1/-xO2 will fix the issue and finish the compile on Solaris 10 & 11 Intel, but not Solaris 10 SPARC. `make check' passes most things on Solaris Intel except where GNU grep is assumed.

Digging into it:

/bin/bash ../libtool  --tag=CC   --mode=link cc -xtarget=ultra -m64 -xcode=pic32 -xc99 -xO2  -L/usr/local/lib -I/usr/local/include -D_POSIX_PTHREAD_SEMANTICS   -o libcairoperf.la  cairo-perf.lo cairo-perf-report.lo cairo-stats.lo cairo-time.lo   -lrt  -lm
libtool: link: ar cru .libs/libcairoperf.a .libs/cairo-perf.o .libs/cairo-perf-report.o .libs/cairo-stats.o .libs/cairo-time.o 
libtool: link: ranlib .libs/libcairoperf.a
libtool: link: ( cd ".libs" && rm -f "libcairoperf.la" && ln -s "../libcairoperf.la" "libcairoperf.la" )
/bin/bash ../libtool  --tag=CC   --mode=link cc -xtarget=ultra -m64 -xcode=pic32 -xc99 -xO2  -L/usr/local/lib -I/usr/local/include -D_POSIX_PTHREAD_SEMANTICS   -o cairo-analyse-trace cairo-analyse-trace.o cairo-error.o ../util/cairo-script/libcairo-script-interpreter.la ../util/cairo-missing/libcairo-missing.la libcairoperf.la ../boilerplate/libcairoboilerplate.la ../src/libcairo.la -lrt  -lm
libtool: link: cc -xtarget=ultra -m64 -xcode=pic32 -xc99 -xO2 -I/usr/local/include -D_POSIX_PTHREAD_SEMANTICS -o .libs/cairo-analyse-trace cairo-analyse-trace.o cairo-error.o  -L/usr/local/lib ../util/cairo-script/.libs/libcairo-script-interpreter.so ../util/cairo-missing/.libs/libcairo-missing.a ./.libs/libcairoperf.a ../boilerplate/.libs/libcairoboilerplate.a /var/tmp/cairo-1.12.14/src/.libs/libcairo.so -ldl ../src/.libs/libcairo.so /usr/local/lib/libpixman-1.so /usr/local/lib/libfontconfig.so -lbz2 /usr/local/lib/libexpat.so /usr/local/lib/libintl.so -lc /usr/local/lib/libiconv.so /usr/local/lib/libfreetype.so /usr/local/lib/libpng16.so -lcurses /usr/local/lib/libxcb-shm.so /usr/local/lib/libX11-xcb.so /usr/local/lib/libxcb-render.so /usr/local/lib/libXrender.so /usr/local/lib/libXext.so /usr/local/lib/libX11.so /usr/local/lib/libxcb.so /usr/local/lib/libXau.so /usr/local/lib/libXdmcp.so -lnsl -lsocket -lz -lrt -lm -R/cairo/lib -R/usr/local/lib
ld: warning: file ../src/.libs/libcairo.so: linked to /var/tmp/cairo-1.12.14/src/.libs/libcairo.so: attempted multiple inclusion of file
Undefined                       first referenced
 symbol                             in file
_cairo_unbounded_rectangle          cairo-error.o  (symbol scope specifies local binding)
ld: fatal: symbol referencing errors. No output written to .libs/cairo-analyse-trace
gmake[4]: *** [cairo-analyse-trace] Error 2
gmake[4]: Leaving directory `/var/tmp/cairo-1.12.14/perf'
gmake[3]: *** [all-recursive] Error 1
gmake[3]: Leaving directory `/var/tmp/cairo-1.12.14/perf'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/var/tmp/cairo-1.12.14/perf'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/var/tmp/cairo-1.12.14'
gmake: *** [all] Error 2


perf/.libs/libcairoperf.a[cairo-time.o]: [88]   |                   0|                  16|OBJT |GLOB |2    |UNDEF  |_cairo_unbounded_rectangle

./src/.libs/libcairo.a[cairo-rectangle.o]: [78] |                  20|                  16|OBJT |GLOB |2    |3      |_cairo_unbounded_rectangle

Putting /var/tmp/cairo-1.12.14/src/.libs/libcairo.a in the command above gives a functional linking.

This recipe now compiles everything:

    cd /var/tmp
    rm -rf cairo-1.12.14
    unxz -c /usr/local/src/graphics/cairo-1.12.14.tar.xz | tar -xvf -
    cd cairo-1.12.14
    ./configure --prefix=/usr/local \
        --enable-xml \
        --enable-xlib-xcb \
        --disable-silent-rules \
        --with-x
    gmake
    perl -pe "s#dependency_libs=\'#dependency_libs=\'../src/.libs/libcairo.a #" -i perf/libcairoperf.la
    gmake install

The dependency_lib mod above also removes the need for the -xO1/-xO2 compiler flag.
Comment 5 mark 2013-08-26 09:53:20 UTC
These are now on the Solaris Package Archive

http://www.ibiblio.org/pub/packages/solaris/sparc/

libcairo.1.12.14.SPARC.64bit.Solaris.10.pkg
libcairo.1.12.14.i86pc.Solaris.10.pkg
libcairo.1.12.14.i86pc.Solaris.11.pkg
pixman.0.30.2.SPARC.64bit.Solaris.10.pkg
pixman.0.30.2.i86pc.Solaris.10.pkg
pixman.0.30.2.i86pc.Solaris.11.pkg
Comment 6 GitLab Migration User 2018-08-25 14:01:24 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/313.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.