sedutil
sedutil copied to clipboard
PBA compilation fails with long / long long confusion
At the ./buildpbaroot
section >>> sedutil custom Building
I ran into the following problem:
depbase=`echo LinuxPBA/LinuxPBA.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
/root/sedutil/images/scratch/buildroot/32bit/host/bin/i686-buildroot-linux-gnu-g++ -DHAVE_CONFIG_H -I. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Werror -std=c++11 -ftabstop=4 -I./Common -I./Common/pbkdf2 -I./linux -I./LinuxPBA -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -MT LinuxPBA/LinuxPBA.o -MD -MP -MF $depbase.Tpo -c -o LinuxPBA/LinuxPBA.o LinuxPBA/LinuxPBA.cpp &&\
mv -f $depbase.Tpo $depbase.Po
Common/DtaDevOpal.cpp: In member function ‘virtual uint8_t DtaDevOpal::getACE(const char*, const char*, const char*, uint32_t)’:
Common/DtaDevOpal.cpp:2693:12: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
printf("Row: 0x%016lx, value:", row);
^~~~~~~~~~~~~~~~~~~~~~~ ~~~
Common/DtaDevOpal.cpp:2706:24: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
printf(" UID: 0x%016lx", value);
^~~~~~~~~~~~~~~~ ~~~~~
Common/DtaDevOpal.cpp:2718:28: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
printf("Unknown (0x%lx)", value);
^~~~~~~~~~~~~~~~~ ~~~~~
depbase=`echo LinuxPBA/GetPassPhrase.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
/root/sedutil/images/scratch/buildroot/32bit/host/bin/i686-buildroot-linux-gnu-g++ -DHAVE_CONFIG_H -I. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Werror -std=c++11 -ftabstop=4 -I./Common -I./Common/pbkdf2 -I./linux -I./LinuxPBA -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -MT LinuxPBA/GetPassPhrase.o -MD -MP -MF $depbase.Tpo -c -o LinuxPBA/GetPassPhrase.o LinuxPBA/GetPassPhrase.cpp &&\
mv -f $depbase.Tpo $depbase.Po
Common/DtaDevOpal.cpp: In member function ‘uint8_t DtaDevOpal::getTableRow(const std::vector<unsigned char>&, const tableDesc_t*, OPAL_UID, OPAL_UID, const string&, rowMap_t&, uint8_t)’:
Common/DtaDevOpal.cpp:4004:14: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
printf(" Column: %2d, Name: '%s', Value: %lxh\n",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
column, columnName, response.getUint64(i));
~~~~~~~~~~~~~~~~~~~~~
Common/DtaDevOpal.cpp:4007:24: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long long unsigned int’} [-Werror=format=]
sprintf(valueStr, "%lxh", response.getUint64(i));
^~~~~~ ~~~~~~~~~~~~~~~~~~~~~
...
cc1plus: all warnings being treated as errors
make[3]: *** [Makefile:667: Common/DtaDevOpal.o] Error 1
make[2]: *** [Makefile:416: all] Error 2
make[1]: *** [package/pkg-generic.mk:241: /root/sedutil/images/scratch/buildroot/32bit/build/sedutil-custom/.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2
Perhaps %llx
/ %llxh
is required? I tried applying this patch to scratch/buildroot/dl/sedutil-1.15.1/Common/DtaDevOpal.cpp
and then to scratch/buildroot/32bit/build/sedutil-custom/Common/DtaDevOpal.cpp
when that didn't work, disabling the cleaning options in buildpbaroot. This last patch allowed PBA compilation to complete, and BIOS/UEFI/Rescue images to be built.
--- DtaDevOpal.cpp.orig 2023-09-29 18:40:23.163933116 +0000
+++ DtaDevOpal.cpp 2023-09-29 18:42:04.025203954 +0000
@@ -2690,7 +2690,7 @@
uint64_t row = 0;
for (int i = 1; i <= 8; i++) row = (row << 8) + tableRow[i];
- printf("Row: 0x%016lx, value:", row);
+ printf("Row: 0x%016llx, value:", row);
uint32_t name = 0;
uint64_t value = 0;
@@ -2703,7 +2703,7 @@
if (name == 0x00000C05) {
count = response.getBytes(++index, bytes);
for (int i = 0; i < count; i++) value = (value << 8) + bytes[i];
- printf(" UID: 0x%016lx", value);
+ printf(" UID: 0x%016llx", value);
}
else if (name == 0x0000040E) {
value = response.getUint64(++index);
@@ -2715,7 +2715,7 @@
} else if (value == 2) {
printf("NOT");
} else {
- printf("Unknown (0x%lx)", value);
+ printf("Unknown (0x%llx)", value);
}
}
index += 2; // skip end name
@@ -4001,10 +4001,10 @@
else {
if (response.isByteSequence(i) == 0) {
if (level > 1) {
- printf(" Column: %2d, Name: '%s', Value: %lxh\n",
+ printf(" Column: %2d, Name: '%s', Value: %llxh\n",
column, columnName, response.getUint64(i));
}
- sprintf(valueStr, "%lxh", response.getUint64(i));
+ sprintf(valueStr, "%llxh", response.getUint64(i));
} else {
uint8_t buffer[64];
char str[140];
The compilation took place on a Debian buster rescue system. uname -a
was Linux rescue-customer-eu 6.1.38-mod-std #2923295 SMP PREEMPT_DYNAMIC Fri Sep 22 21:49:31 UTC 2023 x86_64 GNU/Linux
and gcc -v
shows gcc version 8.3.0 (Debian 8.3.0-6)