Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross compile build for armv7l fails due to incompatible type(s) #270

Open
ppenguin opened this issue Sep 12, 2024 · 4 comments
Open

Cross compile build for armv7l fails due to incompatible type(s) #270

ppenguin opened this issue Sep 12, 2024 · 4 comments

Comments

@ppenguin
Copy link

Error log:

armv7l-unknown-linux-gnueabihf-gcc -Og  -g3 -Wall -Wextra  -Werror  -std=gnu11 -funsigned-char -fvisibility=hidden -specs=/build/source/src/include/gcc.specs -fno-merge-constants  -fPIC  -DLIBEFIVAR_VERSION=39 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -I/build/source/src/include/ -c -o esl-iter.o esl-iter.c
esl-iter.c: In function 'esl_list_iter_next_with_size_correction':
esl-iter.c:338:80: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'off_t' {aka 'long long int'} [-Werror=format=]
  338 |                                 warnx("correcting ESL size from %d to %jd at %lx",
      |                                                                              ~~^
      |                                                                                |
      |                                                                                long unsigned int
      |                                                                              %llx
  339 |                                       iter->esl->signature_list_size,
  340 |                                       (intmax_t)(iter->len - iter->offset), iter->offset);
      |                                                                             ~~~~~~~~~~~~
      |                                                                                 |
      |                                                                                 off_t {aka long long int}
esl-iter.c:363:82: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'off_t' {aka 'long long int'} [-Werror=format=]
  363 |                                 warnx("correcting ESL size from %d to %jd at 0x%lx",
      |                                                                                ~~^
      |                                                                                  |
      |                                                                                  long unsigned int
      |                                                                                %llx
  364 |                                       iter->esl->signature_list_size,
  365 |                                       (intmax_t)(iter->len - iter->offset), iter->offset);
      |                                                                             ~~~~~~~~~~~~
      |                                                                                 |
      |                                                                                 off_t {aka long long int}
esl-iter.c:396:29: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  396 |                 iter->esl = (efi_signature_list_t *)((intptr_t)iter->buf
      |                             ^
esl-iter.c:414:74: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'off_t' {aka 'long long int'} [-Werror=format=]
  414 |                         warnx("correcting ESL size from %d to %jd at 0x%lx",
      |                                                                        ~~^
      |                                                                          |
      |                                                                          long unsigned int
      |                                                                        %llx
  415 |                               iter->esl->signature_list_size,
  416 |                               (intmax_t)(iter->len - iter->offset), iter->offset);
      |                                                                     ~~~~~~~~~~~~
      |                                                                         |
      |                                                                         off_t {aka long long int}
cc1: all warnings being treated as errors
make[1]: *** [/build/source/src/include/rules.mk:53: esl-iter.o] Error 1
make[1]: Leaving directory '/build/source/src'
make: *** [Makefile:17: all] Error 2
@sternenseemann
Copy link

This affects 32 bit systems in general, including e.g. native compilation on i686-linux.

@ppenguin
Copy link
Author

ppenguin commented Sep 19, 2024

This affects 32 bit systems in general, including e.g. native compilation on i686-linux.

I made a naive fix here (sorry for the auto-reformat, don't know what the original formatter was), it built fine but I didn't get to test it, because in the end it was not the last problem...

@gcoremans
Copy link

I'm also affected by this issue, cross-compiling an armv7l boot image on x64 using nix.

@puffnfresh
Copy link

puffnfresh commented Nov 26, 2024

@gcoremans I also hit this just two days ago, doing the same. Since your armv7l image probably won't be using EFI, you can probably safely remove it:

nixpkgs.overlays = [
  (self: super: {
    efivar = pkgs.runCommand "empty-efivar" { } "touch $out";
    efibootmgr = pkgs.runCommand "empty-efibootmgr" { } "touch $out";
  })
];

But then you'll hit many other issues, like I did.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants