Re: Failed to build with external toolchain

2015-03-24 Thread Warner Losh

 On Mar 24, 2015, at 9:18 PM, Craig Rodrigues rodr...@freebsd.org wrote:
 
 On Sat, Mar 7, 2015 at 3:48 PM, Dimitry Andric d...@freebsd.org wrote:
 
 On 07 Mar 2015, at 21:12, Craig Rodrigues rodr...@freebsd.org 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-07 Thread Dimitry Andric
On 07 Mar 2015, at 21:12, Craig Rodrigues rodr...@freebsd.org 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-04 Thread Dimitry Andric
On 04 Mar 2015, at 09:48, Craig Rodrigues rodr...@freebsd.org wrote:
 
 On Tue, Mar 3, 2015 at 9:17 AM, Dimitry Andric d...@freebsd.org wrote:
 
 On 03 Mar 2015, at 09:00, Craig Rodrigues rodr...@freebsd.org 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 d...@freebsd.org wrote:

 On 03 Mar 2015, at 09:00, Craig Rodrigues rodr...@freebsd.org 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 rodr...@freebsd.org 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