builder: print compiler commands while building a library

We should have been doing this all along and makes it easier to debug
things that go wrong while compiling a library.
This commit is contained in:
Ayke van Laethem
2022-11-05 20:19:34 +01:00
committed by Ron Evans
parent 666ead3996
commit 2001c44ed3
+6
View File
@@ -242,6 +242,9 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
var compileArgs []string
compileArgs = append(compileArgs, args...)
compileArgs = append(compileArgs, "-o", objpath, srcpath)
if config.Options.PrintCommands != nil {
config.Options.PrintCommands("clang", compileArgs...)
}
err := runCCompiler(compileArgs...)
if err != nil {
return &commandError{"failed to build", srcpath, err}
@@ -268,6 +271,9 @@ func (l *Library) load(config *compileopts.Config, tmpdir string) (job *compileJ
}
tmpfile.Close()
compileArgs = append(compileArgs, "-o", tmpfile.Name(), srcpath)
if config.Options.PrintCommands != nil {
config.Options.PrintCommands("clang", compileArgs...)
}
err = runCCompiler(compileArgs...)
if err != nil {
return &commandError{"failed to build", srcpath, err}