Re: Failed to build with external toolchain

2015-03-26 Thread Craig Rodrigues
On Thu, Mar 26, 2015 at 11:47 AM, Warner Losh  wrote:

>
> > On Mar 26, 2015, at 2:12 AM, Craig Rodrigues 
> wrote:
>
> OK. I have a bit of egg on my face...
>
> The test is for X_COMPILER_TYPE, so COMPILER_VERSION isn't relevant. It's
> always outside the tree.
> So your original patch is correct. Please go ahead and commit that and
> accept my apologies for the wild goose chase.
>

Okee dokee, I committed my original patch:
http://lists.freebsd.org/pipermail/svn-src-all/2015-March/101492.html

No worries about geese.  External toolchain support is important to the
future of FreeBSD, and I appreciate your work.
I'm just trying to help as best I can by testing things, reporting
problems, and fixing things where I can.

--
Craig
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Failed to build with external toolchain

2015-03-26 Thread Warner Losh

> On Mar 26, 2015, at 2:12 AM, Craig Rodrigues  wrote:
> 
> 
> 
> On Tue, Mar 24, 2015 at 8:39 PM, Warner Losh  wrote:
> 
> 
> No. The in-tree gcc doesn’t grok —sysroot.
> 
> 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+=  --sysroot=${WORLDTMP} ${BFLAGS}
> +XCXXFLAGS+=--sysroot=${WORLDTMP} ${BFLAGS}
> .endif
> 
> 
> The following worked for me.  Is it OK to commit?
> 
> Index: Makefile.inc1
> ===
> --- Makefile.inc1   (revision 280353)
> +++ Makefile.inc1   (working copy)
> @@ -375,10 +375,14 @@
>  .endif
>  .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
>  XCFLAGS+=  -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
>  XCXXFLAGS+=-I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 
> -L${WORLDTMP}/../lib/libc++
>  DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1
> +.if ${COMPILER_VERSION} > 40201
> +XCFLAGS+=  --sysroot=${WORLDTMP} ${BFLAGS}
> +XCXXFLAGS+=--sysroot=${WORLDTMP} ${BFLAGS}
> +.endif
>  .else
>  TARGET_ABI?=   unknown
>  TARGET_TRIPLE?=
> ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
>  XCFLAGS+=  -target ${TARGET_TRIPLE}
>  XCFLAGS+=  --sysroot=${WORLDTMP} ${BFLAGS}

OK. I have a bit of egg on my face…

The test is for X_COMPILER_TYPE, so COMPILER_VERSION isn’t relevant. It’s 
always outside the tree.
So your original patch is correct. Please go ahead and commit that and accept 
my apologies for the wild goose chase.

Warner


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Failed to build with external toolchain

2015-03-26 Thread Craig Rodrigues
On Tue, Mar 24, 2015 at 8:39 PM, Warner Losh  wrote:

>
>
> No. The in-tree gcc doesn't grok --sysroot.
>
> 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+=  --sysroot=${WORLDTMP} ${BFLAGS}
> +XCXXFLAGS+=--sysroot=${WORLDTMP} ${BFLAGS}
> .endif
>
>
The following worked for me.  Is it OK to commit?

Index: Makefile.inc1
===
--- Makefile.inc1   (revision 280353)
+++ Makefile.inc1   (working copy)
@@ -375,10 +375,14 @@
 .endif
 .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
 XCFLAGS+=  -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
 XCXXFLAGS+=-I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11
-L${WORLDTMP}/../lib/libc++
 DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1
+.if ${COMPILER_VERSION} > 40201
+XCFLAGS+=  --sysroot=${WORLDTMP} ${BFLAGS}
+XCXXFLAGS+=--sysroot=${WORLDTMP} ${BFLAGS}
+.endif
 .else
 TARGET_ABI?=   unknown
 TARGET_TRIPLE?=
