Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Mar 2015 21:39:23 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Craig Rodrigues <rodrigc@FreeBSD.org>
Cc:        "freebsd-testing@freebsd.org" <freebsd-testing@freebsd.org>, freebsd-toolchain@freebsd.org, Dimitry Andric <dim@freebsd.org>
Subject:   Re: Failed to build with external toolchain
Message-ID:  <B768CFD8-FDC1-48EF-91C3-92056F90EE02@bsdimp.com>
In-Reply-To: <CAG=rPVc=YxuakeyFL9SXAnas3e9QyozfLqC2uQ_KhkqaavRvNQ@mail.gmail.com>
References:  <CAG=rPVfP4=BuL8DOuy9FNDcN51zshfBfeuFONiAAONWON6n3kA@mail.gmail.com> <A1580F95-4882-46F3-96C2-3D3D1D493706@FreeBSD.org> <CAG=rPVd9deshQWvMXOHF%2ByfvqZfo3UOsao9iqipX_CQGKs=vHA@mail.gmail.com> <1857A2A3-0C19-4F52-BCAF-6C72FE7D8DF3@FreeBSD.org> <CAG=rPVfKTi5cFyhNBg7pSYi_rUoEw2d8NeqA89Fy%2BiLxZt86hg@mail.gmail.com> <C3173614-08B4-4616-BD76-93CA8417A044@FreeBSD.org> <CAG=rPVc=YxuakeyFL9SXAnas3e9QyozfLqC2uQ_KhkqaavRvNQ@mail.gmail.com>

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

--Apple-Mail=_641C2192-3CD7-4E25-B1D7-F00B73C5AFA3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Mar 24, 2015, at 9:18 PM, Craig Rodrigues <rodrigc@FreeBSD.org> =
wrote:
>=20
> On Sat, Mar 7, 2015 at 3:48 PM, Dimitry Andric <dim@freebsd.org> =
wrote:
>=20
>> On 07 Mar 2015, at 21:12, Craig Rodrigues <rodrigc@FreeBSD.org> =
wrote:
>>> I ran the build again and this time I am getting errors about =
undefined
>>> symbol utimensat():
>>>=20
>>>=20
>> =
https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/14/con=
sole
>>>=20
>>> Any ideas?
>>=20
>> It's linking against the wrong libc, the one from the FreeBSD-10 host
>> system, which does not have utimensat():
>>=20
>> --- cp ---
>> /usr/local/bin/x86_64-portbld-freebsd10.0-gcc -isystem
>> =
/builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_extern=
al_toolchain_gcc/tmp/usr/include
>> =
-L/builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_exte=
rnal_toolchain_gcc/tmp/usr/lib
>> -O2 -pipe   -DVM_AND_BUFFER_CACHE_SYNCHRONIZED -D_ACL_PRIVATE =
-std=3Dgnu99
>> -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -W
>> -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes
>> -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch =
-Wshadow
>> -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline =
-Wnested-externs
>> -Wredundant-decls -Wold-style-definition -Wno-pointer-sign    -o cp =
cp.o
>> utils.o
>> [...]
>> utils.o: In function `setfile':
>> utils.c:(.text+0x83): undefined reference to `utimensat'
>> utils.c:(.text+0x1ce): undefined reference to `utimensat'
>> utils.c:(.text+0x38c): undefined reference to `utimensat'
>> collect2: error: ld returned 1 exit status
>>=20
>> There should probably be a --sysroot flag in there, pointing to the
>> ${WORLDTMP} built during the earlier stages.
>>=20
>> For some reason, this flag is not added for gcc, in Makefile.inc1.  =
No
>> idea why that was done.
>>=20
>> -Dimitry
>>=20
>> I eliminated the problem with this patch:
>=20
> Index: Makefile.inc1
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- Makefile.inc1       (revision 280353)
> +++ Makefile.inc1       (working copy)
> @@ -381,9 +381,9 @@
> TARGET_ABI?=3D   unknown
> TARGET_TRIPLE?=3D
> ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
> XCFLAGS+=3D      -target ${TARGET_TRIPLE}
> +.endif
> XCFLAGS+=3D      --sysroot=3D${WORLDTMP} ${BFLAGS}
> XCXXFLAGS+=3D    --sysroot=3D${WORLDTMP} ${BFLAGS}
> -.endif
> .else
> .if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX})
> BFLAGS+=3D       -B${CROSS_BINUTILS_PREFIX}
>=20
>=20
> This sets --sysroot when doing CROSS_TOOLCHAIN for both clang *or* =
gcc.
> Right now,  --sysroot is only set for clang.
>=20
> I did a "make universe" and "make buildworld
> CROSS_TOOLCHAIN_PREFIX=3D/usr/bin/"
>=20
> Is it OK if I commit it?

No. The in-tree gcc doesn=E2=80=99t grok =E2=80=94sysroot.

We assume that version gcc 4.2.1 is special and our in-tree compiler =
elsewhere,
so please add a check for that and just go ahead and duplicate those two =
lines.

Eg

+.else if ${COMPILER_VERSION} > 40201
+XCFLAGS+=3D      --sysroot=3D${WORLDTMP} ${BFLAGS}
+XCXXFLAGS+=3D    --sysroot=3D${WORLDTMP} ${BFLAGS}
.endif

Warner

--Apple-Mail=_641C2192-3CD7-4E25-B1D7-F00B73C5AFA3
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJVEi3rAAoJEGwc0Sh9sBEARtkQAJzItEx8Yklzea9yHxdSS2RS
187LYuMKib7kOUHszlU2A6OmksDHAGyVhkQby9DIhozhSGy8ON64Ncmxf9BiudQi
WrF7Q5+zW1Pb4FJFnn52E5EuEzyNnoE+f8ryFYNz73RuXgqKm7fVDMeQCQXRDWu9
lVeN479524mJZgkM6kC8tB2UpgHNd42vEpaV02s39qxAUHQrOSW9PE1cmJeufBU9
NjSZmklaHJKckRAYbcX5JKSAcjPPj5nY4zU0VoODMaMbt7h85zNLRjAqSb0MM1KJ
OX7ylaqp/Or7JYTI7UliwKSKbw8U0gqiYdCB3Tr458NFc+KHbmKQvBFpb9UAYAtU
bQXDBWzfQMzxrHtFgRO5Y6nLEPfZbCcvbQLhoGyhivcnzkB3VCQvbpfnMlBYgwHx
2RhymvBSgNlHglM2FDtWoA2nCl6DYHtKjMNNJOpvLJajUfNvzxVh8YvZJatdsSr9
+HvzNS3YgOznVRHCnMh6FS2g21fJbhD9hzS1Pqa5TgJmEy17MOI6Xw5PIlVtCcAS
B0RYLL0CRL20h6ylyEQTwHj0rTd6TF/Y71fG1kmvknHBHKWV75FmBp8sXZVKMrWh
4x5obOd6t8gZx7MMF9Wn2WYtMKDQr8F08g59bQFFm4r7Uho9GSPW+CrepQU2Z1aI
FBlqfZj+wVOLitpeNqze
=79L+
-----END PGP SIGNATURE-----

--Apple-Mail=_641C2192-3CD7-4E25-B1D7-F00B73C5AFA3--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B768CFD8-FDC1-48EF-91C3-92056F90EE02>