Linux GN: Optionally link statically against libstdc++ [chromium/mini_chromium : master]

545 views
Skip to first unread message

Scott Graham (Gerrit)

unread,
Feb 27, 2018, 4:46:41 PM2/27/18
to Scott Graham, Mark Mentovai, Joshua Peraza, crashp...@chromium.org

View Change

1 comment:

  • File build/BUILD.gn:

    • Patch Set #2, Line 171: # statically to avoid the problem on the bots.

      Apparently not, it doesn't have make_unique in usr/include/c++/. […]

      I guess this comes down to it not really being possible to (dynamically) use C++14 on 14.04.

      So I guess another option is that we could switch back to -std=c++11, but that seems sad (and I'm not sure how much work would be involved.)

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 4
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-Comment-Date: Tue, 27 Feb 2018 21:46:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
Comment-In-Reply-To: Scott Graham <sco...@chromium.org>
Gerrit-MessageType: comment

Mark Mentovai (Gerrit)

unread,
Feb 27, 2018, 6:05:20 PM2/27/18
to Scott Graham, Joshua Peraza, crashp...@chromium.org

View Change

1 comment:

    • I dunno. I guess a "link_libstdcpp_statically" hack flag. Bleh.

      I think, given the constraints, that’s the winner that nobody was rooting for.

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 4
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-Comment-Date: Tue, 27 Feb 2018 23:05:12 +0000

Mark Mentovai (Gerrit)

unread,
Feb 27, 2018, 6:07:29 PM2/27/18
to Scott Graham, Joshua Peraza, crashp...@chromium.org

View Change

4 comments:

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 4
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-Comment-Date: Tue, 27 Feb 2018 23:07:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Scott Graham (Gerrit)

unread,
Feb 27, 2018, 7:39:05 PM2/27/18
to Scott Graham, Mark Mentovai, Joshua Peraza, crashp...@chromium.org

View Change

1 comment:

    • …but you’re really using libc++.

    • Oh, really? I thought -l just meant add a "lib" prefix and look for it on the libpath, so this would find "libstdc++". Is "c++" special cased somehow?

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 4
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-Comment-Date: Wed, 28 Feb 2018 00:39:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
Gerrit-MessageType: comment

Mark Mentovai (Gerrit)

unread,
Feb 27, 2018, 9:15:36 PM2/27/18
to Scott Graham, Joshua Peraza, crashp...@chromium.org

View Change

1 comment:

    • Oh, really? I thought -l just meant add a "lib" prefix and look for it on the libpath, so this would find "libstdc++". Is "c++" special cased somehow?

      I'm just misreading things all over the place.

      But the distinction raises an interesting question: if we use -stdlib libc++ for both compile and link, does that help?

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 4
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-Comment-Date: Wed, 28 Feb 2018 02:15:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>

Scott Graham (Gerrit)

unread,
Feb 27, 2018, 10:41:05 PM2/27/18
to Scott Graham, Mark Mentovai, Joshua Peraza, crashp...@chromium.org

View Change

1 comment:

    • > Oh, really? I thought -l just meant add a "lib" prefix and look for it on the libpath, so this wou […]

      Unfortunately it doesn't seem to link ("unable to find library -lc++").

      That lib is in the clang directory, but not in the sysroot. I don't think the Linux distributions ship libc++ by default (at least not old ones), so we'd be back to needing static linking then too I guess.

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 4
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-Comment-Date: Wed, 28 Feb 2018 03:41:03 +0000

Mark Mentovai (Gerrit)

unread,
Feb 28, 2018, 9:59:23 AM2/28/18
to Scott Graham, Joshua Peraza, crashp...@chromium.org

Thanks for bearing with me.

Patch set 4:Code-Review +1

View Change

1 comment:

  • File build/BUILD.gn:

    • Patch Set #4, Line 173: "-Wl,-Bstatic",

      Instead of these three arguments, I think we can just do

        ldflags += [
      "-Wl,-static-libstdc++",
      ]

      That should tell the compiler driver to do “-Bstatic -lstdc++ -Bdynamic” for us, which means that we won’t wind up with a freaky linker invocation that mentions -lstdc++ twice. It should also deal with -stdlib=libc++ better if anyone ever tries that.

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 4
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-Comment-Date: Wed, 28 Feb 2018 14:59:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Scott Graham (Gerrit)

unread,
Feb 28, 2018, 1:37:05 PM2/28/18
to Scott Graham, Mark Mentovai, Joshua Peraza, crashp...@chromium.org

View Change

1 comment:

    • Instead of these three arguments, I think we can just do […]

      ld.lld doesn't seem to care for that...

      /usr/local/google/work/cp2/crashpad/out/lin/../../third_party/linux/clang/linux-amd64/bin/ld.lld: error: unknown argument: -static-libstdc++

      Here's what --help says: https://gist.github.com/sgraham/f312216df00033ab1051329ca00027f8

      Skimming through that now to see if there's something similar...

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 4
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-Comment-Date: Wed, 28 Feb 2018 18:37:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
Gerrit-MessageType: comment

Scott Graham (Gerrit)

unread,
Feb 28, 2018, 1:55:03 PM2/28/18
to Scott Graham, Mark Mentovai, Joshua Peraza, crashp...@chromium.org

View Change

1 comment:

    • ld.lld doesn't seem to care for that... […]

      Oh, it doesn't want "-Wl," apparently.

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 4
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-Comment-Date: Wed, 28 Feb 2018 18:55:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>

Scott Graham (Gerrit)

unread,
Feb 28, 2018, 1:56:23 PM2/28/18
to Scott Graham, Mark Mentovai, Joshua Peraza, crashp...@chromium.org

Scott Graham merged this change.

View Change

Approvals: Mark Mentovai: Looks good to me
Linux GN: Optionally link statically against libstdc++

This accomodates the sysroot being slightly newer than the old bots that
represent the minspec for Chromium.

Before:

scottmg@around:/work/cp2/crashpad$ ldd -v out/lin/crashpad_client_test
linux-vdso.so.1 (0x00007ffc103c1000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fad8917e000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fad88e7a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fad88c5d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fad888be000)
/lib64/ld-linux-x86-64.so.2 (0x00007fad89500000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fad886a7000)

Version information:
out/lin/crashpad_client_test:
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3.4) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.4) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.6) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.17) => /lib/x86_64-linux-gnu/libc.so.6
libstdc++.so.6 (GLIBCXX_3.4) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4.15) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4.20) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4.21) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so.6 (CXXABI_1.3) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libpthread.so.0 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libpthread.so.0
libm.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libm.so.6
/usr/lib/x86_64-linux-gnu/libstdc++.so.6:
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
libm.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libm.so.6
libgcc_s.so.1 (GCC_4.2.0) => /lib/x86_64-linux-gnu/libgcc_s.so.1
libgcc_s.so.1 (GCC_3.3) => /lib/x86_64-linux-gnu/libgcc_s.so.1
libgcc_s.so.1 (GCC_3.0) => /lib/x86_64-linux-gnu/libgcc_s.so.1
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.18) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.17) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3.2) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
/lib/x86_64-linux-gnu/libm.so.6:
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib/x86_64-linux-gnu/libc.so.6
/lib/x86_64-linux-gnu/libpthread.so.0:
ld-linux-x86-64.so.2 (GLIBC_2.2.5) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3.2) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib/x86_64-linux-gnu/libc.so.6
/lib/x86_64-linux-gnu/libc.so.6:
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
/lib/x86_64-linux-gnu/libgcc_s.so.1:
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6