${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
 XCFLAGS+=  -target ${TARGET_TRIPLE}
 XCFLAGS+=  --sysroot=${WORLDTMP} ${BFLAGS}

--
Craig
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Failed to build with external toolchain

2015-03-24 Thread Warner Losh

> On Mar 24, 2015, at 9:18 PM, Craig Rodrigues  wrote:
> 
> On Sat, Mar 7, 2015 at 3:48 PM, Dimitry Andric  wrote:
> 
>> On 07 Mar 2015, at 21:12, Craig Rodrigues  wrote:
>>> I ran the build again and this time I am getting errors about undefined
>>> symbol utimensat():
>>> 
>>> 
>> https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/14/console
>>> 
>>> Any ideas?
>> 
>> It's linking against the wrong libc, the one from the FreeBSD-10 host
>> system, which does not have utimensat():
>> 
>> --- cp ---
>> /usr/local/bin/x86_64-portbld-freebsd10.0-gcc -isystem
>> /builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_external_toolchain_gcc/tmp/usr/include
>> -L/builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_external_toolchain_gcc/tmp/usr/lib
>> -O2 -pipe   -DVM_AND_BUFFER_CACHE_SYNCHRONIZED -D_ACL_PRIVATE -std=gnu99
>> -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
>> 
>> There should probably be a --sysroot flag in there, pointing to the
>> ${WORLDTMP} built during the earlier stages.
>> 
>> For some reason, this flag is not added for gcc, in Makefile.inc1.  No
>> idea why that was done.
>> 
>> -Dimitry
>> 
>> I eliminated the problem with this patch:
> 
> Index: Makefile.inc1
> ===
> --- Makefile.inc1   (revision 280353)
> +++ Makefile.inc1   (working copy)
> @@ -381,9 +381,9 @@
> TARGET_ABI?=   unknown
> TARGET_TRIPLE?=
> ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
> XCFLAGS+=  -target ${TARGET_TRIPLE}
> +.endif
> XCFLAGS+=  --sysroot=${WORLDTMP} ${BFLAGS}
> XCXXFLAGS+=--sysroot=${WORLDTMP} ${BFLAGS}
> -.endif
> .else
> .if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX})
> BFLAGS+=   -B${CROSS_BINUTILS_PREFIX}
> 
> 
> This sets --sysroot when doing CROSS_TOOLCHAIN for both clang *or* gcc.
> Right now,  --sysroot is only set for clang.
> 
> I did a "make universe" and "make buildworld
> CROSS_TOOLCHAIN_PREFIX=/usr/bin/"
> 
> Is it OK if I commit it?

No. The in-tree gcc doesn’t grok —sysroot.

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+=  --sysroot=${WORLDTMP} ${BFLAGS}
+XCXXFLAGS+=--sysroot=${WORLDTMP} ${BFLAGS}
.endif

Warner


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Failed to build with external toolchain

2015-03-24 Thread Craig Rodrigues
On Sat, Mar 7, 2015 at 3:48 PM, Dimitry Andric  wrote:

> On 07 Mar 2015, at 21:12, Craig Rodrigues  wrote:
> > I ran the build again and this time I am getting errors about undefined
> > symbol utimensat():
> >
> >
> https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/14/console
> >
> > Any ideas?
>
> It's linking against the wrong libc, the one from the FreeBSD-10 host
> system, which does not have utimensat():
>
> --- cp ---
> /usr/local/bin/x86_64-portbld-freebsd10.0-gcc -isystem
> /builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_external_toolchain_gcc/tmp/usr/include
> -L/builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_external_toolchain_gcc/tmp/usr/lib
> -O2 -pipe   -DVM_AND_BUFFER_CACHE_SYNCHRONIZED -D_ACL_PRIVATE -std=gnu99
> -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
>
> There should probably be a --sysroot flag in there, pointing to the
> ${WORLDTMP} built during the earlier stages.
>
> For some reason, this flag is not added for gcc, in Makefile.inc1.  No
> idea why that was done.
>
> -Dimitry
>
> I eliminated the problem with this patch:

Index: Makefile.inc1
===
--- Makefile.inc1   (revision 280353)
+++ Makefile.inc1   (working copy)
@@ -381,9 +381,9 @@
 TARGET_ABI?=   unknown
 TARGET_TRIPLE?=
