Crashpad for a Linux/ARM32 platform?

412 views
Skip to first unread message

Gerrit Telkamp

unread,
Dec 18, 2020, 1:46:20 PM12/18/20
to Crashpad-dev

Hi,
I assume that Crashpad can be built for a Linux/arm32 platform, because Chromium does. We use a NXP i.MX6 UltraLite (ARM Cortex-A7), running Yocto Linux.

But the library minidump/chromium supports arm64 CPUs only (besides x86 and x64, see build/config/BUILD.gn). Is there someone who has managed to build minidump for arm32 platforms? Or is there a simple readme how to twist the Build.gn to build it for a Linux/arm32 platform?

Thanks, Gerrit

Joshua Peraza

unread,
Dec 18, 2020, 2:17:48 PM12/18/20
to Gerrit Telkamp, Crashpad-dev
Yes, Crashpad-linux should generally work for ARM32. I think it's just third_party/mini_chromium hasn't been setup for that cross-build because we normally do build in chromium when targeting ARM.

I think it shouldn't be too much work to get the ARM build working in mini_chromium. You can add compiler switches for your target arch by extending the if/elses around here: https://chromium-review.googlesource.com/c/chromium/mini_chromium/+/2559153

I think pairing that with Crashpad's target_sysroot gn arg should get you close. 



--
You received this message because you are subscribed to the Google Groups "Crashpad-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to crashpad-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/crashpad-dev/b96ca9ca-6c5f-459b-a9cc-cfe055d81ccfn%40chromium.org.

丁毅

unread,
Jan 27, 2022, 9:04:10 AM1/27/22
to Crashpad-dev, Joshua Peraza, Crashpad-dev, gerrit....@googlemail.com
I tried to modify the BUILD.gn file and set target_sysroot to an arm64 sysroot, but many build/link error occurs, such as:
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cann't find -ldl
...

Joshua Peraza

unread,
Jan 27, 2022, 12:02:58 PM1/27/22
to 丁毅, Crashpad-dev, gerrit....@googlemail.com
It sounds like you might be missing some important dev packages in your sysroot, in this case a dev libc package.

丁毅

unread,
Jan 28, 2022, 3:33:06 AM1/28/22
to Crashpad-dev, Joshua Peraza, Crashpad-dev, gerrit....@googlemail.com, 丁毅
Thanks, it works for ARM64(arm32 is similar, I thought) now! The steps are:
2. modify the code in third_party/mini_chromimu/mini_chromimu/build/config/BUILD.gn:
  if (mini_chromium_is_linux) {
  defines = [ "_FILE_OFFSET_BITS=64" ]
  common_flags += [ "-pthread" ]
  if (current_cpu == "x86") {
    common_flags += [
          "-m32",
    ]
  } else if (current_cpu == "x64") {
    common_flags += [
          "-m64",
    ]
  } else {
    assert(false, "Unsupported architecture")
  }
  ...

TO:

 if (mini_chromium_is_linux) {
  defines = [ "_FILE_OFFSET_BITS=64" ]
  common_flags += [ "-pthread" ]
  if (current_cpu == "x86") {
    common_flags += [
          "-m32",
    ]
  } else if (current_cpu == "x64") {
    common_flags += [
          "-m64",
    ]
  } else if (current_cpu == "arm64") {
    common_flags += [
          "--target=aarch64-linux-gnu",
    ]
  } else {
    assert(false, "Unsupported architecture")
  }
  ...

3. The gn command:
gn gen out/linux/arm64/Release --args='
target_sysroot="/home/dingyi/Downloads/debian_sid_arm64_sysroot"
target_cpu="arm64"
target_os="linux"
is_debug=false
'

4. ninja -C out/linux/arm64/Release

丁毅

unread,
Feb 7, 2022, 10:48:26 PM2/7/22
to Crashpad-dev, 丁毅, Joshua Peraza, Crashpad-dev, gerrit....@googlemail.com
Update! It works for arm64, armhf and armel, take arm64 as example, the steps are:
  }  else if (current_cpu == "arm") {
    common_flags += [
      "--target=arm-linux-gnueabihf",
      "-mfloat-abi=hard",
    ]
  } else if (current_cpu == "armel") {
    common_flags += [
      "--target=arm-linux-gnueabi",
      "-mfloat-abi=softfp",
    ]
    ldflags += [
      "-latomic",
    ]
  } else {
    assert(false, "Unsupported architecture")
  }
  ...

3. The gn command:
gn gen out/linux/arm64/Release --args='
target_sysroot="/home/dingyi/Downloads/debian_sid_arm64_sysroot"
target_cpu="arm64"
target_os="linux"
is_debug=false
'

4. ninja -C out/linux/arm64/Release

Reply all
Reply to author
Forward
0 new messages