Solved mac: attempt to add "QT += sql" causes build error?
-
i see the project "relationaltablemodel" and i can run it with no problem.
but when i add "sql" to my QT variable in the pro file, then build, i get this these errors:
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"
note that i wish to use SQLite, not MySQL, and why does the example project not give these errors?
note i am calling macdeployqt on my project (even in debug because reasons). do i need to add another "libpath" to it?
is this an "error that isn't an error", ie: i can ignore it? if so can i suppress the so-called error?
and if i'm ONLY using SQLite why is it copying ALL SQL drivers (plugins) into my bundle? how do i tell macdeployqt to only copy the SQLite driver?
also i see the example has this in the pro file:
requires(qtConfig(tableview))
what is that and where is it documented?
-
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 usesystem()
. -
@davecotter Do you get these errors when building your app or when deploying it? If you get them while deploying I would say you can ignore them.
I think the deployment tool copies all SQL libs because it only knows that your app uses the SQL module (as it is stated in the pro file), but it does not know what exactly. To know exactly what you're using it would need to scan and understand the code. I don't know whether you can tell macdeployqt what exactly you need, did you check its parameters? -
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
-
@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? -
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?
-
Hi,
You currently can't select which plugin is deployed.
You are talking about a build error. What exactly is it ?
-
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)
-
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 ?
-
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
-
@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). -
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?
-
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?
-
I couldn't reproduce this issue.
What version of Qt are you using ?
-
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. -
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 ? -
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/'
-
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 usesystem()
. -
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?
-
Hi,
You can use install_name_tool to modify the the plugin's linked libraries path.