${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
 XCFLAGS+=  -target ${TARGET_TRIPLE}
+.endif
 XCFLAGS+=  --sysroot=${WORLDTMP} ${BFLAGS}
 XCXXFLAGS+=--sysroot=${WORLDTMP} ${BFLAGS}
-.endif
 .else
 .if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX})
 BFLAGS+=   -B${CROSS_BINUTILS_PREFIX}


This sets --sysroot when doing CROSS_TOOLCHAIN for both clang *or* gcc.
Right now,  --sysroot is only set for clang.

I did a "make universe" and "make buildworld
CROSS_TOOLCHAIN_PREFIX=/usr/bin/"

Is it OK if I commit it?
--
Craig
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Failed to build with external toolchain

2015-03-10 Thread Craig Rodrigues
On Sat, Mar 7, 2015 at 3:48 PM, Dimitry Andric  wrote:

> On 07 Mar 2015, at 21:12, Craig Rodrigues  wrote:
> > I ran the build again and this time I am getting errors about undefined
> > symbol utimensat():
> >
> >
> https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/14/console
> >
> > Any ideas?
>
> It's linking against the wrong libc, the one from the FreeBSD-10 host
> system, which does not have utimensat():
>
> --- cp ---
> /usr/local/bin/x86_64-portbld-freebsd10.0-gcc -isystem
> /builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_external_toolchain_gcc/tmp/usr/include
> -L/builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_external_toolchain_gcc/tmp/usr/lib
> -O2 -pipe   -DVM_AND_BUFFER_CACHE_SYNCHRONIZED -D_ACL_PRIVATE -std=gnu99
> -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
>
> There should probably be a --sysroot flag in there, pointing to the
> ${WORLDTMP} built during the earlier stages.
>
> For some reason, this flag is not added for gcc, in Makefile.inc1.  No
> idea why that was done.
>


Oh, OK.  So if I set CROSS_TOOLCHAIN=amd64-gcc,

(1)  /usr/local/share/toolchains/amd64-gcc.mk is included

(2)  X_COMPILER_TYPE=gcc is defined in (1)

(3)   This code is hit in Makefile.inc1:

.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc
XCFLAGS+=   -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib
XCXXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11
-L${WORLDTMP}/../lib/libc++
DEPFLAGS+=  -I${WORLDTMP}/usr/include/c++/v1
.else
TARGET_ABI?=unknown
TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
XCFLAGS+=   -target ${TARGET_TRIPLE}
XCFLAGS+=   --sysroot=${WORLDTMP} ${BFLAGS}
XCXXFLAGS+= --sysroot=${WORLDTMP} ${BFLAGS}


So does this mean that --sysroot is not set?
Should it be?

--
Craig
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Failed to build with external toolchain

2015-03-07 Thread Dimitry Andric
On 07 Mar 2015, at 21:12, Craig Rodrigues  wrote:
> I ran the build again and this time I am getting errors about undefined
> symbol utimensat():
> 
> https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/14/console
> 
> Any ideas?

It's linking against the wrong libc, the one from the FreeBSD-10 host
system, which does not have utimensat():

--- cp ---
/usr/local/bin/x86_64-portbld-freebsd10.0-gcc -isystem 
/builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_external_toolchain_gcc/tmp/usr/include
 
-L/builds/FreeBSD_HEAD_external_toolchain_gcc/obj/builds/FreeBSD_HEAD_external_toolchain_gcc/tmp/usr/lib
 -O2 -pipe   -DVM_AND_BUFFER_CACHE_SYNCHRONIZED -D_ACL_PRIVATE -std=gnu99 
-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

There should probably be a --sysroot flag in there, pointing to the
${WORLDTMP} built during the earlier stages.

For some reason, this flag is not added for gcc, in Makefile.inc1.  No
idea why that was done.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Failed to build with external toolchain

2015-03-07 Thread Garrett Cooper
On Mar 7, 2015, at 12:12, Craig Rodrigues  wrote:

> Hi,
> 
> I ran the build again and this time I am getting errors about undefined
> symbol utimensat():
> 
> https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/14/console
> 
> Any ideas?