After with link_libstdcpp_statically=true (noting no libstdc++.so.6):

scottmg@around:/work/cp2/crashpad$ ldd -v out/lin/crashpad_client_test
linux-vdso.so.1 (0x00007fff749ab000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc6e2d6d000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc6e2b56000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc6e2939000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc6e259a000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc6e3340000)

Version information:
out/lin/crashpad_client_test:
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3.4) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.4) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.6) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.17) => /lib/x86_64-linux-gnu/libc.so.6
libpthread.so.0 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libpthread.so.0
libpthread.so.0 (GLIBC_2.3.2) => /lib/x86_64-linux-gnu/libpthread.so.0
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
libgcc_s.so.1 (GCC_3.0) => /lib/x86_64-linux-gnu/libgcc_s.so.1
libgcc_s.so.1 (GCC_3.3) => /lib/x86_64-linux-gnu/libgcc_s.so.1
libgcc_s.so.1 (GCC_4.2.0) => /lib/x86_64-linux-gnu/libgcc_s.so.1
libm.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libm.so.6
/lib/x86_64-linux-gnu/libm.so.6:
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib/x86_64-linux-gnu/libc.so.6
/lib/x86_64-linux-gnu/libgcc_s.so.1:
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
/lib/x86_64-linux-gnu/libpthread.so.0:
ld-linux-x86-64.so.2 (GLIBC_2.2.5) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3.2) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib/x86_64-linux-gnu/libc.so.6
/lib/x86_64-linux-gnu/libc.so.6:
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2


