Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
5.9.7: Problem with copying a DLL during build, uses Linux paths
First posting, so be gentle.
I have an older Windows machine where I compile my software (Qt 5.9.7, MinGW).
One of my DLLs needs a 3rd party DLL to work.
So in my .pro file I had:
aspdllcopyier.target = .copy_asp_for_fridgeproxy aspdllcopyier.commands = copy $$shell_path($$_PRO_FILE_PWD_/AspBusDll.dll) $$shell_path($$OUT_PWD/$$BINLOCATION) QMAKE_EXTRA_TARGETS += aspdllcopyier PRE_TARGETDEPS += .copy_asp_for_fridgeproxy
On my "older" machine this works like a charm, and the DLL is copied during build.
On my new Windows machine, however, I get an error:
C:/dev/Qt/Qt5.9.7/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug mingw32-make: Entering directory 'C:/src/build-LUISE-Desktop_Qt_5_9_7_MinGW_32bit-Debug/FridgeProxy' copy /C/src/lhg-luise/FridgeProxy/AspBusDll.dll /C/src/build-LUISE-Desktop_Qt_5_9_7_MinGW_32bit-Debug/FridgeProxy/debug Makefile.Debug:159: recipe for target '.copy_asp_for_fridgeproxy' failed mingw32-make: Leaving directory 'C:/src/build-LUISE-Desktop_Qt_5_9_7_MinGW_32bit-Debug/FridgeProxy' process_begin: CreateProcess(NULL, copy /C/src/lhg-luise/FridgeProxy/AspBusDll.dll /C/src/build-LUISE-Desktop_Qt_5_9_7_MinGW_32bit-Debug/FridgeProxy/debug, ...) failed. make (e=2): The system cannot find the file specified.
It seems that here, $$shell_path seems to believe to be on a Unix or Linux machine.
I googled the error and copying of DLLs and in the responses people handle this copying differently.
But ... it works on my old machine. I just cannot figure out, why it works there and not on my new machine.
Did I do something back then (when I included the DLL) to the environment? But .... what?
Thanks in advance!
Hi and welcome to the forums
Don't worry, even in the spanking section, we are quite gentle ;)
Just tried here with Qt5.12 / win 10.
Can you try ( in a clean defualt gui project)
and just run qmake and see what it prints?
it expands as expected here.
First of all thanks for your reply. Gulp .... there's a spanking section?!?! I am out of here!
If I include message($$shell_path($$PRO_FILE_PWD)) (with the underscores) in a fresh new test project I get:
Project MESSAGE: /C/Users/Sasch/Documents/Test
which is pretty much Linuxy again.
And I kind of found the problem ... more by accident.
I have installed Qt5.12.1 on my machine ... same error.
Then I came across this page:
"'make' detects 'sh.exe' on the PATH. If you don't want it to use
the MSYS shell, then take MSYS off the PATH."
A quick check of my environment variables showed that SmartGit, a Git frontend - during installation - had actually added its "git\bin" folder to the PATH, in there a "sh.exe". On my older machine, it either didn't, back then, or I had removed it after installation at some point of time.
So, I removed the path entry and now the build works.
Just plain stupid. Did cost many hours of trying and searching.
Thanks for your assistance anyway. The 5.12 hint made me install that and recheck.
That finally led me to the believe that it's actually a pure MinGW issue and the discovery of the website.
I did test around and never saw it uses unix syntax/paths but
some other mod suggested it would be the case with MSYS
which also can be the case it seems, if its detected.
Good found :)