Bug 10276 - BR2_PACKAGE_LINUX_TOOLS_GPIO fails for MIPS with "gpio-hammer.o: ABI is incompatible with that of the selected emulation"
Summary: BR2_PACKAGE_LINUX_TOOLS_GPIO fails for MIPS with "gpio-hammer.o: ABI is incom...
Status: RESOLVED MOVED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2017.05.1
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: Yann E. MORIN
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-30 05:38 UTC by Ciro Santilli
Modified: 2024-06-15 14:47 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ciro Santilli 2017-08-30 05:38:17 UTC
Ubuntu 16.04 host:

```
git checkout bc4f5598dccc191a1e2c6268fdcef1935e2fa212
make qemu_mips64r6_malta_defconfig
echo '
BR2_PACKAGE_LINUX_TOOLS=y
BR2_PACKAGE_LINUX_TOOLS_GPIO=y
' >> .config
env -u LD_LIBRARY_PATH time make BR2_JLEVEL=14
```

error log:

  DESCEND  gpio
mkdir -p include/linux 2>&1 || true
ln -sf /data/git/buildroot/output/build/linux-4.11.3/tools/gpio/../../include/uapi/linux/gpio.h include/linux/gpio.h
  CC       gpio-event-mon.o
  CC       gpio-hammer.o
  CC       lsgpio.o
  CC       gpio-utils.o
  CC       gpio-utils.o
  CC       gpio-utils.o
  LD       gpio-event-mon-in.o
gpio-utils.o: file not recognized: File truncated
/data/git/buildroot/output/build/linux-4.11.3/tools/build/Makefile.build:149: recipe for target 'gpio-event-mon-in.o' failed
make[4]: *** [gpio-event-mon-in.o] Error 1
Makefile:58: recipe for target 'gpio-event-mon-in.o' failed
make[3]: *** [gpio-event-mon-in.o] Error 2
make[3]: *** Waiting for unfinished jobs....
  LD       gpio-hammer-in.o
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: gpio-hammer.o: ABI is incompatible with that of the selected emulation
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: failed to merge target specific data of file gpio-hammer.o
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: gpio-utils.o: ABI is incompatible with that of the selected emulation
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: failed to merge target specific data of file gpio-utils.o
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: Attempt to do relocatable link with elf64-tradbigmips input and elf32-ntradbigmips output
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: gpio-hammer.o: file class ELFCLASS64 incompatible with ELFCLASS32
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: final link failed: File in wrong format
/data/git/buildroot/output/build/linux-4.11.3/tools/build/Makefile.build:149: recipe for target 'gpio-hammer-in.o' failed
make[4]: *** [gpio-hammer-in.o] Error 1
Makefile:49: recipe for target 'gpio-hammer-in.o' failed
make[3]: *** [gpio-hammer-in.o] Error 2
  LD       lsgpio-in.o
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: lsgpio.o: ABI is incompatible with that of the selected emulation
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: failed to merge target specific data of file lsgpio.o
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: gpio-utils.o: ABI is incompatible with that of the selected emulation
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: failed to merge target specific data of file gpio-utils.o
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: Attempt to do relocatable link with elf64-tradbigmips input and elf32-ntradbigmips output
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: lsgpio.o: file class ELFCLASS64 incompatible with ELFCLASS32
/data/git/buildroot/output/host/bin/mips64-buildroot-linux-uclibc-ld: final link failed: File in wrong format
/data/git/buildroot/output/build/linux-4.11.3/tools/build/Makefile.build:149: recipe for target 'lsgpio-in.o' failed
make[4]: *** [lsgpio-in.o] Error 1
Makefile:40: recipe for target 'lsgpio-in.o' failed
make[3]: *** [lsgpio-in.o] Error 2
Makefile:61: recipe for target 'gpio' failed
make[2]: *** [gpio] Error 2
package/pkg-generic.mk:227: recipe for target '/data/git/buildroot/output/build/linux-tools/.stamp_built' failed
make[1]: *** [/data/git/buildroot/output/build/linux-tools/.stamp_built] Error 2
Makefile:79: recipe for target '_all' failed
make: *** [_all] Error 2
Comment 1 Thomas Petazzoni 2017-08-30 08:32:40 UTC
Could you try to adapt https://patchwork.ozlabs.org/patch/729154/ to the gpio linux-tools package, and see if it works for you ?
Comment 2 Yann E. MORIN 2017-08-30 17:55:48 UTC
Given the following:

      CC       gpio-utils.o
      LD       gpio-event-mon-in.o
    gpio-utils.o: file not recognized: File truncated
    /data/git/buildroot/output/build/linux-4.11.3/tools/build/Make
    file.build:149: recipe for target 'gpio-event-mon-in.o' failed

