Page 1 of 1

[Solved] GRUB with EFI fails to compile, type error

Posted: Sat Oct 01, 2016 8:52 am
by Mikumiku747
Pretty straightforward, I've been trying to get grub to build with EFI stuff, but to no avail, here's where I'm stuck now:


After the following ./configure:

Code: Select all

CFLAGS="-Wno-error" ./configure --with-platform=efi --target=x86_64 && make
... I get a crash during the make

Code: Select all

gcc -Iutil/mkisofs -I./util/mkisofs -I. -I./include -I./gnulib -I./include -Wall -W -DGRUB_LIBDIR=\"/usr/local/lib/`echo grub/x86_64-efi | sed 's,x,x,'`\" -DLOCALEDIR=\"\" -Wno-error -DGRUB_MACHINE_EFI=1 -DGRUB_UTIL=1 -D_FILE_OFFSET_BITS=64 -I./util/mkisofs/include -Wno-all -Werror -MD -c -o grub_mkisofs-util_mkisofs_mkisofs.o util/mkisofs/mkisofs.c
util/mkisofs/mkisofs.c: In function ‘main’:
util/mkisofs/mkisofs.c:1405:7: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ [-Werror=format=]
       fprintf (stderr, _("%llu extents written (%llu MiB)\n"), last_extent, last_extent >> 9);
       ^
util/mkisofs/mkisofs.c:1405:7: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’ [-Werror=format=]
cc1: all warnings being treated as errors
make: *** [grub_mkisofs-util_mkisofs_mkisofs.o] Error 1
Here's the snippet in question which crashes, the full code is at the paste here (and of course, in the GRUB source): http://pastebin.com/NvPSsv3q

Code: Select all

#endif
      fprintf (stderr, _("%llu extents written (%llu MiB)\n"), last_extent, last_extent >> 9);
    }
I'm not too sure why the types don't match, my guess is that there would be something wrong with the way GRUB did one of it's type definitions, but that's just a guess. Another thing that probably affects it is that I'm using WSL, but I can't test on a real linux 64 bit machine at the moment, so if all else looks good, that might be it. My gcc's machinedump is x86_64-linux-gnu, for reference.

If you've looked at the source and at the variable declaration, obviously, I can just edit the source to cast them to unsigned long long when it prints them, but that seems like a band-aid fix, is there a more fundamental problem with the way I'm compiling this? I'll try editing the source anyway and get back shortly with a reply detailing how it went. If I take a while, assume it didn't go well.

- Mikumiku747

Re: GRUB with EFI fails to compile, long long int type error

Posted: Sat Oct 01, 2016 8:57 am
by Mikumiku747
I tried editing the source, they make a lot of print calls with "%llu" s being used to print uint64_t. I could go through the mkisofs utility and find all of them, but that seems extraordinarily strange and stupid, and not a real fix to the problem. So I'm still open to any real fixes.

Re: GRUB with EFI fails to compile, long long int type error

Posted: Sat Oct 01, 2016 9:06 am
by Mikumiku747
Well, I actually spent some time and went through and casted all the uint64_ts to long long unsigned ints, there were only about 20 of them. However, now I'm getting a different error, "unrecognized command line option: -melf_x86_64". However, that's on a different vein entirely, so this thread's done for now.