You might need to specify more options to gcc to get it to compile in base. 
AFAIK we still have all of the “bootstrap” (-sysroot, etc) customizations 
checked into base with clang/gcc, so using the tools from ports might not work 
in all cases :/.


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Failed to build with external toolchain

2015-03-07 Thread Craig Rodrigues
Hi,

I ran the build again and this time I am getting errors about undefined
symbol utimensat():

https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/14/console

Any ideas?

--
Craig
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Failed to build with external toolchain

2015-03-04 Thread Dimitry Andric
On 04 Mar 2015, at 09:48, Craig Rodrigues  wrote:
> 
> On Tue, Mar 3, 2015 at 9:17 AM, Dimitry Andric  wrote:
> 
>> On 03 Mar 2015, at 09:00, Craig Rodrigues  wrote:
>> CXXFLAGS+= -D_LIBCPP_HAS_NO_ADVANCED_SFINAE
>> 
>> to the make.conf file you use for building.
>> 
> 
> Thanks for the tip.  I added that to make.conf, but now
> I am getting a different error involving unknown compiler flags:
> 
> https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/13/console
> 
> Any ideas?

Yes, this is due to a custom -mno-align-long-strings flag, which is only
supported by gcc in base.  I've conditionalized it in r279598, so please
try again after that.  You will also need this patch I just posted to
freebsd-current [1] for libnv: gcc reports the same error about an
ambiguous operator<< for one of its ATF tests.

-Dimitry

[1] https://lists.freebsd.org/pipermail/freebsd-current/2015-March/054935.html


libnv-fix-tests-cxx11-1.diff
Description: Binary data


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Failed to build with external toolchain

2015-03-04 Thread Craig Rodrigues
On Tue, Mar 3, 2015 at 9:17 AM, Dimitry Andric  wrote:

> On 03 Mar 2015, at 09:00, Craig Rodrigues  wrote:
> CXXFLAGS+= -D_LIBCPP_HAS_NO_ADVANCED_SFINAE
>
> to the make.conf file you use for building.
>

Thanks for the tip.  I added that to make.conf, but now
I am getting a different error involving unknown compiler flags:

https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/13/console

Any ideas?

Thanks.

--
Craig
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"


Re: Failed to build with external toolchain

2015-03-03 Thread Dimitry Andric
On 03 Mar 2015, at 09:00, Craig Rodrigues  wrote:
> 
> Based on this mail:
> 
> https://lists.freebsd.org/pipermail/freebsd-current/2014-November/053577.html
> 
> I created this script to build HEAD with amd64-gcc:
> https://github.com/freebsd/freebsd-ci/blob/master/scripts/build/cross-build.sh
> 
> However, when I ran the script, I got this error:
> 
> https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/6/console
> 
> Any ideas what the problem might be?

Hi Craig,

This is a bad interaction between gcc 4.9.1 and one of libc++'s headers.
I am not yet sure whether it is a problem in libc++ or in gcc, so I have
asked upstream to take a look at it [1].

Meanwhile, as a quick hack/workaround, you can define
_LIBCPP_HAS_NO_ADVANCED_SFINAE in CXXFLAGS to attempt to make the build
continue.  E.g., add:

CXXFLAGS+= -D_LIBCPP_HAS_NO_ADVANCED_SFINAE

to the make.conf file you use for building.

-Dimitry

[1] http://llvm.org/PR22771



signature.asc
Description: Message signed with OpenPGP using GPGMail


Failed to build with external toolchain

2015-03-03 Thread Craig Rodrigues
Hi,

Based on this mail:

https://lists.freebsd.org/pipermail/freebsd-current/2014-November/053577.html

I created this script to build HEAD with amd64-gcc:
https://github.com/freebsd/freebsd-ci/blob/master/scripts/build/cross-build.sh

However, when I ran the script, I got this error:

https://jenkins.freebsd.org/job/FreeBSD_HEAD_external_toolchain_gcc/6/console

Any ideas what the problem might be?

--
Craig
___
freebsd-toolchain@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"