it looks like it might be a parallel build issue, where gpio-event-mon-in.o
needs gpio-utils.o, but it is not yet built.
Comment 3 Thomas Petazzoni 2017-08-30 18:05:08 UTC
Well, I'm pretty sure its the issue fixed for perf by https://patchwork.ozlabs.org/patch/729154/. When ld is used directly for linking, it needs to be explicitly told the endianness.
Comment 4 Yann E. MORIN 2017-08-30 19:06:20 UTC
Thomas, I can very easily reproduce the truncated file issue, and it
indeed always happen with parallel builds, but not always.

And I can even reproduce it in a native build, on Linus' linux master:

$ make -j1000
mkdir -p include/linux 2>&1 || true
ln -sf /home/ymorin/dev/linux/linux/tools/gpio/../../include/uapi/linux/gpio.h include/linux/gpio.h
make -f /home/ymorin/dev/linux/linux/tools/build/Makefile.build dir=. obj=lsgpio
make -f /home/ymorin/dev/linux/linux/tools/build/Makefile.build dir=. obj=gpio-hammer
make -f /home/ymorin/dev/linux/linux/tools/build/Makefile.build dir=. obj=gpio-event-mon
make[1]: Entering directory '/home/ymorin/dev/linux/linux/tools/gpio'
make[1]: Entering directory '/home/ymorin/dev/linux/linux/tools/gpio'
make[1]: Entering directory '/home/ymorin/dev/linux/linux/tools/gpio'
  CC       gpio-event-mon.o
  CC       lsgpio.o
  CC       gpio-hammer.o
  CC       gpio-utils.o
  CC       gpio-utils.o
  CC       gpio-utils.o
gpio-event-mon.c: In function ‘monitor_device’:
gpio-event-mon.c:100:19: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘__u64 {aka long long unsigned int}’ [-Wformat=]
   fprintf(stdout, "GPIO EVENT %" PRIu64 ": ", event.timestamp);
                   ^~~~~~~~~~~~~~
  LD       gpio-event-mon-in.o
gpio-utils.o: file not recognized: File truncated
/home/ymorin/dev/linux/linux/tools/build/Makefile.build:143: recipe for target 'gpio-event-mon-in.o' failed
make[1]: *** [gpio-event-mon-in.o] Error 1
make[1]: Leaving directory '/home/ymorin/dev/linux/linux/tools/gpio'
Makefile:58: recipe for target 'gpio-event-mon-in.o' failed
make: *** [gpio-event-mon-in.o] Error 2
make: *** Waiting for unfinished jobs....
  LD       lsgpio-in.o
make[1]: Leaving directory '/home/ymorin/dev/linux/linux/tools/gpio'
  LD       gpio-hammer-in.o
make[1]: Leaving directory '/home/ymorin/dev/linux/linux/tools/gpio'


Yet, you are right that there is also (and more importantly) a
problem with using ld instead of gcc.

So, there are two issues in one. ;-)
Comment 5 Yann E. MORIN 2024-06-15 14:47:49 UTC
THank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!