Qt
  1. Qt
  2. QTBUG-37209

Phonon-related link errors on OS X Mavericks

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: P1: Critical P1: Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.8.5, 4.8.6
    • Fix Version/s: 4.8.7
    • Component/s: (Inactive) Phonon
    • Environment:

      OS X 10.9.2
      Xcode 5.0.2
      Late 2013 iMac

      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

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

        Activity

        Hide
        Liang Qi added a comment -

        I have tried qt 0315971ee951e9abe7f288564ddf2e81aeed1fd8 on 10.9.1, can't reproduce the link error.

        $ g++ -v
        Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
        Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
        Target: x86_64-apple-darwin13.1.0
        Thread model: posix
        
        Show
        Liang Qi added a comment - I have tried qt 0315971ee951e9abe7f288564ddf2e81aeed1fd8 on 10.9.1, can't reproduce the link error. $ g++ -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.1.0 Thread model: posix
        Hide
        edoardo added a comment -

        i got the same problem with os x mavericks and building qt without homebrew. i tryed with xcode 5.0.2 and 5.1 hopefully i found that fix that work perfectly!!!
        really tnx i can go on building pyside

        Show
        edoardo added a comment - i got the same problem with os x mavericks and building qt without homebrew. i tryed with xcode 5.0.2 and 5.1 hopefully i found that fix that work perfectly!!! really tnx i can go on building pyside
        Hide
        Liang Qi added a comment -

        Tested with f1b76c126c476c155af8c404b97c42cd1a709333 on 10.9.2, phonon build fine, and examples/phonon/qmusicplayer works for me.

        Show
        Liang Qi added a comment - Tested with f1b76c126c476c155af8c404b97c42cd1a709333 on 10.9.2, phonon build fine, and examples/phonon/qmusicplayer works for me.
        Hide
        Roland Rabien added a comment -

        Same issue
        Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
        Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
        Target: x86_64-apple-darwin13.4.0
        Thread model: posix

        OS X 10.9.5

        Building latest code from git Oct 21st, 2014

        Show
        Roland Rabien added a comment - Same issue Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) Target: x86_64-apple-darwin13.4.0 Thread model: posix OS X 10.9.5 Building latest code from git Oct 21st, 2014
        Hide
        Jeremy Friesner added a comment -

        FYI, I just encountered this error while compiling Qt 4.8.7 (using "./configure; make -j 8") on a Late-2014 Mac Mini running OS/X 10.10.1 with Xcode 6.1.1 (6A2008a) installed). Applying the patch included in the opening description of this case cleared the error for me.

        Show
        Jeremy Friesner added a comment - FYI, I just encountered this error while compiling Qt 4.8.7 (using "./configure; make -j 8") on a Late-2014 Mac Mini running OS/X 10.10.1 with Xcode 6.1.1 (6A2008a) installed). Applying the patch included in the opening description of this case cleared the error for me.

          People

          • Assignee:
            Liang Qi
            Reporter:
            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