GenerateExportHeader and clang

Alex Merry alex.merry at kde.org
Sun May 18 17:28:00 UTC 2014


On 18/05/14 17:50, Ivan Čukić wrote:
> Hi,
> 
> When compiling libraries that use GenerateExportHeader with clang 3.5.0, I'm 
> getting a library without any methods exported.
> 
> I'm using the same CMake invocation is as kdesrc-build does, only with
>  -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ \
>  -DCMAKE_C_COMPILER=/usr/local/bin/clang
> 
> GenerateExportHeader sets all macros to empty strings.
> 
> I've tested with a few different frameworks. Can anyone confirm this?

Nope, all looks fine to me when I build KCoreAddons. Configure output has:

-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success

The generated kcoreaddons_export.h is attached. Everything builds fine,
including the tests, so the exporting appears to work properly.

clang --version output:
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Alex

-------------- next part --------------

#ifndef KCOREADDONS_EXPORT_H
#define KCOREADDONS_EXPORT_H

#ifdef KCOREADDONS_STATIC_DEFINE
#  define KCOREADDONS_EXPORT
#  define KCOREADDONS_NO_EXPORT
#else
#  ifndef KCOREADDONS_EXPORT
#    ifdef KF5CoreAddons_EXPORTS
        /* We are building this library */
#      define KCOREADDONS_EXPORT __attribute__((visibility("default")))
#    else
        /* We are using this library */
#      define KCOREADDONS_EXPORT __attribute__((visibility("default")))
#    endif
#  endif

#  ifndef KCOREADDONS_NO_EXPORT
#    define KCOREADDONS_NO_EXPORT __attribute__((visibility("hidden")))
#  endif
#endif

#ifndef KCOREADDONS_DEPRECATED
#  define KCOREADDONS_DEPRECATED __attribute__ ((__deprecated__))
#endif

#ifndef KCOREADDONS_DEPRECATED_EXPORT
#  define KCOREADDONS_DEPRECATED_EXPORT KCOREADDONS_EXPORT KCOREADDONS_DEPRECATED
#endif

#ifndef KCOREADDONS_DEPRECATED_NO_EXPORT
#  define KCOREADDONS_DEPRECATED_NO_EXPORT KCOREADDONS_NO_EXPORT KCOREADDONS_DEPRECATED
#endif

#define DEFINE_NO_DEPRECATED 0
#if DEFINE_NO_DEPRECATED
# define KCOREADDONS_NO_DEPRECATED
#endif

#endif


More information about the Kde-frameworks-devel mailing list