Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-37209

Phonon-related link errors on OS X Mavericks

    XMLWordPrintable

Details

    • macOS

    Description

      Link errors occur when attempting to build Qt under OS X 10.9.2.
      Qt configured with:

      ./configure -release -arch "x86 x86_64"

      Qt source is latest from git.

      The error is this:

      g++ -headerpad_max_install_names -arch x86_64 -arch i386 -Xarch_x86_64 -mmacosx-version-min=10.5 -Xarch_x86_64 -mmacosx-version-min\
      =10.5 -Xarch_i386 -mmacosx-version-min=10.4 -o capabilities.app/Contents/MacOS/capabilities .obj/release-shared/window.o .obj/relea\
      se-shared/main.o .obj/release-shared/moc_window.o -F/tmp/qt/lib -L/tmp/qt/lib -framework phonon -L/tmp/qt/lib -F/tmp/qt/lib -fram\
      ework QtGui -framework QtCore
      Undefined symbols for architecture x86_64:
      "Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0>::qt_metacast(char const*)", referenced from:
      vtable for Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0> in window.o
      "Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0>::metaObject() const", referenced from:
      vtable for Phonon::ObjectDescriptionModel<(Phonon::ObjectDescriptionType)0> in window.o
      ld: symbol(s) not found for architecture x86_64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      make[3]: *** [capabilities.app/Contents/MacOS/capabilities] Error 1
      make[2]: *** [sub-capabilities-make_default-ordered] Error 2
      make[1]: *** [sub-phonon-make_default] Error 2
      make: *** [sub-examples-make_default-ordered] Error 2

      This appears to be due to changes in symbol export semantics. These are defined in src/3rdparty/phonon/phonon/objectdescriptionmodel.h:

      /* Required to ensure template class vtables are exported on both symbian
      and existing builds. */
      #if (defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)) || defined(Q_CC_CLANG)
      // RVCT compiler (2.2.686) requires the export declaration to be on the class to export vtables
      // MWC compiler works both ways
      // GCCE compiler is unknown (it can't compile QtCore yet)
      // Clang also requires the export declaration to be on the class to export vtables
      #define PHONON_TEMPLATE_CLASS_EXPORT PHONON_EXPORT
      #define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT
      #else
      // Windows builds (at least) do not support export declaration on templated class
      // But if you export a member function, the vtable is implicitly exported
      #define PHONON_TEMPLATE_CLASS_EXPORT
      #define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT PHONON_EXPORT
      #endif

      This flaw can be fixed by changing the above code to this:

      /* Required to ensure template class vtables are exported on both symbian
      and existing builds. */
      #if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT)
      // RVCT compiler (2.2.686) requires the export declaration to be on the class to export vtables
      // MWC compiler works both ways
      // GCCE compiler is unknown (it can't compile QtCore yet)
      // Clang also requires the export declaration to be on the class to export vtables
      #define PHONON_TEMPLATE_CLASS_EXPORT PHONON_EXPORT
      #define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT
      #elif defined(Q_CC_CLANG)
      #define PHONON_TEMPLATE_CLASS_EXPORT
      #define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT PHONON_EXPORT
      #else
      // Windows builds (at least) do not support export declaration on templated class
      // But if you export a member function, the vtable is implicitly exported
      #define PHONON_TEMPLATE_CLASS_EXPORT
      #define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT PHONON_EXPORT
      #endif

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            liaqi Liang Qi
            bovilexic Philip Schneider
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes