Page MenuHomePhabricator Implement "gcc" builder

Authored by labath on Dec 7 2018, 5:59 AM.



This implements the gcc builder in script to allow it to
compile host executables when running on a non-windows host. Where it
made sense, I tried to share code with the msvc builder by moving stuff
to the base class.

I did not implement the lto part because I don't know how that works,
(and it's likely things will differ between platforms there).

Event Timeline

labath created this revision.Dec 7 2018, 5:59 AM
stella.stamenova accepted this revision.Dec 11 2018, 2:04 PM
stella.stamenova added a subscriber: stella.stamenova.

A couple of small comments, but it looks good otherwise. Thanks!

1 ↗(On Diff #177195)

There are a couple of tests for the build script that we should enable on non-windows as well:

  • script-args
  • modes

Both should pass with your change

627 ↗(On Diff #177195)

You can just add the thinlto command here. That should give you parity with the msvc builder:

This revision is now accepted and ready to land.Dec 11 2018, 2:04 PM
labath marked 3 inline comments as done.Dec 12 2018, 12:57 AM
labath added inline comments.
1 ↗(On Diff #177195)

I've enabled the two tests. I've had to tweak the "modes" test a bit to account for the different object file extension (.obj vs .o).

This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.
zturner added inline comments.Dec 12 2018, 8:42 AM

Why do we need this?

labath marked an inline comment as done.Dec 12 2018, 8:52 AM
labath added inline comments.

Without this I got errors when trying this out on a mac (something about "dynamically linked executables must link to libSystem.dylib"). Doing a static link in this case did not seem like a bad choice, since this script doesn't even support building shared libraries at this point. If we get to a point where we want to build shared libraries in --nodefaultlib mode, then we will have to revisit this.

(this could be made darwin-only, but it seemed better to be consistent).

I am trying to use the new builder to build the lldb-mi tests, so that they can start consistently passing on Windows, so they're now using the gcc builder on Linux and failing:

2018-12-14T19:24:41.8890855Z ********************
2018-12-14T19:24:41.8904193Z Testing: 0 .. 10.. 20.. 30.
2018-12-14T19:24:41.8918035Z FAIL: LLDB :: tools/lldb-mi/exec/exec-interrupt.test (17141 of 45941)
2018-12-14T19:24:41.8932384Z ******************** TEST 'LLDB :: tools/lldb-mi/exec/exec-interrupt.test' FAILED ********************
2018-12-14T19:24:41.8945979Z Script:
2018-12-14T19:24:41.8959648Z --
2018-12-14T19:24:41.8974664Z : 'RUN: at line 1';   '/usr/bin/python2.7' /vstsdrive/_work/42/s/llvm/tools/lldb/lit/helper/ --compiler=any --arch=64 --tools-dir=/vstsdrive/_work/42/b/LLVMBuild/./bin /vstsdrive/_work/42/s/llvm/tools/lldb/lit/tools/lldb-mi/exec/inputs/main.c --nodefaultlib -o /vstsdrive/_work/42/b/LLVMBuild/tools/lldb/lit/tools/lldb-mi/exec/Output/exec-interrupt.test.tmp
2018-12-14T19:24:41.8991443Z : 'RUN: at line 2';   /vstsdrive/_work/42/b/LLVMBuild/bin/lldb-mi --synchronous /vstsdrive/_work/42/b/LLVMBuild/tools/lldb/lit/tools/lldb-mi/exec/Output/exec-interrupt.test.tmp < /vstsdrive/_work/42/s/llvm/tools/lldb/lit/tools/lldb-mi/exec/exec-interrupt.test | /vstsdrive/_work/42/b/LLVMBuild/bin/FileCheck /vstsdrive/_work/42/s/llvm/tools/lldb/lit/tools/lldb-mi/exec/exec-interrupt.test
2018-12-14T19:24:41.9006101Z --
2018-12-14T19:24:41.9019550Z Exit Code: 1
2018-12-14T19:24:41.9039902Z Command Output (stdout):
2018-12-14T19:24:41.9053450Z --
2018-12-14T19:24:41.9066966Z Cleaning exec-interrupt.test.tmp-main.o
2018-12-14T19:24:41.9081046Z Cleaning exec-interrupt.test.tmp
2018-12-14T19:24:41.9114993Z compiling main.c -> exec-interrupt.test.tmp-main.o
2018-12-14T19:24:41.9128817Z   STDOUT:
2018-12-14T19:24:41.9169689Z linking exec-interrupt.test.tmp-main.o -> exec-interrupt.test.tmp
2018-12-14T19:24:41.9183153Z   STDOUT:
2018-12-14T19:24:41.9203611Z   STDERR:
2018-12-14T19:24:41.9217412Z     clang-8: error: unable to execute command: Executable "ld" doesn't exist!
2018-12-14T19:24:41.9231640Z     clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
2018-12-14T19:24:41.9258832Z --