Hello,
I wanted wanted to note that attempting to build GRUB with clang (I
used clang-19 on Debian 13) fails with the following errors:
clang -DHAVE_CONFIG_H -I. -Wall -W -DGRUB_UTIL=1
-D_FILE_OFFSET_BITS=64 -I./include
-DGRUB_FILE=\"grub-core/lib/libgcrypt-grub/cipher/arcfour.c\" -I. -I.
-I. -I. -I./include -I./include -I./grub-core/lib/libgcrypt-grub/src/
-I./grub-core/lib/libgcrypt_wrap -I./grub-core/lib/posix_wrap
-D_GCRYPT_IN_LIBGCRYPT=1 -D_GCRYPT_CONFIG_H_INCLUDED=1
-I./include/grub/gcrypt -D_FILE_OFFSET_BITS=64 -std=gnu99 -fno-common
-Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment
-Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero
-Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k
-Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain
-Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses
-Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch
-Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function
-Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable
-Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wcast-align
-Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast
-Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla
-Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros
-Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs
-Wmissing-prototypes -Wmissing-declarations -Wformat=2 -Werror
-Wno-error=vla -Wno-sign-compare -Wno-missing-field-initializers
-Wno-redundant-decls -Wno-undef -fno-builtin -MT
grub-core/lib/libgcrypt-grub/cipher/libgrubgcry_a-arcfour.o -MD -MP
-MF grub-core/lib/libgcrypt-grub/cipher/.deps-util/libgrubgcry_a-arcfour.Tpo
-c -o grub-core/lib/libgcrypt-grub/cipher/libgrubgcry_a-arcfour.o
`test -f 'grub-core/lib/libgcrypt-grub/cipher/arcfour.c' || echo
'./'`grub-core/lib/libgcrypt-grub/cipher/arcfour.c
In file included from grub-core/lib/libgcrypt-grub/cipher/arcfour.c:30:
In file included from grub-core/lib/libgcrypt-grub/cipher/types.h:2:
In file included from ./grub-core/lib/libgcrypt_wrap/cipher_wrap.h:76:
In file included from ./include/grub/gcrypt/g10lib.h:42:
In file included from ./grub-core/lib/libgcrypt-grub/src/visibility.h:1:
./include/grub/gcrypt/gcrypt.h:343:27: error: redefinition of typedef
'gcry_sexp_t' is a C11 feature [-Werror,-Wtypedef-redefinition]
343 | typedef struct gcry_sexp *gcry_sexp_t;
| ^
./include/grub/crypto.h:254:27: note: previous definition is here
254 | typedef struct gcry_sexp *gcry_sexp_t;
| ^
In file included from grub-core/lib/libgcrypt-grub/cipher/arcfour.c:30:
In file included from grub-core/lib/libgcrypt-grub/cipher/types.h:2:
In file included from ./grub-core/lib/libgcrypt_wrap/cipher_wrap.h:76:
In file included from ./include/grub/gcrypt/g10lib.h:42:
In file included from ./grub-core/lib/libgcrypt-grub/src/visibility.h:1:
./include/grub/gcrypt/gcrypt.h:1331:4: error: redefinition of typedef
'gcry_md_hd_t' is a C11 feature [-Werror,-Wtypedef-redefinition]
1331 | } *gcry_md_hd_t;
| ^
./include/grub/crypto.h:248:31: note: previous definition is here
248 | typedef struct gcry_md_handle*gcry_md_hd_t;
| ^
In file included from grub-core/lib/libgcrypt-grub/cipher/arcfour.c:30:
In file included from grub-core/lib/libgcrypt-grub/cipher/types.h:2:
In file included from ./grub-core/lib/libgcrypt_wrap/cipher_wrap.h:76:
In file included from ./include/grub/gcrypt/g10lib.h:42:
In file included from ./grub-core/lib/libgcrypt-grub/src/visibility.h:1:
In file included from ./include/grub/gcrypt/gcrypt.h:2112:
./grub-core/lib/libgcrypt-grub/src/types.h:62:26: error: redefinition
of typedef 'byte' is a C11 feature [-Werror,-Wtypedef-redefinition]
62 | typedef unsigned char byte;
| ^
./grub-core/lib/posix_wrap/sys/types.h:52:22: note: previous definition is here
52 | typedef grub_uint8_t byte;
| ^
In file included from grub-core/lib/libgcrypt-grub/cipher/arcfour.c:30:
In file included from grub-core/lib/libgcrypt-grub/cipher/types.h:2:
In file included from ./grub-core/lib/libgcrypt_wrap/cipher_wrap.h:76:
In file included from ./include/grub/gcrypt/g10lib.h:42:
In file included from ./grub-core/lib/libgcrypt-grub/src/visibility.h:1:
In file included from ./include/grub/gcrypt/gcrypt.h:2112:
./grub-core/lib/libgcrypt-grub/src/types.h:78:27: error: redefinition
of typedef 'u16' is a C11 feature [-Werror,-Wtypedef-redefinition]
78 | typedef unsigned short u16;
| ^
./grub-core/lib/posix_wrap/sys/types.h:49:23: note: previous definition is here
49 | typedef grub_uint16_t u16;
| ^
In file included from grub-core/lib/libgcrypt-grub/cipher/arcfour.c:30:
In file included from grub-core/lib/libgcrypt-grub/cipher/types.h:2:
In file included from ./grub-core/lib/libgcrypt_wrap/cipher_wrap.h:76:
In file included from ./include/grub/gcrypt/g10lib.h:42:
In file included from ./grub-core/lib/libgcrypt-grub/src/visibility.h:1:
In file included from ./include/grub/gcrypt/gcrypt.h:2112:
./grub-core/lib/libgcrypt-grub/src/types.h:88:26: error: redefinition
of typedef 'u32' is a C11 feature [-Werror,-Wtypedef-redefinition]
88 | typedef unsigned int u32;
| ^
./grub-core/lib/posix_wrap/sys/types.h:46:23: note: previous definition is here
46 | typedef grub_uint32_t u32;
| ^
5 errors generated.
make[2]: *** [Makefile:6476:
grub-core/lib/libgcrypt-grub/cipher/libgrubgcry_a-arcfour.o] Error 1
make[2]: Leaving directory '/home/adhamilt/grub2'
make[1]: *** [Makefile:12695: all-recursive] Error 1
make[1]: Leaving directory '/home/adhamilt/grub2'
make: *** [Makefile:4103: all] Error 2
Steps to reproduce:
Install clang
./bootstrap
./configure BUILD_CC=clang HOST_CC=clang TARGET_CC=clang CC=clang
make
I will attempt to look into this, but wanted to just report this in
case I didn't resolve it prior to the 2.14 release in case it's a
major issue for anyone.
Thanks,
Andrew
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel