rhboot / efivar

Tools and libraries to work with EFI variables
GNU Lesser General Public License v2.1
238 stars 104 forks source link

Cross compile build fails with uClibc #244

Open Sangeetha-E opened 1 year ago

Sangeetha-E commented 1 year ago

Hi,

While cross compiling efivar-38 with uClibc I am getting the following error.

In file included from efivar.h:32,
                 from dp-acpi.c:14:
makeguids.h: In function 'read_guids_at':
makeguids.h:61:39: error: 'AT_EMPTY_PATH' undeclared (first use in this function)
      || (path[0] == '\0' && !(dirfd & AT_EMPTY_PATH))
                                       ^~~~~~~~~~~~~
makeguids.h:61:39: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [efivar-38/src/include/rules.mk:56: dp-acpi.o] Error 1
In file included from efivar.h:32,
                 from dp.c:13:
makeguids.h: In function 'read_guids_at':
makeguids.h:61:39: error: 'AT_EMPTY_PATH' undeclared (first use in this function)
      || (path[0] == '\0' && !(dirfd & AT_EMPTY_PATH))
                                       ^~~~~~~~~~~~~
makeguids.h:61:39: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [efivar-38/src/include/rules.mk:56: dp.o] Error 1
In file included from efivar.h:32,
                 from dp-hw.c:12:
makeguids.h: In function 'read_guids_at':
makeguids.h:61:39: error: 'AT_EMPTY_PATH' undeclared (first use in this function)
      || (path[0] == '\0' && !(dirfd & AT_EMPTY_PATH))
                                       ^~~~~~~~~~~~~
makeguids.h:61:39: note: each undeclared identifier is reported only once for each function ,5085:0it appears in
make[2]: *** [efivar-38/src/include/rules.mk:56: dp-hw.o] Error 1
In file included from efivar.h:32,
                 from efiboot.h:10,
                 from error.c:23:
makeguids.h: In function 'read_guids_at':
makeguids.h:61:39: error: 'AT_EMPTY_PATH' undeclared (first use in this function)
      || (path[0] == '\0' && !(dirfd & AT_EMPTY_PATH))
                                       ^~~~~~~~~~~~~
makeguids.h:61:39: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [efivar-38/src/include/rules.mk:56: error.o] Error 1
In file included from efivar.h:32,
                 from efivarfs.c:23:
makeguids.h: In function 'read_guids_at':
makeguids.h:61:39: error: 'AT_EMPTY_PATH' undeclared (first use in this function)
      || (path[0] == '\0' && !(dirfd & AT_EMPTY_PATH))
                                       ^~~~~~~~~~~~~
makeguids.h:61:39: note: each undeclared identifier is reported only once for each function it appears in
efivarfs.c: In function 'get_efivarfs_path':
efivarfs.c:40:18: warning: implicit declaration of function 'secure_getenv' [-Wimplicit-function-declaration]
  efivarfs_path = secure_getenv("EFIVARFS_PATH");
                  ^~~~~~~~~~~~~
efivarfs.c:40:16: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
  efivarfs_path = secure_getenv("EFIVARFS_PATH");
                ^
make[2]: *** [efivar-38/src/include/rules.mk:56: efivarfs.o] Error 1
In file included from efivar.h:32,
                 from dp-media.c:14:
makeguids.h: In function 'read_guids_at':
makeguids.h:61:39: error: 'AT_EMPTY_PATH' undeclared (first use in this function)
      || (path[0] == '\0' && !(dirfd & AT_EMPTY_PATH))
                                       ^~~~~~~~~~~~~
makeguids.h:61:39: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [efivar-38/src/include/rules.mk:56: dp-media.o] Error 1
In file included from efivar.h:32,
                 from guid.c:13:
makeguids.h: In function 'read_guids_at':
makeguids.h:61:39: error: 'AT_EMPTY_PATH' undeclared (first use in this function)
      || (path[0] == '\0' && !(dirfd & AT_EMPTY_PATH))
                                       ^~~~~~~~~~~~~
makeguids.h:61:39: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [efivar-38/src/include/rules.mk:56: guid.o] Error 1
In file included from efivar.h:32,
                 from dp-message.c:14:
makeguids.h: In function 'read_guids_at':
makeguids.h:61:39: error: 'AT_EMPTY_PATH' undeclared (first use in this function)
      || (path[0] == '\0' && !(dirfd & AT_EMPTY_PATH))
                                       ^~~~~~~~~~~~~
makeguids.h:61:39: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [efivar-38/src/include/rules.mk:56: dp-message.o] Error 1
In file included from efivar.h:32,
                 from export.c:13:
makeguids.h: In function 'read_guids_at':
makeguids.h:61:39: error: 'AT_EMPTY_PATH' undeclared (first use in this function)
      || (path[0] == '\0' && !(dirfd & AT_EMPTY_PATH))
                                       ^~~~~~~~~~~~~
makeguids.h:61:39: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [efivar-38/src/include/rules.mk:56: export.o] Error 1
In file included from efivar.h:32,
                 from lib.c:17:
makeguids.h: In function 'read_guids_at':
makeguids.h:61:39: error: 'AT_EMPTY_PATH' undeclared (first use in this function)
      || (path[0] == '\0' && !(dirfd & AT_EMPTY_PATH))
                                       ^~~~~~~~~~~~~
makeguids.h:61:39: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [efivar-38/src/include/rules.mk:56: lib.o] Error 1
make[2]: Leaving directory 'efivar-38/src'
make[1]: *** [Makefile:14: all] Error 2
make[1]: Leaving directory 'efivar-38'
make: *** [include/common.mk:740: .stamp_built] Error 2

Because the uClibc doesn't have the "AT_EMPTY_PATH" definition.

So I have created patch to solve this issue.

diff -Naur efivar-38.orig/src/efivar.h efivar-38/src/efivar.h
--- efivar-38.orig/src/efivar.h 2022-01-15 00:59:35.000000000 +0530
+++ efivar-38/src/efivar.h  2023-05-11 10:52:00.566203925 +0530
@@ -29,7 +29,6 @@
 #include "crc32.h"
 #include "hexdump.h"
 #include "path-helpers.h"
-#include "makeguids.h"

 #endif /* !PRIVATE_EFIVAR_H_ */

diff -Naur efivar-38.orig/src/makeguids.c efivar-38/src/makeguids.c
--- efivar-38.orig/src/makeguids.c  2022-01-15 00:59:35.000000000 +0530
+++ efivar-38/src/makeguids.c   2023-05-11 10:52:07.998352591 +0530
@@ -14,6 +14,7 @@
 #include <sys/stat.h>

 #include "efivar.h"
+#include "makeguids.h"
 #include "guid.h"

 #pragma GCC diagnostic ignored "-Wunused-parameter"

Kindly give me suggestions about this patch.