Bug: crashpad:30, crashpad:79, crashpad:220
Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Reviewed-on: https://chromium-review.googlesource.com/939731
Reviewed-by: Mark Mentovai <ma...@chromium.org>
---
M build/BUILD.gn
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/build/BUILD.gn b/build/BUILD.gn
index 6b51173..a169315 100644
--- a/build/BUILD.gn
+++ b/build/BUILD.gn
@@ -21,6 +21,9 @@
declare_args() {
# Path to the Clang toolchain. If unset, uses the system-installed Clang.
clang_path = ""
+
+ # If set, link against libstdc++ statically.
+ link_libstdcpp_statically = false
}
} else if (mini_chromium_is_fuchsia) {
declare_args() {
@@ -157,6 +160,17 @@
if (mini_chromium_is_linux) {
defines = [ "_FILE_OFFSET_BITS=64" ]
common_flags += [ "-pthread" ]
+
+ if (link_libstdcpp_statically) {
+ # The sysroot being built against is based on Stretch, which is newer than
+ # the libstdc++ that's on Trusty (14.04) which is the Chromium minspec.
+ # This minspec determines what the available buildbots are. Chromium
+ # doesn't have a problem with libstdc++ despite this, because it links
+ # against a local copy of libc++ instead. As this build file only affects
+ # the standalone Crashpad build, when this flag is set link libstdc++
+ # statically to avoid the problem on the bots.
+ ldflags += [ "-static-libstdc++" ]
+ }
}

if (mini_chromium_is_fuchsia) {

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 6
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-MessageType: merged

Mark Mentovai (Gerrit)

unread,
Feb 28, 2018, 1:59:48 PM2/28/18
to Scott Graham, Joshua Peraza, crashp...@chromium.org

View Change

1 comment:

    • Oh, it doesn't want "-Wl," apparently.

      Are we invoking ld.lld directly or letting the compiler driver do it for us? The driver should have stripped away the “-Wl,”.

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 6
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-Comment-Date: Wed, 28 Feb 2018 18:59:46 +0000

Scott Graham (Gerrit)

unread,
Feb 28, 2018, 2:06:34 PM2/28/18
to Scott Graham, Mark Mentovai, Joshua Peraza, crashp...@chromium.org

View Change

1 comment:

    • > Oh, it doesn't want "-Wl," apparently. […]

      We're using clang++ as the linker. I have no idea why no -Wl, I find the (lack of) command line documentation for these tools totally insane.

      Here's with -Wl:

      scottmg@around:/work/cp2/crashpad$ ninja -C out/lin crashpad_client_test
      ninja: Entering directory `out/lin'
      [0->1/1 ~1] Regenerating ninja files
      [1->1/2 ~1] LINK ./crashpad_handler
      FAILED: crashpad_handler
      ../../third_party/linux/clang/linux-amd64/bin/clang++ -Wl,-static-libstdc++ -Wl,--as-needed -Wl,-z,noexecstack --sysroot=../../third_party/linux/sysroot -pthread -pie -o "./crashpad_handler" -Wl,--start-group obj/handler/crashpad_handler.main.o obj/tools/tool_support.tool_support.o obj/handler/libhandler.a obj/compat/libcompat.a obj/client/libclient.a obj/third_party/mini_chromium/mini_chromium/base/libbase.a obj/util/libutil.a obj/minidump/libminidump.a obj/snapshot/libsnapshot.a -Wl,--end-group -lz


    • /usr/local/google/work/cp2/crashpad/out/lin/../../third_party/linux/clang/linux-amd64/bin/ld.lld: error: unknown argument: -static-libstdc++

    • clang-7.0: error: linker command failed with exit code 1 (use -v to see invocation)
      ninja: build stopped: subcommand failed.


      and without -Wl:

      scottmg@around:/work/cp2/crashpad$ ninja -C out/lin crashpad_client_test -v -j1
      ninja: Entering directory `out/lin'
      [0->1/1 ~1] ../../../buildtools/linux64/gn --root=../.. -q gen .
      [0->1/1 ~1] ../../third_party/linux/clang/linux-amd64/bin/clang++ -static-libstdc++ -Wl,--as-needed -Wl,-z,noexecstack --sysroot=../../third_party/linux/sysroot -pthread -pie -o "./crashpad_handler" -Wl,--start-group obj/handler/crashpad_handler.main.o obj/tools/tool_support.tool_support.o obj/handler/libhandler.a obj/compat/libcompat.a obj/client/libclient.a obj/third_party/mini_chromium/mini_chromium/base/libbase.a obj/util/libutil.a obj/minidump/libminidump.a obj/snapshot/libsnapshot.a -Wl,--end-group -lz
      scottmg@around:/work/cp2/crashpad$ ldd out/lin/crashpad_client_test
      linux-vdso.so.1 (0x00007ffc787c9000)
      libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fdaaa985000)
      libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fdaaa76e000)
      libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fdaaa551000)
      libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdaaa1b2000)
      /lib64/ld-linux-x86-64.so.2 (0x00007fdaaaefa000)

