https://bugs.kde.org/show_bug.cgi?id=401018

            Bug ID: 401018
           Summary: Visibility problems with Apple's Xcode/clang compilers
           Product: extra-cmake-modules
           Version: unspecified
          Platform: Compiled Sources
                OS: OS X
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: ecm-bugs-n...@kde.org
          Reporter: rjvber...@gmail.com
  Target Milestone: ---

There appears to be something different with Apple's clang compilers from Xcode
(AppleClang) which can cause problems when building with hidden symbol
visibility. Link failures will arise in certain projects because symbols (from
libraries built by the same project) that should be visible but are not.
Sometimes the issue occurs only on newer OS versions (I can build
kde4-workspace with AppleClang on OS X 10.9 but the build fails with missing
symbols on 10.13 and up).

An example where this started happening recently: libkcddb . This fails to link
with AppleClang, not just on my ageing 10.9.5 system but also on an up-to-date
10.13 system. I'll be attaching full build logs, but here's the link error:

/usr/bin/clang++  -std=c++0x -fno-operator-names -fno-exceptions
-DQT_NO_EXCEPTIONS -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra
-Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith
-Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla
-pedantic -Wzero-as-null-pointer-constant -bundle
-Wl,-headerpad_max_install_names -multiply_defined suppress  -o kcm_cddb.so
CMakeFiles/kcm_cddb.dir/cddbconfigwidget.cpp.o
CMakeFiles/kcm_cddb.dir/kcmcddb.cpp.o
CMakeFiles/kcm_cddb.dir/kcm_cddb_autogen/mocs_compilation.cpp.o
/opt/local/lib/libKF5KIOWidgets.5.47.0.dylib ../libkcddb/libKF5Cddb.5.0.0.dylib
/opt/local/lib/libKF5ConfigWidgets.5.47.0.dylib
/opt/local/lib/libKF5JobWidgets.5.47.0.dylib
/opt/local/lib/libKF5Completion.5.47.0.dylib
/opt/local/lib/libKF5WidgetsAddons.5.47.0.dylib
/opt/local/lib/libKF5KIOCore.5.47.0.dylib
/opt/local/lib/libKF5Auth.5.47.0.dylib
/opt/local/libexec/qt5/Library/Frameworks/QtWidgets.framework/QtWidgets
/opt/local/lib/libKF5Service.5.47.0.dylib
/opt/local/lib/libKF5I18n.5.47.0.dylib
/opt/local/lib/libKF5CoreAddons.5.47.0.dylib
/opt/local/libexec/qt5/Library/Frameworks/QtConcurrent.framework/QtConcurrent
/opt/local/libexec/qt5/Library/Frameworks/QtDBus.framework/QtDBus
/opt/local/lib/libKF5Codecs.5.47.0.dylib
/opt/local/lib/libKF5ConfigGui.5.47.0.dylib
/opt/local/libexec/qt5/Library/Frameworks/QtGui.framework/QtGui
/opt/local/libexec/qt5/Library/Frameworks/QtXml.framework/QtXml
/opt/local/lib/libKF5ConfigCore.5.47.0.dylib
/opt/local/libexec/qt5/Library/Frameworks/QtNetwork.framework/QtNetwork
/opt/local/libexec/qt5/Library/Frameworks/QtCore.framework/QtCore 
Undefined symbols for architecture x86_64:
  "ConfigBase::setFreedbSubmitTransport(int)", referenced from:
      CDDBModule::checkSettings() const in kcmcddb.cpp.o
  "ConfigBase::~ConfigBase()", referenced from:
      KCDDB::Config::~Config() in kcmcddb.cpp.o
  "KCDDB::Sites::siteList()", referenced from:
      CDDBConfigWidget::showMirrorList() in cddbconfigwidget.cpp.o
  "KCDDB::Sites::Sites()", referenced from:
      CDDBConfigWidget::showMirrorList() in cddbconfigwidget.cpp.o
  "KCDDB::Config::Config()", referenced from:
      CDDBModule::CDDBModule(QWidget*, QList<QVariant> const&) in kcmcddb.cpp.o
      CDDBModule::defaults() in kcmcddb.cpp.o
      CDDBModule::checkSettings() const in kcmcddb.cpp.o
      CDDBModule::load() in kcmcddb.cpp.o
  "ConfigBase::emailAddress() const", referenced from:
      CDDBModule::checkSettings() const in kcmcddb.cpp.o
  "ConfigBase::smtpHostname() const", referenced from:
      CDDBModule::checkSettings() const in kcmcddb.cpp.o
  "ConfigBase::smtpUsername() const", referenced from:
      CDDBModule::updateWidgetsFromConfig(KCDDB::Config const&) in
kcmcddb.cpp.o
  "ConfigBase::freedbSubmitTransport() const", referenced from:
      CDDBModule::checkSettings() const in kcmcddb.cpp.o
  "ConfigBase::replyTo() const", referenced from:
      CDDBModule::checkSettings() const in kcmcddb.cpp.o
ld: symbol(s) not found for architecture x86_64

This error goes away when using a stock clang compiler, for instance clang-4.0
or clang-5.0 from MacPorts.

The symbols in question are defined in sites.cpp and in the autogenerated
configbase.cpp (auto-generated files are identical for the different compilers
I tested).

Looking at the build logs there are no differences in the compiler arguments
between the various builds, other than in the build directory path. Yet the
Sites::siteList() symbol is visible in the build by stock clang (5.0.2) and not
in the one by AppleClang:

000000000001bdc0 T __ZN5KCDDB5Sites8siteListEv
vs.
000000000001bc80 t __ZN5KCDDB5Sites8siteListEv

I have only seen this with KDE code for now, never elsewhere.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to