All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: tools: fix build on macOS
@ 2021-02-14  5:01 Ryan Burns
  2021-06-21 14:59 ` H. Nikolaus Schaller
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Burns @ 2021-02-14  5:01 UTC (permalink / raw)
  To: linux-mips

macOS does not have byteswap.h, but we can use Apple's libkern/OSByteOrder.h instead.

This issue is encountered during cross-compilation from macOS to MIPS in nixpkgs.
You can view a log of the build failure here:
https://hydra.nixos.org/build/136015790/nixlog/1
   
Signed-off-by: Ryan Burns <rtburns@protonmail.com>
---
arch/mips/boot/tools/relocs.h      | 11 +++++++++--
arch/mips/boot/tools/relocs_main.c |  1 -
arch/mips/tools/elf-entry.c        | 11 +++++++++--
3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/arch/mips/boot/tools/relocs.h b/arch/mips/boot/tools/relocs.h
index 607ff0103064..5de9bb7a7e09 100644
--- a/arch/mips/boot/tools/relocs.h
+++ b/arch/mips/boot/tools/relocs.h
@@ -11,9 +11,16 @@
#include <errno.h>
#include <unistd.h>
#include <elf.h>
-#include <byteswap.h>
#define USE_BSD
-#include <endian.h>
+#if defined(__APPLE__)
+# include <libkern/OSByteOrder.h>
+# define bswap_16 OSSwapInt16
+# define bswap_32 OSSwapInt32
+# define bswap_64 OSSwapInt64
+#else
+# include <byteswap.h>
+# include <endian.h>
+#endif
#include <regex.h>

void die(char *fmt, ...);
diff --git a/arch/mips/boot/tools/relocs_main.c b/arch/mips/boot/tools/relocs_main.c
index e2453a564b11..4ef51d1e6d0d 100644
--- a/arch/mips/boot/tools/relocs_main.c
+++ b/arch/mips/boot/tools/relocs_main.c
@@ -6,7 +6,6 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <endian.h>
#include <elf.h>

#include "relocs.h"
diff --git a/arch/mips/tools/elf-entry.c b/arch/mips/tools/elf-entry.c
index dbd14ff05b4c..5d2e2ab4b3b0 100644
--- a/arch/mips/tools/elf-entry.c
+++ b/arch/mips/tools/elf-entry.c
@@ -1,7 +1,14 @@
// SPDX-License-Identifier: GPL-2.0
-#include <byteswap.h>
+#if defined(__APPLE__)
+# include <libkern/OSByteOrder.h>
+# define bswap_16 OSSwapInt16
+# define bswap_32 OSSwapInt32
+# define bswap_64 OSSwapInt64
+#else
+# include <byteswap.h>
+# include <endian.h>
+#endif
#include <elf.h>
-#include <endian.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: tools: fix build on macOS
  2021-02-14  5:01 [PATCH] MIPS: tools: fix build on macOS Ryan Burns
@ 2021-06-21 14:59 ` H. Nikolaus Schaller
  2021-06-24  1:18   ` Ryan Burns
  0 siblings, 1 reply; 3+ messages in thread
From: H. Nikolaus Schaller @ 2021-06-21 14:59 UTC (permalink / raw)
  To: Ryan Burns; +Cc: linux-mips

Hi Ryan,
what happened to that patch? I haven't found a discussion or that it was merged.

I have used it and it seems solve a cross-compilation issue (have to cross-chek if it is still the case with 5.13-rc7).

Maybe the maintainers did not become aware of?

BR and thanks,
Nikolaus Schaller

https://patchwork.kernel.org/project/linux-mips/patch/z_0h2JVlIGgyiySXEyOmFhJ5_rl_EmuXR7beRMunMZRivpcO0H7LqsGa6ePHdSTkF521jUnXMM9TZb5N9mM4fduiHAxpshUkCBd7Owo43tM=@protonmail.com/


> Am 14.02.2021 um 06:01 schrieb Ryan Burns <rtburns@protonmail.com>:
> 
> macOS does not have byteswap.h, but we can use Apple's libkern/OSByteOrder.h instead.
> 
> This issue is encountered during cross-compilation from macOS to MIPS in nixpkgs.
> You can view a log of the build failure here:
> https://hydra.nixos.org/build/136015790/nixlog/1
>    
> Signed-off-by: Ryan Burns <rtburns@protonmail.com>
> ---
> arch/mips/boot/tools/relocs.h      | 11 +++++++++--
> arch/mips/boot/tools/relocs_main.c |  1 -
> arch/mips/tools/elf-entry.c        | 11 +++++++++--
> 3 files changed, 18 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/mips/boot/tools/relocs.h b/arch/mips/boot/tools/relocs.h
> index 607ff0103064..5de9bb7a7e09 100644
> --- a/arch/mips/boot/tools/relocs.h
> +++ b/arch/mips/boot/tools/relocs.h
> @@ -11,9 +11,16 @@
> #include <errno.h>
> #include <unistd.h>
> #include <elf.h>
> -#include <byteswap.h>
> #define USE_BSD
> -#include <endian.h>
> +#if defined(__APPLE__)
> +# include <libkern/OSByteOrder.h>
> +# define bswap_16 OSSwapInt16
> +# define bswap_32 OSSwapInt32
> +# define bswap_64 OSSwapInt64
> +#else
> +# include <byteswap.h>
> +# include <endian.h>
> +#endif
> #include <regex.h>
> 
> void die(char *fmt, ...);
> diff --git a/arch/mips/boot/tools/relocs_main.c b/arch/mips/boot/tools/relocs_main.c
> index e2453a564b11..4ef51d1e6d0d 100644
> --- a/arch/mips/boot/tools/relocs_main.c
> +++ b/arch/mips/boot/tools/relocs_main.c
> @@ -6,7 +6,6 @@
> #include <stdlib.h>
> #include <string.h>
> #include <errno.h>
> -#include <endian.h>
> #include <elf.h>
> 
> #include "relocs.h"
> diff --git a/arch/mips/tools/elf-entry.c b/arch/mips/tools/elf-entry.c
> index dbd14ff05b4c..5d2e2ab4b3b0 100644
> --- a/arch/mips/tools/elf-entry.c
> +++ b/arch/mips/tools/elf-entry.c
> @@ -1,7 +1,14 @@
> // SPDX-License-Identifier: GPL-2.0
> -#include <byteswap.h>
> +#if defined(__APPLE__)
> +# include <libkern/OSByteOrder.h>
> +# define bswap_16 OSSwapInt16
> +# define bswap_32 OSSwapInt32
> +# define bswap_64 OSSwapInt64
> +#else
> +# include <byteswap.h>
> +# include <endian.h>
> +#endif
> #include <elf.h>
> -#include <endian.h>
> #include <inttypes.h>
> #include <stdint.h>
> #include <stdio.h>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: tools: fix build on macOS
  2021-06-21 14:59 ` H. Nikolaus Schaller
