Halton Huo wrote:
> Hi All,
> 
> I write a report on issues when porting OpenSource projects to
> Solaris/OpenSolaris.
> 
> The report link is:
> http://wikis.sun.com/display/SolarisDeveloper/Issues+when+porting+OpenSource+projects+to+Solaris

Thanks for collecting and sharing this information.

Some additional notes from our work on X.Org code:

- No support for GCC options: -Wall/-Werror/-Wl

  - Your sample patch just removes -Wall - the code integrated into X.Org
    upstream checks for the compiler in a configure macro to set either -v
    for Sun Studio or the -W flags for gcc:
   http://cgit.freedesktop.org/xorg/util/macros/tree/xorg-macros.m4.in#n436

- MMX/SSE intrinsic functions are not compatible

  - We hit this issue in X a while ago, and filed CR 6224421 with the compilers
    for it, which though closed as duplicate of another bug, they never fully
    addressed, and chose to remain at least partially incompatible with gcc in
    the type definitions in a way that breaks the Xorg MMX code.

    Our solution was to build the code that used it (the Xorg server) with gcc
    on x86, since the performance increase of being able to use the MMX code
    was significant.   (This code has since moved to libpixman, so we may be
    able to move Xorg server back to Sun Studio builds soon.)

- No definition for _FUNCTION_

  - You give workarounds that use glib's G_STRFUNC or use Sun Studio express.
    Our solution for non-glib code for Studio 12 is simply to use the C99
    equivalent version that Studio 12 already supports - for instance, in Mesa:
    http://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/main/glheader.h#n288

Like you, we've had to upstream multiple fixes already for some of these:
- No definition for u_int8_t/u_int16_t/u_int32_t/u_int64_t causes build failure
- libc printf(%s, NULL) segfaults
- Missing strcasestr() causes build failure

Other things we've had to fix that I didn't see in your list:
- No support in Sun compilers for gcc's __builtin_expect
  (Seems to be covered by compiler CR's 6603861 (C) & 6603858 (C++) )

  Solution for now:
#if (!defined(__GNUC__) || __GNUC__ < 3) && (!defined(__IBMC__) || __IBMC__ < 
900)
#  define __builtin_expect(x, y) x
#endif

- Needing to add -R flags to pkgconfig *.pc files & Makefiles for finding
  runtime libraries that aren't in /usr/lib

- Adding checks for Sun Studio's __i386__, __amd64__, & __sparc__ defines
  everywhere the code checks for gcc's __i386, __amd64, & __sparc defines

- No support for gcc's __volatile keyword.
  Solution:
+#ifdef __SUNPRO_C
+# if !defined(__volatile)
+#  define __volatile volatile
+# endif
+#endif

- Functions to get the name of the running program (used by some libraries
  in error messages).

  Solution: On Solaris, use basename(getexecname()) where BSD uses
  getprogname() & Linux uses program_invocation_short_name, as shown in:
http://cgit.freedesktop.org/mesa/mesa/tree/src/mesa/drivers/dri/common/xmlconfig.c#n51

- Different headers/names for byteswapping macros.

  Solution: Can either use platform-independent generic versions, such as:
    http://cgit.freedesktop.org/xorg/xserver/tree/glx/glxbyteorder.h
  or use Solaris <sys/byteorder.h> versions, as in:
http://cgit.freedesktop.org/xorg/lib/libpciaccess/tree/src/common_interface.c#n39

  I believe the <sys/byteorder.h> versions are somewhat optimized, due to
  CR 6729208: Optimize BSWAP_* and BE_* macros in sys/byteorder.h to use inline
amd64 assembly



-- 
        -Alan Coopersmith-           alan.coopersmith at sun.com
         Sun Microsystems, Inc. - X Window System Engineering


Reply via email to