Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. mac: attempt to add "QT += sql" causes build error?
Forum Updated to NodeBB v4.3 + New Features

mac: attempt to add "QT += sql" causes build error?

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 4 Posters 3.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    davecotter
    wrote on last edited by davecotter
    #3

    if by "deploy" you mean "when i run macdeployqt" then the answer is yes, it's at that time i get the errors, the build itself succeeds.

    i have to run macdeployqt even for the debug build cuz if i don't the app won't run (i depend on boost threads, system, and other stuff, which macdeployqt handles)

    in looking at the doc for macdeployqt, i see no mention of selecting which SQL plugin you are using

    how do i suppress these errors? cuz it means i can't just "run to debug", i have to click the "yes i don't care about that error you think you saw" dialog button

    jsulmJ 1 Reply Last reply
    0
    • D davecotter

      if by "deploy" you mean "when i run macdeployqt" then the answer is yes, it's at that time i get the errors, the build itself succeeds.

      i have to run macdeployqt even for the debug build cuz if i don't the app won't run (i depend on boost threads, system, and other stuff, which macdeployqt handles)

      in looking at the doc for macdeployqt, i see no mention of selecting which SQL plugin you are using

      how do i suppress these errors? cuz it means i can't just "run to debug", i have to click the "yes i don't care about that error you think you saw" dialog button

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @davecotter I don't know whether you can suppress these errors.
      Needing debug build to deploy the app sounds wrong. It should run in release build. What exactly does not work if you deploy a release build?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        davecotter
        wrote on last edited by
        #5
        dyld: Library not loaded: libboost_system.dylib
          Referenced from: <path>/kJams 2 Debug.app/Contents/MacOS/kJams 2 Debug
          Reason: no suitable image found.  Did find:
        	/usr/local/lib/libboost_system.dylib: mach-o, but wrong architecture
        

        but we digress. does anyone have answers regarding the original topic?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #6

          Hi,

          You currently can't select which plugin is deployed.

          You are talking about a build error. What exactly is it ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • D Offline
            D Offline
            davecotter
            wrote on last edited by davecotter
            #7

            this is the error i'm talking about:

            @davecotter said in mac: attempt to add "QT += sql" causes build error?:

            ERROR: no file at "/usr/local/mysql/lib/libmysqlclient.20.dylib"
            ERROR: no file at "/usr/local/opt/libiodbc/lib/libiodbc.2.dylib"
            ERROR: no file at "/Applications/Postgres.app/Contents/Versions/9.6/lib/libpq.5.dylib"

            perhaps this is more correctly called a "deployment error" ?

            anyway, can that be suppressed? because if not, i always get this dialog, which is totally interrupting my flow: (and i note it actually does say "build error" hence my confusion)
            0_1551298965327_Screen Shot 2019-02-27 at 12.22.35 PM.png

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #8

              Pretty strange, never saw that kind of error. All these libraries are related to the plugins and thus should not even appear in the build phase.

              Can you find at which point they happen in the build process ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • D Offline
                D Offline
                davecotter
                wrote on last edited by
                #9

                sorry, they are not in the build phase, they are in the deploy phase. when i call "macdeployqt" that is when the errors come up. how can i suppress the (non) errors,so i don't get that dialog?

                thanks for your help!! :D

                jsulmJ 1 Reply Last reply
                0
                • D davecotter

                  sorry, they are not in the build phase, they are in the deploy phase. when i call "macdeployqt" that is when the errors come up. how can i suppress the (non) errors,so i don't get that dialog?

                  thanks for your help!! :D

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by jsulm
                  #10

                  @davecotter As workaround (not actual solution) you could put some libs at those locations mentioned in the error messages and rename them accordingly.
                  You also can file a change request for the macdeployqt so the devs add the possibility to define the libs you want to deploy (or don't want to deploy).

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    davecotter
                    wrote on last edited by davecotter
                    #11

                    I have gathered the libs and put them all in a folder and then passed the path to that folder into macdepolyqt via "-libpath=...", but i still get the same problem.

                    it's not a solution to force all developers to install these libs into their dev machines into the expected directories, just to get around this bug, and yes this is definitely a bug from what i can see. macdeployqt has no business looking for a particular Application in the user's Applications folder, to find a library, right?

                    does anyone have any other ideas what's wrong?

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      davecotter
                      wrote on last edited by
                      #12

                      i'm gathering by lack of response that this may in fact be a bug?

                      note that adding "-verbose=0" to the macdeployqt command DOES NOT suppress the message, even though it's documented to suppress all messages. THAT certainly seems like a bug?

                      yes?

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #13

                        I couldn't reproduce this issue.

                        What version of Qt are you using ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          davecotter
                          wrote on last edited by
                          #14

                          creator 4.8.2, building with 5.12.1

                          are you calling macdeployqt as part of the build (so you see its messages in the console) and doing it for the debug config?

                          note that my post build step just calls a python script, it's the python script that calls madceployqt, if that changes anything. i'm also linking in boost::threads (etc) during this phase as well, if that is relevant.

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #15

                            No, I'm doing it from the command line for both debug and release.

                            Can you share your python script ?
                            How exactly are you calling it ?

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              davecotter
                              wrote on last edited by davecotter
                              #16

                              my script is part of a complex post build system, so i doubt it will shed light for you but here it a very small section of it:

                              def qt_deploy(qtDir, buildType, bitDepth, projName, libPathDir = ""):
                              	appPath = get_app_path(qtDir, buildType, bitDepth, projName)
                              	
                              	qt_IDE_folder	= paths.get_qt_IDE_folder(True)
                              
                              	if xplat.is_mac():
                              		# on mac, bundle has already been created, 
                              		# but it must be moved into place
                              		
                              		qtDeployExe	= qt_IDE_folder + 'clang_64/bin/macdeployqt'
                              		qtDestAppPath = appPath[:-1]
                              	else:
                              		qtDeployExe	= qt_IDE_folder + get_win_compiler_vers()
                              		
                              		if bitDepth == 64:
                              			qtDeployExe += '_' + bitDepth
                              		
                              		qtDeployExe += '/bin/windeployqt.exe'
                              		qtDestAppPath = get_exe_path(appPath)
                              
                              	cmd = [
                              		qtDeployExe, 
                              		qtDestAppPath]
                              
                              	if xplat.is_mac():
                              		# this doesn't seem to help
                              		#if (buildType == 'debug'):
                              		#	cmd += ['-verbose=0']
                              
                              		if libPathDir != "":
                              			# this doesn't seem to help
                              			#sqlPathDir = '/Volumes/Developer/depot/kJams/Development/_source/Resources/package/mac/libsql/'
                              			#cmd += ['-libpath=' + sqlPathDir]
                              
                              			#print libPathDir
                              			cmd += ['-libpath=' + libPathDir]
                              			
                              	else:
                              		cmd += ['--compiler-runtime', '--verbose=0']
                              
                              	libVers = os.path.basename(qt_IDE_folder[:-1])
                              		
                              	print '\tCopying Qt Libraries: ' + libVers + '...'
                              
                              	debug_print('cmd: ' + str(cmd))
                              	
                              	if False:
                              		# to show less logging / errors
                              		xplat.pipe(cmd, False);
                              	else:
                              		# shows more errors
                              		xplat.system(cmd)
                              		pass
                              

                              this is the command string that it will output:

                              '/Users/davec/developer/Qt/5.12.1/clang_64/bin/macdeployqt' '/Volumes/Developer/depot/kJams/Development/qt/build/mac/kJams 2 Debug.app' '-libpath=/Volumes/Developer/depot/kJams/External/boost_1_69_0/stage/lib/'
                              
                              1 Reply Last reply
                              0
                              • D Offline
                                D Offline
                                davecotter
                                wrote on last edited by
                                #17

                                i suppose this is helpful too:

                                def system(cmdA):
                                	cmdStr = cmdA.pop(0)
                                	for subCmd in cmdA:
                                		if ' ' in subCmd:
                                			subCmd = '"' + subCmd + '"'
                                		cmdStr += ' ' + subCmd
                                	os.system(cmdStr)
                                
                                def pipe(cmd, print_outB = False):
                                	debug_print(str(cmd));
                                	
                                	pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                                	(out, err) = pipe.communicate()
                                	ret = pipe.returncode
                                	
                                	errStr = str(err)
                                

                                if i use system() to invoke the command, i get the errors printed directly to the console, and Qt picks them up and gives me warnings.

                                but if i use pipe(), i can filter the returned errors and get around the problem. I'd rather use system().

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  davidesalvetti
                                  wrote on last edited by
                                  #18

                                  I'm also having these problems with macdeployqt, and I'm doing everything from the command line.
                                  I'm using Qt 5.12.2 clang64 with MacOs 10.12.6 High Sierra. The problem is exactly the same, when I try to deploy my application I get the following errors:

                                  ERROR: no file at "/usr/local/opt/libiodbc/lib/libiodbc.2.dylib"
                                  ERROR: no file at "/Applications/Postgres.app/Contents/Versions/9.6/lib/libpq.5.dylib"
                                  

                                  The command is the following:

                                  Mac-mini-di-Developer:build-MyApp-Desktop_Qt_5_12_2_clang_64bit-Release developer$ /Users/developer/Qt/5.12.2/clang_64/bin/macdeployqt /Volumes/Condiviso/MyApp_MAC/build-MyApp-Desktop_Qt_5_12_2_clang_64bit-Release/MyApp_2.0.app
                                  

                                  I managed to resolve the problem relative to the libmysqlclient.20.dylib downloading mysql with the brew command on the terminal and putting the library in the correct path, but I can't find the correct libraries for these two (if this is the right way to get it work, I suppose it is since it works with libmysqlclient.20.dylib).

                                  Can somebody give me any suggestion please?

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #19

                                    Hi,

                                    You can use install_name_tool to modify the the plugin's linked libraries path.

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    1

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved