Skip to contentSkip to conversation

Fix cross-compilation issue with randbytes

PATCH In review Krzesimir Nowak 4 participants 6 messages Sep 26, 2023 – Oct 11, 2023

lore
Share & tools
lore
#0 lore raw

cover Fix cross-compilation issue with randbytes

Hi,

I hope this is the right place to send the xfsprogs patches - the documentation about contributing is rather scarce.

This is a patch that we carry in Flatcar in order to make xfsprogs buildable.

I think that the issue with cross-compilation is here since d8a19f2986c0f65c5ed02110192f3fd5f86e2b32.

Krzesimir Nowak (1):
libfrog: Fix cross-compilation issue with randbytes

 libfrog/randbytes.c | 1 -
 libfrog/randbytes.h | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 libfrog: Fix cross-compilation issue with randbytes

randbytes.c was mostly split off from crc32.c and, like crc32.c, is used for selftests, which are run on the build host. As such it should not include platform_defs.h which in turn includes urcu.h from userspace-rcu library, because the build host might not have the library installed.

---
 libfrog/randbytes.c | 1 -
 libfrog/randbytes.h | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)
libfrog/randbytes.c +0 -1
index f22da0d3..2023b601 100644
@@ -6,7 +6,6 @@
  *
  * This is the buffer of random bytes used for self tests.
  */
-#include "platform_defs.h"
 #include "libfrog/randbytes.h"
 
 /* 4096 random bytes */
libfrog/randbytes.h +2 -0
index 00fd7c4c..fddea9c7 100644
@@ -6,6 +6,8 @@
 #ifndef __LIBFROG_RANDBYTES_H__
 #define __LIBFROG_RANDBYTES_H__
 
+#include <stdint.h>
+
 extern uint8_t randbytes_test_buf[];
 
 #endif /* __LIBFROG_RANDBYTES_H__ */
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 1/1] libfrog: Fix cross-compilation issue with randbytes

Quoted 5 lines · Krzesimir Nowak

randbytes.c was mostly split off from crc32.c and, like crc32.c, is used for selftests, which are run on the build host. As such it should not include platform_defs.h which in turn includes urcu.h from userspace-rcu library, because the build host might not have the library installed.

Why not get rid of the build host crc32c selftest? It's not that useful for cross-compiling and nowadays mkfs.xfs and xfs_repair have their own builtin selftests. Anyone messing with xfsprogs should be running fstests (in addition to the maintainers) so I don't really see the point of running crc32cselftest on the *build* host.

(Carlos: any thoughts on this?)

--D

Quoted 34 lines
---
 libfrog/randbytes.c | 1 -
 libfrog/randbytes.h | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)
libfrog/randbytes.c +0 -1
index f22da0d3..2023b601 100644
@@ -6,7 +6,6 @@
  *
  * This is the buffer of random bytes used for self tests.
  */
-#include "platform_defs.h"
 #include "libfrog/randbytes.h"
 
 /* 4096 random bytes */
libfrog/randbytes.h +2 -0
index 00fd7c4c..fddea9c7 100644
@@ -6,6 +6,8 @@
 #ifndef __LIBFROG_RANDBYTES_H__
 #define __LIBFROG_RANDBYTES_H__
 
+#include <stdint.h>
+
 extern uint8_t randbytes_test_buf[];
 
 #endif /* __LIBFROG_RANDBYTES_H__ */
Signature · 1 line
2.25.1
#3 lore raw

Re: [PATCH 1/1] libfrog: Fix cross-compilation issue with randbytes

Quoted 7 lines · Darrick J. Wong
Quoted 5 lines · Krzesimir Nowak

randbytes.c was mostly split off from crc32.c and, like crc32.c, is used for selftests, which are run on the build host. As such it should not include platform_defs.h which in turn includes urcu.h from userspace-rcu library, because the build host might not have the library installed.

Quoted 5 lines

Why not get rid of the build host crc32c selftest? It's not that useful for cross-compiling and nowadays mkfs.xfs and xfs_repair have their own builtin selftests. Anyone messing with xfsprogs should be running fstests (in addition to the maintainers) so I don't really see the point of running crc32cselftest on the *build* host.

Agreed. Running the test on the build-host served a purpose a decade ago when we first added crc support to the on-disk format. I don't think it is necessary to do this anymore...

-Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#4 lore raw

Re: [PATCH 1/1] libfrog: Fix cross-compilation issue with randbytes

In reply to Darrick J. Wong
Quoted 7 lines · Darrick J. Wong
Quoted 5 lines · Krzesimir Nowak

randbytes.c was mostly split off from crc32.c and, like crc32.c, is used for selftests, which are run on the build host. As such it should not include platform_defs.h which in turn includes urcu.h from userspace-rcu library, because the build host might not have the library installed.

Quoted 7 lines

Why not get rid of the build host crc32c selftest? It's not that useful for cross-compiling and nowadays mkfs.xfs and xfs_repair have their own builtin selftests. Anyone messing with xfsprogs should be running fstests (in addition to the maintainers) so I don't really see the point of running crc32cselftest on the *build* host.

(Carlos: any thoughts on this?)

/me back from holidays...

Yeah, sounds reasonable, IMO crc32selftest can go.

Carlos

Quoted 37 lines

--D

Quoted 34 lines
---
 libfrog/randbytes.c | 1 -
 libfrog/randbytes.h | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)
libfrog/randbytes.c +0 -1
index f22da0d3..2023b601 100644
@@ -6,7 +6,6 @@
  *
  * This is the buffer of random bytes used for self tests.
  */
-#include "platform_defs.h"
 #include "libfrog/randbytes.h"
 
 /* 4096 random bytes */
libfrog/randbytes.h +2 -1
index 00fd7c4c..fddea9c7 100644
@@ -6,6 +6,8 @@
 #ifndef __LIBFROG_RANDBYTES_H__
 #define __LIBFROG_RANDBYTES_H__
 
+#include <stdint.h>
+
 extern uint8_t randbytes_test_buf[];
 
 #endif /* __LIBFROG_RANDBYTES_H__ */
--

2.25.1

#5 lore raw

Re: [PATCH 1/1] libfrog: Fix cross-compilation issue with randbytes

wt., 3 paź 2023 o 13:15 Carlos Maiolino <[email protected]> napisał(a):

Quoted 15 lines · Darrick J. Wong
Quoted 13 lines · Krzesimir Nowak
Quoted 5 lines

randbytes.c was mostly split off from crc32.c and, like crc32.c, is used for selftests, which are run on the build host. As such it should not include platform_defs.h which in turn includes urcu.h from userspace-rcu library, because the build host might not have the library installed.

Why not get rid of the build host crc32c selftest? It's not that useful for cross-compiling and nowadays mkfs.xfs and xfs_repair have their own builtin selftests. Anyone messing with xfsprogs should be running fstests (in addition to the maintainers) so I don't really see the point of running crc32cselftest on the *build* host.

Quoted 5 lines
Quoted 1 line

(Carlos: any thoughts on this?)

/me back from holidays...

Yeah, sounds reasonable, IMO crc32selftest can go.

Hi,

There's a follow-up patch that I have sent - it drops the crc32 selftest:

https://marc.info/?l=linux-xfs&m=169590021227419&w=2

Not sure if there is anything else I should do. If so, please let me know. Thanks!

Cheers,
Krzesimir

Quoted 40 lines

Carlos

Quoted 37 lines

--D

Quoted 34 lines
---
 libfrog/randbytes.c | 1 -
 libfrog/randbytes.h | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)
libfrog/randbytes.c +0 -1
index f22da0d3..2023b601 100644
@@ -6,7 +6,6 @@
  *
  * This is the buffer of random bytes used for self tests.
  */
-#include "platform_defs.h"
 #include "libfrog/randbytes.h"
 
 /* 4096 random bytes */
libfrog/randbytes.h +2 -1
index 00fd7c4c..fddea9c7 100644
@@ -6,6 +6,8 @@
 #ifndef __LIBFROG_RANDBYTES_H__
 #define __LIBFROG_RANDBYTES_H__
 
+#include <stdint.h>
+
 extern uint8_t randbytes_test_buf[];
 
 #endif /* __LIBFROG_RANDBYTES_H__ */
--

2.25.1