To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/mini_chromium
Gerrit-Branch: master
Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
Gerrit-Change-Number: 939731
Gerrit-PatchSet: 6
Gerrit-Owner: Scott Graham <sco...@chromium.org>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
Gerrit-Comment-Date: Wed, 28 Feb 2018 19:06:32 +0000

Mark Mentovai (Gerrit)

unread,
Feb 28, 2018, 2:19:50 PM2/28/18
to Scott Graham, Joshua Peraza, crashp...@chromium.org

Oh, right. -static-libstdc++ is a driver option, not a linker option, so the -Wl, was wrong.

The documentation is terrible. clang implements -static-libstdc++ but you won’t find it documented anywhere. Well, it’s listed on https://clang.llvm.org/docs/ClangCommandLineReference.html, but there isn’t really any explanation of what it does other than “C++ standard library to use”, along with 10 other things. They expect you to look at the GCC documentation. https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

What you checked in is good.

View Change

    To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: chromium/mini_chromium
    Gerrit-Branch: master
    Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
    Gerrit-Change-Number: 939731
    Gerrit-PatchSet: 6
    Gerrit-Owner: Scott Graham <sco...@chromium.org>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
    Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
    Gerrit-Comment-Date: Wed, 28 Feb 2018 19:19:49 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    Gerrit-MessageType: comment

    Scott Graham (Gerrit)

    unread,
    Feb 28, 2018, 2:32:30 PM2/28/18
    to Scott Graham, Mark Mentovai, Joshua Peraza, crashp...@chromium.org

    Patch Set 6:

    Oh, right. -static-libstdc++ is a driver option, not a linker option, so the -Wl, was wrong.

    The documentation is terrible. clang implements -static-libstdc++ but you won’t find it documented anywhere. Well, it’s listed on https://clang.llvm.org/docs/ClangCommandLineReference.html, but there isn’t really any explanation of what it does other than “C++ standard library to use”, along with 10 other things. They expect you to look at the GCC documentation. https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

    What you checked in is good.

    OK, thanks for confirming.

    The thing that bugs me the most is that it's not in here:

    scottmg@around:/work/cp2/crashpad$ third_party/linux/clang/linux-amd64/bin/ld.lld --help |grep static
    --Bstatic Do not link against shared libraries
    --exclude-libs=<value> Exclude static libraries from automatic export
    --exclude-libs <value> Exclude static libraries from automatic export
    --no-whole-archive Do not force load of all members in a static library
    --static Do not link against shared libraries
    --whole-archive Force load of all members in a static library
    scottmg@around:/work/cp2/crashpad$ third_party/linux/clang/linux-amd64/bin/clang++ --help |grep static
    --analyze Run the static analyzer
    -fno-threadsafe-statics Do not emit code to make initialization of local statics thread safe
    -Xanalyzer <arg> Pass <arg> to the static analyzer
    scottmg@around:/work/cp2/crashpad$

    View Change

      To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: chromium/mini_chromium
      Gerrit-Branch: master
      Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
      Gerrit-Change-Number: 939731
      Gerrit-PatchSet: 6
      Gerrit-Owner: Scott Graham <sco...@chromium.org>
      Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
      Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
      Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
      Gerrit-Comment-Date: Wed, 28 Feb 2018 19:32:29 +0000

      Mark Mentovai (Gerrit)

      unread,
      Feb 28, 2018, 2:42:43 PM2/28/18
      to Scott Graham, Joshua Peraza, crashp...@chromium.org

      Patch Set 6:

      Patch Set 6:

      Oh, right. -static-libstdc++ is a driver option, not a linker option, so the -Wl, was wrong.

      The documentation is terrible. clang implements -static-libstdc++ but you won’t find it documented anywhere. Well, it’s listed on https://clang.llvm.org/docs/ClangCommandLineReference.html, but there isn’t really any explanation of what it does other than “C++ standard library to use”, along with 10 other things. They expect you to look at the GCC documentation. https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

      What you checked in is good.

      OK, thanks for confirming.

      The thing that bugs me the most is that it's not in here:

      GCC’s --help is even more sparse. Clang’s at least looks like it’s trying, even though it’s not.

      Maybe they’d take a patch.

      View Change

        To view, visit change 939731. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: chromium/mini_chromium
        Gerrit-Branch: master
        Gerrit-Change-Id: Ifa49c284a23009f3685283444f2bf7f52f80c3b3
        Gerrit-Change-Number: 939731
        Gerrit-PatchSet: 6
        Gerrit-Owner: Scott Graham <sco...@chromium.org>
        Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
        Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
        Gerrit-Reviewer: Scott Graham <sco...@chromium.org>
        Gerrit-Comment-Date: Wed, 28 Feb 2018 19:42:34 +0000
        Reply all
        Reply to author
        Forward
        0 new messages