Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Mar 2023 03:09:58 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Yuri <yuri@aetern.org>
Cc:        Nuno Teixeira <eduardo@freebsd.org>, FreeBSD CURRENT <freebsd-current@freebsd.org>,  FreeBSD Mailing List <freebsd-ports@freebsd.org>
Subject:   Re: byteswap.h not found on 12 and 13
Message-ID:  <CANCZdfq2nLt1Bq2Jzn=ivvqaOvF9=y8j=ChZzy6TrE5zAzeFiw@mail.gmail.com>
In-Reply-To: <CANCZdfp=zTD5ctpjcQhDBexWP40d=z0GAd09Qa9eFM4yxXq9RQ@mail.gmail.com>
References:  <CAFDf7UKq3bMgd3XA0=U10%2BLhOCY7fZCHds9DdBcrSuNidOityw@mail.gmail.com> <CANCZdfpT3nbZ%2BzHHtdsMDa88JsWr7Frw%2BRPGcy6B=P60DZL2_g@mail.gmail.com> <CAFDf7UL=av0KDAw2O3Fmf=x5wThezBokCQ2KHtW6wOZnn43bxQ@mail.gmail.com> <ef18fee5-358b-3c19-467b-2fd980dff797@aetern.org> <CANCZdfrvHQTZqgGdZjm5Z_fa53g92c_6EHtKZpyRAsKwRsDcLw@mail.gmail.com> <CANCZdfp=zTD5ctpjcQhDBexWP40d=z0GAd09Qa9eFM4yxXq9RQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000008e93e405f7a1c264
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

one last reply, if this is for a port, then byteswap.h can usually be
implemented as

#include <sys/endian.h>
#define __bswap_16(x) __bswap16(x)
#define __bswap_32(x) __bswap32(x)
#define __bswap_64(x) __bswap64(x)

#define bswap_16(x) __bswap16(x)
#define bswap_32(x) __bswap32(x)
#define bswap_64(x) __bswap64(x)

in older versions of FreeBSD, but some tricky software will hate the
bswap16 (no underscore) etc defines. You could likely put that into the
port.

Warner

On Fri, Mar 24, 2023 at 3:01=E2=80=AFAM Warner Losh <imp@bsdimp.com> wrote:

