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

Qt5QuickTest should not be linked in iOS target for non-unit test program

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.9
    • 5.5.0
    • QPA
    • None
    • iOS , XCode 7
    • iOS/tvOS/watchOS

    Description

      The Problem: Qt5QuickTest is linked in iOS build target for non-unit test program.

      Qt Version : 5.5.0
      Platform: iOS
      Host: Mac with XCode 7

      An example program is attached. It is modified based on Qt's example code. You may extract and reproduce the problem by following steps.

      Steps:

      1. Open draganddrop project in Qt Creator

      2. Change target to "iphoneos-clang Qt 5.5.0 for iOS"

      3. Build. Then it will be failed with following messages:

      Undefined symbols for architecture armv7:
      "OBJC_METACLASS$_XCTestCase", referenced from:
      OBJC_METACLASS$_QtTestLibWrapper in libQt5Test_debug.a(qxctestlogger.o)
      OBJC_METACLASS$_QtTestLibTest in libQt5Test_debug.a(qxctestlogger.o)
      "OBJC_CLASS$_XCTestDriver", referenced from:
      objc-class-ref in libQt5Test_debug.a(qxctestlogger.o)
      "OBJC_CLASS$_XCTestCase", referenced from:
      OBJC_CLASS$_QtTestLibWrapper in libQt5Test_debug.a(qxctestlogger.o)
      OBJC_CLASS$_QtTestLibTest in libQt5Test_debug.a(qxctestlogger.o)
      "OBJC_CLASS$_XCTestSuite", referenced from:
      objc-class-ref in libQt5Test_debug.a(qxctestlogger.o)
      OBJC_CLASS$_QtTestLibTests in libQt5Test_debug.a(qxctestlogger.o)
      "OBJC_METACLASS$_XCTestSuite", referenced from:
      OBJC_METACLASS$_QtTestLibTests in libQt5Test_debug.a(qxctestlogger.o)
      "OBJC_CLASS$_XCTestProbe", referenced from:
      objc-class-ref in libQt5Test_debug.a(qxctestlogger.o)

      You won't even find any keyword like "testlib" or "qmltest" in draganddrop.pro , but option of "-lQt5QuickTest_debug" is added in build script.

      If you switch target to Desktop or downgrade to Qt 5.4.1, it won't have this problem.

      The problem is in fact caused by a file called draganddrop/libs/test_Dummy.qml within the source tree. It is not included by any pro / qrc file. It is just placed there without any function.

      However, I guess qmlimportscanner still treat this file as a part of my program, then build script add "-lQt5QuickTest_debug" to CXXFLAGS.

      It should not be an expected behaviour. Since user may add 3rd party library in source tree and those library may have their own test program. Build script should not link Qt5QuickTest automatically.

      Attachments

        1. bug.zip
          44 kB
          Ben Lau
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vestbo Tor Arne Vestbø
            benlau Ben Lau
            Votes:
            7 Vote for this issue
            Watchers:
            15 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes