Building with GMake

Building with GMake

20
Basic UserBasic User
20

    Apr 16, 2012#1

    Hey all;

    I'm trying to build from within UEStudio, and I'm not having much luck. Our build process is pretty complex, but as its' base, it ends up calling the GNU make utility gmake.

    Unfortunately, with the default UEStudio configuration, every call to gmake results in the error:

    *** create_child_process: DuplicateHandle(In) failed (e=6)

    I've been googling this error message without a lot of success, but this link: http://lists.gnu.org/archive/html/help- ... 00007.html implies that the issue would be with the calling program (UEStudio in this case) not properly dealing with file handles.

    I've had partial luck by selecting the "easy capture method (for old DOS comp.)" option in the Advanced Build Options. At least when I set that option, the gmake actually runs properly, and builds the project. However, the output window lists nothing, regardless of what other settings I use.

    When I set the build process to be a batch file that looks like this:

    @echo off
    echo --
    echo -- About to build
    echo --
    gmake.exe -k --debug=t,b -j 1 -f dir\dir\makefile.mk
    echo --
    echo -- After build.bat
    echo --

    I can see gmake.exe in the process table, the build runs, and the following is in the output window:

    --
    -- About to build
    --
    --
    -- After build.bat
    --

    If I change the gmake line to pipe the output to a file, like so:

    gmake.exe -k --debug=t,b -j 1 -f dir\dir\makefile.mk | dir\bin\tee -a make.log

    the build completes, and the file make.log is created showing the results of the build (errors and all), but the output window just shows the before/after lines. I've tried using type, grep, and other utilities to display/filter the data in make.log, without success. It seems that setting the "easy capture" method blocks that, but of course, not using the "easy capture" method breaks the gmake. So it's a catch-22 situation.

    Has anyone had any experience using gmake with UEStudio?

      Apr 16, 2012#2

      Answering my own question here...

      It looks like the best thing to do is to have UES invoke a script which calls gmake, with the "grab standard error/output" options enabled, as well as "easy capture method". Then, have the script filter the lines with errors into another file, which is then typed to the console.

      I use JPSoft's (http://www.jpsoft.com) Take Command product, but this could just as easily be done in sh, csh, Powershell, and probably the standard batch scripting language, assuming you could check file sizes.

      Code: Select all

      @echo off
      :
      :   Run the build, save the output in make.log
      :
      gmake.exe  -k --debug=t,b -j 1 -f %DIR%\makefile.mk | tee -a make.log
      
      :
      :  Check for error messages to determine if the build failed
      :  Note grep is using Perl syntax, due to ` character usage in output string
      :
      set FAIL_STRING="(\*\*\*)|(\: \(error)|(\: error)|(\: see declaration of)"
      set PASS_STRING="(remade target file .?all)|(Elapsed time)"
      grep -P %FAIL_STRING% %DEVSNAP%\make.log > make.err
      iff %@filesize[make.err] == 0 then
         grep -P %PASS_STRING% %DEVSNAP%\make.log > make.err
      endiff
      
      type make.err
      This script is defined as the Cmd0 line in the [Build] section of a newly defined compiler. The output properly shows error lines which can be double clicked on to go to the offending source line. Even nicer, for errors like:

      Code: Select all

      gmake: *** [DIR/DIR/DIR/config/gen.xml] Error 1
      where "gen.xml" is an XML configuration file, generated by the build process, even though there is no error line, UE will load the offending file when the error line is clicked on.