> And I just looked it up... unlike endian.h, byteswap.h is not in the draf=
t
> I have of issue 8 posix (due out this year or next, give or take).
>
> Warner
>
> On Fri, Mar 24, 2023 at 2:57=E2=80=AFAM Warner Losh <imp@bsdimp.com> wrot=
e:
>
>> Yea, I just committed this
>>
>> commit 1761b09bf42d2842e82c1ac614c23d31c4d4c0dc
>> Author: Warner Losh <imp@FreeBSD.org>
>> Date:   Fri Jan 20 16:33:37 2023 -0700
>>
>>     byteswap.h: Add a glibc/linux compatible byteswap.h
>>
>>     For endian.h to work instead of sys/endian.h, some software needs
>>     byteswap.h available. It must define {__,}byteswap_{16,32,64}.
>>     Included sys/_endian.h to get an appropriate __byteswap16, etc
>>     and defines the new macros in terms of them. Enhance _endian.h
>>     to allow it to be included from here too.
>>
>>     Sponsored by:           Netflix
>>     Reviewed by:            markj
>>     Differential Revision:  https://reviews.freebsd.org/D32051
>>
>> which I MFC'd to 13, but after 13.1R and this isn't a good EN candidate.
>> I've not bothered with stable/12 because I'm lame and have stopped MFCin=
g
>> stuff to it except critical fixes.
>>
>> Long term: this will make life better. Short term, it's less good since
>> we have to still do old-school compatibility.
>>
>> I likely should write a man page for endian.h and byteswap.h
>>
>> Warner
>>
>> On Fri, Mar 24, 2023 at 2:48=E2=80=AFAM Yuri <yuri@aetern.org> wrote:
>>
>>> Nuno Teixeira wrote:
>>> > Hello Warner,
>>> >
>>> > My poudriere jails:
>>> > ---
>>> > 124amd64   12.4-RELEASE-p2      amd64         http         2023-03-17
>>> > 08:04:15 /usr/local/poudriere/jails/124amd64
>>> > 124i386    12.4-RELEASE-p2      i386          http         2023-03-17
>>> > 08:04:38 /usr/local/poudriere/jails/124i386
>>> > 131amd64   13.1-RELEASE-p7      amd64         http         2023-03-17
>>> > 08:05:03 /usr/local/poudriere/jails/131amd64
>>> > ---
>>> >
>>> > The strange thing is that 5.08 (old version) have #include <byteswap.=
h>
>>> > too and compiles fine|:
>>> > |
>>> > https://github.com/sflow/sflowtool/issues/41
>>> > <https://github.com/sflow/sflowtool/issues/41>;
>>>
>>> 5.08 seems to have it commented out:
>>>
>>> sflowtool-5.08/src/sflowtool.c:
>>>
>>> /*
>>> #ifdef DARWIN
>>> #include <architecture/byte_order.h>
>>> #define bswap_16(x) NXSwapShort(x)
>>> #define bswap_32(x) NXSwapInt(x)
>>> #else
>>> #include <byteswap.h>
>>> #endif
>>> */
>>>
>>>
>>> > Warner Losh <imp@bsdimp.com <mailto:imp@bsdimp.com>> escreveu no dia
>>> > sexta, 24/03/2023 =C3=A0(s) 08:30:
>>> >
>>> >
>>> >
>>> >     On Fri, Mar 24, 2023, 9:23 AM Nuno Teixeira <eduardo@freebsd.org
>>> >     <mailto:eduardo@freebsd.org>> wrote:
>>> >
>>> >         Hello all,
>>> >
>>> >         I'm getting a file not found on 12 and 13 compiling
>>> >         net/sflowtool latest update:
>>> >         It compile fine on 14.
>>> >
>>> >         I've searched 14 src and found:
>>> >         ---
>>> >         ./include/byteswap.h
>>> >         ./contrib/ofed/include/byteswap.h
>>> >         ./contrib/llvm-project/libcxx/include/__bit/byteswap.h
>>> >         ---
>>> >         Any clues?
>>> >
>>> >
>>> >
>>> >     I added it a short time ago. I thought I mfc'd it to 13 but not 1=
2.
>>> >     How recent a 13? It's a non standard glibc extension that may be =
in
>>> >     the next posix standard though. I've not looked at the draft for =
it
>>> >     yet to see if it complies or not.
>>> >
>>> >     Warner
>>> >
>>> >         Thanks,
>>> >
>>> >         ---
>>> >         =3D=3D=3D>  Building for sflowtool-6.01
>>> >         --- all ---
>>> >         /usr/bin/make  all-recursive
>>> >         --- all-recursive ---
>>> >         Making all in src
>>> >         --- sflowtool.o ---
>>> >         cc -DHAVE_CONFIG_H -I. -I..      -O2 -pipe
>>> >          -fstack-protector-strong -fno-strict-aliasing -MT sflowtool.=
o
>>> >         -MD -MP -MF .deps/sflowtool.Tpo -c -o sflowtool.o sflowtool.c
>>> >         sflowtool.c:32:10: fatal error: 'byteswap.h' file not found
>>> >         #include <byteswap.h>
>>> >                  ^~~~~~~~~~~~
>>> >         1 error generated.
>>> >         *** [sflowtool.o] Error code 1
>>> >         ---
>>> >
>>> >
>>> >         --
>>> >         Nuno Teixeira
>>> >         FreeBSD Committer (ports)
>>> >
>>> >
>>> >
>>> > --
>>> > Nuno Teixeira
>>> > FreeBSD Committer (ports)
>>>
>>>

--0000000000008e93e405f7a1c264
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">one last reply, if this is for a port, then byteswap.h can=
 usually be implemented as<div><br></div><div>#include &lt;sys/endian.h&gt;=