@ 2021-06-24  1:18   ` Ryan Burns
  0 siblings, 0 replies; 3+ messages in thread
From: Ryan Burns @ 2021-06-24  1:18 UTC (permalink / raw)
  To: H. Nikolaus Schaller; +Cc: linux-mips

Hi Nikolaus,

Thanks for the response, I haven't gotten any other feedback on the patch. As far as I'm aware this is still an issue. Maybe this hasn't gotten much attention due to cross-compiling from macOS not being a common use case.

Ryan

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Monday, June 21st, 2021 at 7:59 AM, H. Nikolaus Schaller <hns@goldelico.com> wrote:

> Hi Ryan,
>
> what happened to that patch? I haven't found a discussion or that it was merged.
>
> I have used it and it seems solve a cross-compilation issue (have to cross-chek if it is still the case with 5.13-rc7).
>
> Maybe the maintainers did not become aware of?
>
> BR and thanks,
>
> Nikolaus Schaller
>
> https://patchwork.kernel.org/project/linux-mips/patch/z_0h2JVlIGgyiySXEyOmFhJ5_rl_EmuXR7beRMunMZRivpcO0H7LqsGa6ePHdSTkF521jUnXMM9TZb5N9mM4fduiHAxpshUkCBd7Owo43tM=@protonmail.com/
>
> > Am 14.02.2021 um 06:01 schrieb Ryan Burns rtburns@protonmail.com:
> >
> > macOS does not have byteswap.h, but we can use Apple's libkern/OSByteOrder.h instead.
> >
> > This issue is encountered during cross-compilation from macOS to MIPS in nixpkgs.
> >
> > You can view a log of the build failure here:
> >
> > https://hydra.nixos.org/build/136015790/nixlog/1
> >
> > Signed-off-by: Ryan Burns rtburns@protonmail.com
> > ------------------------------------------------
> >
> > arch/mips/boot/tools/relocs.h | 11 +++++++++--
> >
> > arch/mips/boot/tools/relocs_main.c | 1 -
> >
> > arch/mips/tools/elf-entry.c | 11 +++++++++--
> >
> > 3 files changed, 18 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/mips/boot/tools/relocs.h b/arch/mips/boot/tools/relocs.h
> >
> > index 607ff0103064..5de9bb7a7e09 100644
> >
> > --- a/arch/mips/boot/tools/relocs.h
> >
> > +++ b/arch/mips/boot/tools/relocs.h
> >
> > @@ -11,9 +11,16 @@
> >
> > #include <errno.h>
> >
> > #include <unistd.h>
> >
> > #include <elf.h>
> >
> > -#include <byteswap.h>
> >
> > #define USE_BSD
> >
> > -#include <endian.h>
> >
> > +#if defined(APPLE)
> >
> > +# include <libkern/OSByteOrder.h>
> >
> > +# define bswap_16 OSSwapInt16
> >
> > +# define bswap_32 OSSwapInt32
> >
> > +# define bswap_64 OSSwapInt64
> >
> > +#else
> >
> > +# include <byteswap.h>
> >
> > +# include <endian.h>
> >
> > +#endif
> >
> > #include <regex.h>
> >
> > void die(char *fmt, ...);
> >
> > diff --git a/arch/mips/boot/tools/relocs_main.c b/arch/mips/boot/tools/relocs_main.c
> >
> > index e2453a564b11..4ef51d1e6d0d 100644
> >
> > --- a/arch/mips/boot/tools/relocs_main.c
> >
> > +++ b/arch/mips/boot/tools/relocs_main.c
> >
> > @@ -6,7 +6,6 @@
> >
> > #include <stdlib.h>
> >
> > #include <string.h>
> >
> > #include <errno.h>
> >
> > -#include <endian.h>
> >
> > #include <elf.h>
> >
> > #include "relocs.h"
> >
> > diff --git a/arch/mips/tools/elf-entry.c b/arch/mips/tools/elf-entry.c
> >
> > index dbd14ff05b4c..5d2e2ab4b3b0 100644
> >
> > --- a/arch/mips/tools/elf-entry.c
> >
> > +++ b/arch/mips/tools/elf-entry.c
> >
> > @@ -1,7 +1,14 @@
> >
> > // SPDX-License-Identifier: GPL-2.0
> >
> > -#include <byteswap.h>
> >
> > +#if defined(APPLE)
> >
> > +# include <libkern/OSByteOrder.h>
> >
> > +# define bswap_16 OSSwapInt16
> >
> > +# define bswap_32 OSSwapInt32
> >
> > +# define bswap_64 OSSwapInt64
> >
> > +#else
> >
> > +# include <byteswap.h>
> >
> > +# include <endian.h>
> >
> > +#endif
> >
> > #include <elf.h>
> >
> > -#include <endian.h>
> >
> > #include <inttypes.h>
> >
> > #include <stdint.h>
> >
> > #include <stdio.h>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-24  1:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-14  5:01 [PATCH] MIPS: tools: fix build on macOS Ryan Burns
2021-06-21 14:59 ` H. Nikolaus Schaller
2021-06-24  1:18   ` Ryan Burns

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.