Project

General

Profile

Bug #714

problem compiling with Sun Studio - visibility

Added by Pavel Heimlich over 11 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
not-a-bug
Target version:
Start date:
23 Jul 2010
Due date:
% Done:

100%

Estimated time:

Description

On OpenSolaris b134 with the Sun Studio 12u1 compiler, the build of exiv2 0.20 fails with
...
"error.hpp", line 97: Error: Identifier expected instead of "__attribute__".

This is because the use of attribute ((visibility(x)) is not part of the C++ standard, it's gcc specific and not supported by sun studio.

The attached patch worked for me.

reference:
http://gcc.gnu.org/wiki/Visibility
http://wikis.sun.com/display/SunStudio/Using+Sun+Studio+for+open+source+apps


Files

exiv2-visibility.diff (976 Bytes) exiv2-visibility.diff patch Pavel Heimlich, 23 Jul 2010 14:29
exiv2-visibility.diff (519 Bytes) exiv2-visibility.diff patch Pavel Heimlich, 31 Jan 2012 13:39

Related issues

Related to Exiv2 - Feature #536: Switch to a unified build system based on cmakeClosed

Actions
Related to Exiv2 - Bug #710: Problems Compiling Exiv2 Under SGI IRIXClosed29 Jun 2010

Actions
Related to Exiv2 - Bug #715: -funsigned-char breaks build with Sun StudioClosed23 Jul 2010

Actions

Associated revisions

Revision 2300 (diff)
Added by Andreas Huggel over 11 years ago

#714: Extended C++ symbol visibility support for Sun Studio C++ compiler.

History

#1

Updated by Andreas Huggel over 11 years ago

Hi Pavel,

Thanks for reporting this issue. Assuming you configure your system with the ./configure script, for the patch to have any effect, the EXV_HAVE_GXXCLASSVISIBILITY compiler define must be set. That's the case if the visibility support is not explicitely disabled with the --disable-visibility configure option and if the compiler has a -fvisibility-inlines-hidden option (see below).

Does the Sun compiler indeed have this option?

AC_MSG_CHECKING([whether to enable g++ visibility support])
AC_ARG_ENABLE(visibility,
    [  --disable-visibility    do not use g++ visibility support ],
    GXX_VISIBILITY=$enableval, GXX_VISIBILITY=yes)
AC_MSG_RESULT($GXX_VISIBILITY)
if test "$GXX_VISIBILITY" = "yes"; then
    AX_CXX_CHECK_FLAG(-fvisibility-inlines-hidden,[],[],[GXX_VISIBILITY=yes],[GXX_VISIBILITY=no])
    if test "$GXX_VISIBILITY" = "yes"; then
        CXXFLAGS="${CXXFLAGS} -fvisibility=hidden -fvisibility-inlines-hidden" 
        AC_DEFINE(HAVE_GXXCLASSVISIBILITY,1)
    fi
    if test "$enable_shared" = "yes"; then
        AC_DEFINE(HAVE_DLL)
    fi
fi
#2

Updated by Pavel Heimlich over 11 years ago

Hi,
studio does not have the -fvisibility* options, however it may ignore them, so I guess that's how the HAVE_GXXCLASSVISIBILITY parameter got enabled.
The equivalent flag to fvisibility-hidden is -xldscope=hidden
see
http://forums.sun.com/thread.jspa?threadID=5404019
http://docs.sun.com/app/docs/doc/820-7599/bkbda?a=view

from what I gathered, -fvisibility-inlines-hidden does not have an equivalent in Studio

#3

Updated by Andreas Huggel over 11 years ago

  • Category set to build
  • Target version set to 0.21
  • % Done changed from 0 to 50

Checked-in generalized visibility support which should now also work with the Sun Studio compiler. It sets the compiler defines according to the patch and sets the -xldscope=hidden flag if supported.

Appreciate if you can test this and let me know if it works.

Thanks,
Andreas

PS: This also needs to be implemented in the cmake build scripts.

#4

Updated by Andreas Huggel almost 11 years ago

  • Target version deleted (0.21)
#5

Updated by Andreas Huggel almost 11 years ago

  • Target version set to 1.0
#6

Updated by Pavel Heimlich almost 10 years ago

I tried v0.22 with Solaris11 and Solaris Studio 12.3 and the Studio detection code is incomplete.
First, it only works for the C compiler (cc defines __SUNPRO_C, CC defines __SUNPRO_CC).
Second, the version condition is not really necessary as all currently supported (and available for download) Studio versions do support __global.

I had to use the attached patch to build exiv2 0.22

#7

Updated by Robin Mills about 6 years ago

  • Category changed from build to not-a-bug
  • Status changed from New to Closed
  • Assignee set to Robin Mills
  • Target version changed from 1.0 to 0.26

This is an unsupported compiler. Please see the comments in #710 concerning compiler and platform support.

#8

Updated by Robin Mills about 6 years ago

  • % Done changed from 50 to 100

Also available in: Atom PDF