</div><div>#define __bswap_16(x) __bswap16(x)<br>#define __bswap_32(x) __bs=
wap32(x)<br>#define __bswap_64(x) __bswap64(x)<br><br>#define bswap_16(x) _=
_bswap16(x)<br>#define bswap_32(x) __bswap32(x)<br>#define bswap_64(x) __bs=
wap64(x)<br></div><div><br></div><div>in older versions of FreeBSD, but som=
e tricky software will hate the bswap16 (no underscore) etc defines. You co=
uld likely put that into the port.</div><div><br></div><div>Warner</div></d=
iv><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On =
Fri, Mar 24, 2023 at 3:01=E2=80=AFAM Warner Losh &lt;<a href=3D"mailto:imp@=
bsdimp.com">imp@bsdimp.com</a>&gt; wrote:<br></div><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex"><div dir=3D"ltr"><div>And I just looked it up... =
unlike endian.h, byteswap.h is not in the draft I have of issue 8 posix (du=
e out this year or next, give or take).</div><div><br></div><div>Warner</di=
v><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On F=
ri, Mar 24, 2023 at 2:57=E2=80=AFAM Warner Losh &lt;<a href=3D"mailto:imp@b=
sdimp.com" target=3D"_blank">imp@bsdimp.com</a>&gt; wrote:<br></div><blockq=
uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1p=
x solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Yea, I just com=
mitted this<div><br></div><div>commit 1761b09bf42d2842e82c1ac614c23d31c4d4c=
0dc<br>Author: Warner Losh &lt;imp@FreeBSD.org&gt;<br>Date: =C2=A0 Fri Jan =
20 16:33:37 2023 -0700<br><br>=C2=A0 =C2=A0 byteswap.h: Add a glibc/linux c=
ompatible byteswap.h<br><br>=C2=A0 =C2=A0 For endian.h to work instead of s=
ys/endian.h, some software needs<br>=C2=A0 =C2=A0 byteswap.h available. It =
must define {__,}byteswap_{16,32,64}.<br>=C2=A0 =C2=A0 Included sys/_endian=
.h to get an appropriate __byteswap16, etc<br>=C2=A0 =C2=A0 and defines the=
 new macros in terms of them. Enhance _endian.h<br>=C2=A0 =C2=A0 to allow i=
t to be included from here too.<br><br>=C2=A0 =C2=A0 Sponsored by: =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Netflix<br>=C2=A0 =C2=A0 Reviewed by: =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0markj<br>=C2=A0 =C2=A0 Differential Revis=
ion: =C2=A0<a href=3D"https://reviews.freebsd.org/D32051" target=3D"_blank"=
>https://reviews.freebsd.org/D32051</a><br></div><div><br></div><div>which =
I MFC&#39;d to 13, but after 13.1R and this isn&#39;t a good EN candidate. =
I&#39;ve not bothered with stable/12 because I&#39;m lame and have stopped =
MFCing stuff to it except critical fixes.</div><div><br></div><div>Long ter=
m: this will make life better. Short term, it&#39;s less good since we have=
 to still do old-school compatibility.</div><div><br></div><div>I likely sh=
