Page 1 of 1

Robocopy Post-Build Error, but it works.

Posted: Sun Feb 21, 2016 1:10 am
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 ?

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

Posted: Sun Feb 21, 2016 10:17 am
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

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

Posted: Tue Feb 23, 2016 12:12 pm
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!