[kde-edu]: KDE_EXPORT in libkdeedu (long)

Jason Harris kstars at 30doradus.org
Tue Mar 8 21:07:27 CET 2005


Hello,

At work I am running KDE-3.3.1 and gcc-3.4.2 on Fedora Core 3.  I have noticed 
that with this combination, I cannot compile kdeedu from HEAD, because I get 
"visibility" errors in libkdeedu, due to the use of the "KDE_EXPORT" macro.

After some searching, I think I have narrowed down the problem.  In KDE-3.3.1, 
the kdemacros.h file contains:

#if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 > 2)
#define KDE_NO_EXPORT __attribute__ ((visibility("hidden")))
#define KDE_EXPORT __attribute__ ((visibility("visible")))
#else
#define KDE_NO_EXPORT
#define KDE_EXPORT
#endif

Whereas, it has since been changed to:

#if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 > 4)
/* Visibility is available for GCC newer than 3.4.
 * See: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9283 
 */
#define KDE_NO_EXPORT __attribute__ ((visibility("hidden")))
#define KDE_EXPORT __attribute__ ((visibility("default")))
#elif defined(Q_WS_WIN)
#define KDE_NO_EXPORT
#define KDE_EXPORT __declspec(dllexport)
#else
#define KDE_NO_EXPORT
#define KDE_EXPORT
#endif

So, KDE_EXPORT used to mean visibility="visible", and it now means 
visibility="default".  My compile error states that 'visibility must be one 
of "default",  "hidden", "protected" or "internal" ', because it's picking up 
the deprecated(?) "visible" definition of KDE_EXPORT.  

I have read that this is fixed in KDE-3.3.2, so maybe it isn't worth fixing 
and we should simply tell any users who complain about this to upgrade to 
3.3.2 or newer.  However, I have implemented a workaround in my local copies 
of libkdeedu/kdeeduplot and libkdeedu/extdate.  In pertinent header files, I 
placed the following:

#if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 > 3)
#define KSTARS_NO_EXPORT __attribute__ ((visibility("hidden")))
#define KSTARS_EXPORT __attribute__ ((visibility("default")))
#else 
#define KSTARS_NO_EXPORT KDE_NO_EXPORT
#define KSTARS_EXPORT KDE_EXPORT
#endif

and then replaced all instances of "KDE_EXPORT" with "KSTARS_EXPORT".  Note 
that this not only fixes the deprecated visibility flag ("visible" -> 
"default"), it also modifies the GNUC_MINOR check from ">4" to ">3".  I 
changed this because my GNUC_MINOR is not >4 (I have gcc-3.4.2), yet it knows 
about visibility.

Do you think it is worth applying a patch like this?  I would like my app to 
be usable by any version of KDE-3.3.x, not just >=KDE-3.3.2.  I believe this 
is the only issue preventing it.

Also, do you think that the GNUC_MINOR check in kdemacros is in error?  I 
don't know anything about this visibility stuff, all I know is what my 
gcc-3.4.2 compiler is telling me...

thanks,
Jason
-- 
-------------------------------
KStars: KDE Desktop Planetarium
http://edu.kde.org/kstars


More information about the kde-edu mailing list