ould write a man page for endian.h and byteswap.h</div><div><br></div><div>=
Warner</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"=
gmail_attr">On Fri, Mar 24, 2023 at 2:48=E2=80=AFAM Yuri &lt;<a href=3D"mai=
lto:yuri@aetern.org" target=3D"_blank">yuri@aetern.org</a>&gt; wrote:<br></=
div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left:1px solid rgb(204,204,204);padding-left:1ex">Nuno Teixeira wrote:<=
br>
&gt; Hello Warner,<br>
&gt; <br>
&gt; My poudriere jails:<br>
&gt; ---<br>
&gt; 124amd64 =C2=A0 12.4-RELEASE-p2 =C2=A0 =C2=A0 =C2=A0amd64 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 http =C2=A0 =C2=A0 =C2=A0 =C2=A0 2023-03-17<br>
&gt; 08:04:15 /usr/local/poudriere/jails/124amd64<br>
&gt; 124i386 =C2=A0 =C2=A012.4-RELEASE-p2 =C2=A0 =C2=A0 =C2=A0i386 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0http =C2=A0 =C2=A0 =C2=A0 =C2=A0 2023-03-17<br>
&gt; 08:04:38 /usr/local/poudriere/jails/124i386<br>
&gt; 131amd64 =C2=A0 13.1-RELEASE-p7 =C2=A0 =C2=A0 =C2=A0amd64 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 http =C2=A0 =C2=A0 =C2=A0 =C2=A0 2023-03-17<br>
&gt; 08:05:03 /usr/local/poudriere/jails/131amd64<br>
&gt; ---<br>
&gt; <br>
&gt; The strange thing is that 5.08 (old version) have #include &lt;byteswa=
p.h&gt;<br>
&gt; too and compiles fine|:<br>
&gt; |<br>
&gt; <a href=3D"https://github.com/sflow/sflowtool/issues/41" rel=3D"norefe=
rrer" target=3D"_blank">https://github.com/sflow/sflowtool/issues/41</a><br=
>
&gt; &lt;<a href=3D"https://github.com/sflow/sflowtool/issues/41" rel=3D"no=
referrer" target=3D"_blank">https://github.com/sflow/sflowtool/issues/41</a=
>&gt;<br>
<br>
5.08 seems to have it commented out:<br>
<br>
sflowtool-5.08/src/sflowtool.c:<br>
<br>
/*<br>
#ifdef DARWIN<br>
#include &lt;architecture/byte_order.h&gt;<br>
#define bswap_16(x) NXSwapShort(x)<br>
#define bswap_32(x) NXSwapInt(x)<br>
#else<br>
#include &lt;byteswap.h&gt;<br>
#endif<br>
*/<br>
<br>
<br>
&gt; Warner Losh &lt;<a href=3D"mailto:imp@bsdimp.com" target=3D"_blank">im=
p@bsdimp.com</a> &lt;mailto:<a href=3D"mailto:imp@bsdimp.com" target=3D"_bl=
ank">imp@bsdimp.com</a>&gt;&gt; escreveu no dia<br>
&gt; sexta, 24/03/2023 =C3=A0(s) 08:30:<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0On Fri, Mar 24, 2023, 9:23 AM Nuno Teixeira &lt;<a =
href=3D"mailto:eduardo@freebsd.org" target=3D"_blank">eduardo@freebsd.org</=
a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;mailto:<a href=3D"mailto:eduardo@freebsd.org" t=
arget=3D"_blank">eduardo@freebsd.org</a>&gt;&gt; wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Hello all,<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0I&#39;m getting a file not found on 1=
2 and 13 compiling<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0net/sflowtool latest update:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0It compile fine on 14.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0I&#39;ve searched 14 src and found:<b=
r>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0---<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0./include/byteswap.h<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0./contrib/ofed/include/byteswap.h<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0./contrib/llvm-project/libcxx/include=
/__bit/byteswap.h<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0---<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Any clues?<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0I added it a short time ago. I thought I mfc&#39;d =
it to 13 but not 12.<br>
&gt;=C2=A0 =C2=A0 =C2=A0How recent a 13? It&#39;s a non standard glibc exte=
nsion that may be in<br>
&gt;=C2=A0 =C2=A0 =C2=A0the next posix standard though. I&#39;ve not looked=
 at the draft for it<br>
&gt;=C2=A0 =C2=A0 =C2=A0yet to see if it complies or not.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Warner<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Thanks,<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0---<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D=3D=3D&gt; =C2=A0Building for sflo=
wtool-6.01<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--- all ---<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/usr/bin/make =C2=A0all-recursive<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--- all-recursive ---<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Making all in src<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--- sflowtool.o ---<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cc -DHAVE_CONFIG_H -I. -I.. =C2=A0 =
=C2=A0 =C2=A0-O2 -pipe<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0-fstack-protector-strong -fno-s=
trict-aliasing -MT sflowtool.o<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-MD -MP -MF .deps/sflowtool.Tpo -c -o=
 sflowtool.o sflowtool.c<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sflowtool.c:32:10: fatal error: &#39;=
byteswap.h&#39; file not found<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#include &lt;byteswap.h&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^~~=
~~~~~~~~~<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A01 error generated.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*** [sflowtool.o] Error code 1<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0---<br>
&gt; <br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-- <br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Nuno Teixeira<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0FreeBSD Committer (ports)<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; -- <br>
&gt; Nuno Teixeira<br>
&gt; FreeBSD Committer (ports)<br>
<br>
</blockquote></div>
</blockquote></div></div>
</blockquote></div>

--0000000000008e93e405f7a1c264--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfq2nLt1Bq2Jzn=ivvqaOvF9=y8j=ChZzy6TrE5zAzeFiw>