Robocopy Post-Build Error, but it works.

CodeLite installation/troubleshooting forum
Akronym
CodeLite Enthusiast
Posts: 15
Joined: Fri Sep 05, 2014 9:02 pm
Genuine User: Yes
IDE Question: c++
Location: Germany
Contact:

Robocopy Post-Build Error, but it works.

Post by Akronym »

Hi,

me again...I am using some POST-BUILD commands, and on rebuild, Codelite says: SFML-Test.mk:84: recipe for target 'PostBuild' failed. Same with a clean and build.

Code: Select all

C:\WINDOWS\system32\cmd.exe /C E:/DevTools/WinBuilds/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ SFML-Test - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'E:/Workspaces/CodeLite/SFML/SFML-Test'
E:/DevTools/WinBuilds/bin/g++.exe -o ./Debug/SFML-Test @"SFML-Test.txt" -L. -LE:/Lib/cpp/SFML/build/lib  -lsfml-graphics-d -lsfml-window-d -lsfml-audio-d -lsfml-network-d -lsfml-system-d  -static -static-libgcc -static-libstdc++
mingw32-make.exe[1]: Leaving directory 'E:/Workspaces/CodeLite/SFML/SFML-Test'
mingw32-make.exe[1]: Entering directory 'E:/Workspaces/CodeLite/SFML/SFML-Test'
Executing Post Build commands ...
ROBOCOPY E:\Workspaces\CodeLite\SFML\SFML-Test\Resources E:\Workspaces\CodeLite\SFML\SFML-Test\./Debug\Resources /MIR /NFL /NDL /NJH /NJS /nc /ns /np
mingw32-make.exe[1]: *** [PostBuild] Error 1
mingw32-make.exe: *** [All] Error 2

SFML-Test.mk:84: recipe for target 'PostBuild' failed
mingw32-make.exe[1]: Leaving directory 'E:/Workspaces/CodeLite/SFML/SFML-Test'
Makefile:4: recipe for target 'All' failed
====2 errors, 0 warnings====
I figured, that using this command let's codelite think something did not work...but the folder and files get copied. Even running this command in CMD works just fine ... even with just the /MIR flag (the other flags suppress any output).

Code: Select all

ROBOCOPY $(ProjectPath)Resources $(ProjectPath)$(OutDir)\Resources /MIR /NFL /NDL /NJH /NJS /nc /ns /np
Since ROBOCOPY does nothing if all files already exist, CodeLite compiles the project fine ... so as soon as my Resource folder is not inside the output directory, compilation fails, but ROBOCOPY did copy the folder and files. A second time compiling works just fine, and ROBOCOPY had nothing to do.

Using CodeLite 9.1.1 (Not self build) on Windows 10 with gcc 4.8.3

P.S. Maybe it's a bug of mingw32-make ?
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Robocopy Post-Build Error, but it works.

Post by eranif »

Akronym wrote:P.S. Maybe it's a bug of mingw32-make ?
make "decides" if a command failed based on the the return code.
So the more likely reason for this error, is that robocopy did not return 0 on exit

You can try and wrap it with CMD like this (notice the cmd /C at the start)

Code: Select all

cmd /C ROBOCOPY E:\Workspaces\CodeLite\SFML\SFML-Test\Resources E:\Workspaces\CodeLite\SFML\SFML-Test\./Debug\Resources /MIR /NFL /NDL /NJH /NJS /nc /ns /np
Make sure you have read the HOW TO POST thread
Akronym
CodeLite Enthusiast
Posts: 15
Joined: Fri Sep 05, 2014 9:02 pm
Genuine User: Yes
IDE Question: c++
Location: Germany
Contact:

Re: Robocopy Post-Build Error, but it works.

Post by Akronym »

Hi,

CMD /C does not work. I guess I have to wrap it up in a .bat file and alter the return code of ROBOCOPY (it indeed has "abnormal" return codes) then. Wish I had time to checkout the Codelite Plugin interface to build a nice Resource Plugin or such. Maybe some day :) Thanks for the answer!
Post Reply