Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 May 2015 20:21:53 +0000
From:      Brooks Davis <brooks@freebsd.org>
To:        sbruno@freebsd.org
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: Trying to use clang/head and XCC
Message-ID:  <20150519202153.GB36377@spindle.one-eyed-alien.net>
In-Reply-To: <555B91E8.9010309@ignoranthack.me>
References:  <555B638E.4020405@ignoranthack.me> <20150519165332.GA36377@spindle.one-eyed-alien.net> <555B91E8.9010309@ignoranthack.me>

next in thread | previous in thread | raw e-mail | index | archive | help

--VrqPEDrXMn8OVzN4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, May 19, 2015 at 12:41:28PM -0700, Sean Bruno wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
>=20
> On 05/19/15 09:53, Brooks Davis wrote:
> > On Tue, May 19, 2015 at 09:23:42AM -0700, Sean Bruno wrote:=20
> > Following the External Tool Chain instructions on the wiki seem to=20
> > not work: https://wiki.freebsd.org/ExternalToolchain
> >=20
> > I've gotten about this far:=20
> > https://people.freebsd.org/~sbruno/clang_head_build_log.txt
> >=20
> >> You need to delete=20
> >> /home/sbruno/bsd/clang/build/bin/../lib/clang/3.7.0/include/std*=20
> >> and possibly also limits.h (it's broken for libstand on mips). If
> >> you use the ports/pkgs they do this.
>=20
> This didn't seem to make any difference when xcompiling for AMD64, but
> I did run into a buildfailure which might mean I don't know what I'm
> doing:

rm /home/sbruno/bsd/clang/build/bin/../lib/clang/3.7.0/include/limits.h

should do get around this one.  I hit this one on mips a few weeks ago.

It's a bug in upstream clang that the bundled limits.h doesn't
#include_next <limits.h> with -ffreestanding.  I've not had a chance to
submit a review request to fix it.

-- Brooks

>=20
>=20
> =3D=3D=3D> lib/libstand (all)
> /home/sbruno/bsd/clang/build/bin/clang -target
> x86_64-unknown-freebsd11.0
> - --sysroot=3D/var/tmp/home/sbruno/bsd/fbsd_head/tmp
> - -B/var/tmp/home/sbruno/bsd/fbsd_head/tmp/usr/
> bin  -O2 -pipe   -ffreestanding -Wformat
> - -I/home/sbruno/bsd/fbsd_head/lib/libstand -mno-mmx -mno-3dnow -mno-sse
> - -mno-sse2 -mno-sse3 -msoft-float -fPIC -mno-red-zone -DB
> Z_NO_STDIO -DBZ_NO_COMPRESS -DHAVE_MEMCPY
> - -I/home/sbruno/bsd/fbsd_head/lib/libstand/../libz -std=3Dgnu99
> - -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unuse
> d-const-variable -Wno-tautological-compare -Wno-unused-value
> - -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion
> - -Wno-unused-local-typedef -Wno-switch -
> Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses
> - -Qunused-arguments -c
> /home/sbruno/bsd/fbsd_head/lib/libstand/../libc/string/strcspn.c -o
> strcspn.o
> /home/sbruno/bsd/fbsd_head/lib/libstand/../libc/string/strcspn.c:46:31:
> error:
> use of undeclared identifier 'LONG_BIT'
>         u_long tbl[(UCHAR_MAX + 1) / LONG_BIT];
>                                      ^
> /home/sbruno/bsd/fbsd_head/lib/libstand/../libc/string/strcspn.c:60:9:
> error: use of undeclared identifier 'LONG_BIT'
>                 idx =3D IDX(*charset);
>                       ^
> /home/sbruno/bsd/fbsd_head/lib/libstand/../libc/string/strcspn.c:34:31:
> note:
> expanded from macro 'IDX'
> #define IDX(c)  ((u_char)(c) / LONG_BIT)
>                                ^
> /home/sbruno/bsd/fbsd_head/lib/libstand/../libc/string/strcspn.c:61:9:
> error: use of undeclared identifier 'LONG_BIT'
>                 bit =3D BIT(*charset);
>                       ^
> /home/sbruno/bsd/fbsd_head/lib/libstand/../libc/string/strcspn.c:35:45:
> note:
> expanded from macro 'BIT'
> #define BIT(c)  ((u_long)1 << ((u_char)(c) % LONG_BIT))
>                                              ^
> /home/sbruno/bsd/fbsd_head/lib/libstand/../libc/string/strcspn.c:66:9:
> error: use of undeclared identifier 'LONG_BIT'
>                 idx =3D IDX(*s1);
>                       ^
> /home/sbruno/bsd/fbsd_head/lib/libstand/../libc/string/strcspn.c:34:31:
> note:
> expanded from macro 'IDX'
> #define IDX(c)  ((u_char)(c) / LONG_BIT)
>                                ^
> /home/sbruno/bsd/fbsd_head/lib/libstand/../libc/string/strcspn.c:67:9:
> error: use of undeclared identifier 'LONG_BIT'
>                 bit =3D BIT(*s1);
>                       ^
> /home/sbruno/bsd/fbsd_head/lib/libstand/../libc/string/strcspn.c:35:45:
> note:
> expanded from macro 'BIT'
> #define BIT(c)  ((u_long)1 << ((u_char)(c) % LONG_BIT))
>                                              ^
> 5 errors generated.
> *** Error code 1
>=20
>=20
>=20
> >=20
> > Two items of note. -- The bootstrap bits *completely* ignore XCC=20
> > and build with the host cc/c++
> >=20
> >> That's expected.  In principle clang could be used as the cross=20
> >> compiler since it's multi-target, but gcc could never work
> >> unless the host and target are the same.
> >=20
> > -- No documentation of what CFLAGS are required to build and ignore
> > warnings.
> >=20
> >> It will change with every clang/gcc release.  In practice you=20
> >> will need to either fix the warnings wack-a-mole style or set=20
> >> NO_WERROR in the environment.
> >=20
> >> -- Brooks
> >=20
> >=20
> > Anyone out there have success doing this?
> >=20
> > sean
> >> _______________________________________________=20
> >> freebsd-hackers@freebsd.org mailing list=20
> >> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To=20
> >> unsubscribe, send any mail to=20
> >> "freebsd-hackers-unsubscribe@freebsd.org"
> >>=20
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
>=20
> iQF8BAEBCgBmBQJVW5HhXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
> ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRCQUFENDYzMkU3MTIxREU4RDIwOTk3REQx
> MjAxRUZDQTFFNzI3RTY0AAoJEBIB78oecn5keYAIAJ2QVVw6K6UDXnn7+MzI3U6s
> agPzhREr8HB0wZDapUjjtG+KVdy0P3bPKX+T5D4nDq8YbW7EgkYJcYL+A2xl0Ri9
> sXHldlTHdf43XRtFufbYpM6z6X4SZ8wHo67F+UuIPmPjnn8GSLd6b4bORrhvvmdN
> fy2X3eDSBs8ogssJSWLYHCPA3hGWeAlXUMy1abv5wuEc4cxQmYjW3dY4l019nC0r
> jSTPd1JDacW6rMUMXFx1aZDsk9nk2Xl1khUu2bR0ZiMkdVYD1s0JhNF4UQYMqPsN
> 3u8FK0RFnOTN8XgVNb4mjqgSMGMigrpvtoPdhrqcscOewgjPORoypL/f6xVmejc=3D
> =3DG80s
> -----END PGP SIGNATURE-----
>=20

--VrqPEDrXMn8OVzN4
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJVW5tfAAoJEKzQXbSebgfAj2EH/02PFtR7hITNY7kxlZjfoaq8
00DlBmaewGGUH7ZmCv4t7rYx3qkv/1AB7PmKbBDbtdsRsznjXtVWHcsdBuu8PQfJ
PYjvWNXXcFWjhEnIdSi2MmtWBmbhKZM7G2B/ncE5z7yVqMc0022ALkgolALjxFMc
uKt+53D4jjQAmzwaL6oyqaTNOfjax1XIrhhH64sdEaEPqMxuaKT573pd/F40zDWi
qunZ8Jh79AonlEpq+aAgYxBq6wxFS4+3w+5W4PFAU3CnMq3FdCrSjoYxYvxrtk7t
yTfngxSMvoc9rrIiVF6vzTpSrF4wi4RasYTEyWdq7yrINaD8QfuGiUh8xR/xEo0=
=QbXY
-----END PGP SIGNATURE-----

--VrqPEDrXMn8OVzN4--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150519202153.GB36377>