Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Mar 2015 01:02:10 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        Warner Losh <imp@bsdimp.com>
Cc:        freebsd-toolchain@freebsd.org, FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   Re: On powerpc 11.0-CURRENT CROSS_TOOLCHAIN=powerpc64-gcc fails: clang-tblgen use attempted before it exists
Message-ID:  <FD3C3142-B6CC-410E-8ADF-DFF17AB445A1@dsl-only.net>
In-Reply-To: <357555BE-7F87-4B25-95BE-43DD33CD8FE2@dsl-only.net>
References:  <81E69CED-2977-4146-A1DA-B199FDAFE146@dsl-only.net> <20150130005619.GA11558@ivaldir.etoilebsd.net> <89F97E94-AB9F-46C0-9AA2-C4D0680D64E7@dsl-only.net> <60F1C8B5-8621-452B-A6A3-DEE4B48B848D@dsl-only.net> <E053A305-8925-4CDB-B7D3-A632CB6BBE3D@bsdimp.com> <E3F9CFA6-04C2-482B-A649-035C41C0113C@dsl-only.net> <E5D42704-E94A-4E81-83C2-2B851EA8D023@bsdimp.com> <357555BE-7F87-4B25-95BE-43DD33CD8FE2@dsl-only.net>

next in thread | previous in thread | raw e-mail | index | archive | help
I found why gcc 4.2.1's cc1plus was getting -std=3Dc++11 for the =
CROSS_TOOLCHAIN=3Dpowerpc64-gcc compiles that involve WITH_CLANG=3D . =
(WITHOUT_CLANG=3D does not get the "unrecognized" notices.) There is a =
global assignment to CXXFLAGS for all compilers whenever clang.build.mk =
is in use (showing my experimental change...):

# svnlite diff /usr/srcC/lib/clang/clang.build.mk
Index: /usr/srcC/lib/clang/clang.build.mk
=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
--- /usr/srcC/lib/clang/clang.build.mk	(revision 279514)
+++ /usr/srcC/lib/clang/clang.build.mk	(working copy)
@@ -34,8 +34,8 @@
 CFLAGS+=3D	-DLLVM_DEFAULT_TARGET_TRIPLE=3D\"${TARGET_TRIPLE}\" \
 		-DLLVM_HOST_TRIPLE=3D\"${BUILD_TRIPLE}\" \
 		-DDEFAULT_SYSROOT=3D\"${TOOLS_PREFIX}\"
-CXXFLAGS+=3D	-std=3Dc++11 -fno-exceptions -fno-rtti
-CXXFLAGS.clang+=3D -stdlib=3Dlibc++
+CXXFLAGS+=3D	-fno-exceptions -fno-rtti
+CXXFLAGS.clang+=3D -std=3Dc++11 -stdlib=3Dlibc++
=20
 .PATH:	${LLVM_SRCS}/${SRCDIR}

It may be that the "-fno-exceptions -fno-rtti" are also suspect for =
being not limited to clang contexts.


Note that the above change seems to allow things to run past the point =
of the problem but I do not know if running the gcc 4.2.1's cc1plus was =
really the right thing for whatever was being done when it was reporting =
the not-recognized errors. That could be a different defect.

The build attempt does eventually use the cross compiler despite the =
initial gcc 4.2.1 cc1plus use.



A separate issue is that building clang requires libstdc++ or libc++ =
(such as having use of the typetraits header) and =
powerpc64-xtoolchain-gcc does not include such a library. So even after =
the above change the builds fail whenever WITH_CLANG=3D is involved. An =
"out of the box" powerpc64-xtoolchain-gcc on powerpc64 is potentially =
good for an incomplete FreeBSD 11.0-CURRENT build that excludes clang.

On powerpc (non-64) powerpc64-gcc got errors on assembler notation (when =
clang was excluded so it could otherwise run).

I'm still checking powerpc64-gcc on powerpc64 with clang excluded.

[In order to have powerpc64-gcc and powerpc64-xtoolchain-gcc installed =
on powerpc64 I copied the 4 =
/usr/obj/portswork/usr/ports/devel/powerpc64-gcc/work/stage/usr/local/man/=
man1/ files that had wrong names to the also have copies under the names =
it was trying to use. I also copied =
/usr/obj/portswork/usr/ports/devel/powerpc64-gcc/work/build-gcc/gcc/gcov =
to =
/usr/obj/portswork/usr/ports/devel/powerpc64-gcc/work/stage/usr/local/bin/=
powerpc64-portbld-freebsd11.0-gcov where it had been missing. portmaster =
-DKC devel/powerpc64-xtoolchain-gcc was then able to continue from there =
and installed powerpc64-gcc and powerpc64-xtoolchain-gcc.]


=3D=3D=3D
Mark Millard
markmi at dsl-only.net

On 2015-Mar-12, at 03:13 PM, Mark Millard <markmi at dsl-only.net> =
wrote:

Warner wrote:

> Is cc1plus the g++ compiler that is installed on your bootstrapped =
system, or is it the one that the powerpc64-gcc toolchain built? cc1plus =
-v will help determine that. You may have to find it on your system =
(there=E2=80=99s likely 2) and pass it the -std=3Dc++11 option to see =
which of them fail. We may have a leak / problem with mkdep that your =
unique setup is revealing.


The below details indicate that gcc 4.2.1's /usr/libexec/cc1plus was in =
use when the message about -std=3Dc++11 being unrecognized was generated =
for "make WITH_CLANG=3Dt CROSS_TOOLCHAIN=3Dpowerpc64-gcc toolchain =
KERNCONF=3DGENERICvtsc TARGET=3Dpowerpc TARGET_ARCH=3Dpowerpc".


Details...

# which cc1plus
#

So no cc1plus is in my default path: it is being found another way.

Ingoring the /usr/src/... and /usr/obj/... paths that have a cc1plus...

$ find / -name cc1plus -print
/usr/local/libexec/gcc/powerpc64-portbld-freebsd11.0/4.9.1/cc1plus
...
/usr/libexec/cc1plus
...

No others.

$ ls -FPal =
/usr/local/libexec/gcc/powerpc64-portbld-freebsd11.0/4.9.1/cc1*
-r-xr-xr-x  1 root  wheel  14582156 Mar 12 10:25 =
/usr/local/libexec/gcc/powerpc64-portbld-freebsd11.0/4.9.1/cc1*
-r-xr-xr-x  1 root  wheel  15771164 Mar 12 10:25 =
/usr/local/libexec/gcc/powerpc64-portbld-freebsd11.0/4.9.1/cc1plus*

$ ls -FPal /usr/libexec/cc1*
-r-xr-xr-x  1 root  wheel  6541860 Mar 10 23:21 /usr/libexec/cc1*
-r-xr-xr-x  1 root  wheel  7115952 Mar 10 23:21 /usr/libexec/cc1plus*

$ /usr/local/libexec/gcc/powerpc64-portbld-freebsd11.0/4.9.1/cc1plus -v
ignoring nonexistent directory =
"/usr/local/lib/gcc/powerpc64-portbld-freebsd11.0/4.9.1/../../../../powerp=
c64-portbld-freebsd11.0/include/c++/4.9.1"
ignoring nonexistent directory =
"/usr/local/lib/gcc/powerpc64-portbld-freebsd11.0/4.9.1/../../../../powerp=
c64-portbld-freebsd11.0/include/c++/4.9.1/powerpc64-portbld-freebsd11.0"
ignoring nonexistent directory =
"/usr/local/lib/gcc/powerpc64-portbld-freebsd11.0/4.9.1/../../../../powerp=
c64-portbld-freebsd11.0/include/c++/4.9.1/backward"
ignoring nonexistent directory =
"/usr/local/lib/gcc/powerpc64-portbld-freebsd11.0/4.9.1/../../../../powerp=
c64-portbld-freebsd11.0/sys-include"
ignoring nonexistent directory =
"/usr/local/lib/gcc/powerpc64-portbld-freebsd11.0/4.9.1/../../../../powerp=
c64-portbld-freebsd11.0/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc/powerpc64-portbld-freebsd11.0/4.9.1/include
/usr/local/lib/gcc/powerpc64-portbld-freebsd11.0/4.9.1/include-fixed
End of search list.
^C

$ /usr/libexec/cc1plus -v
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/4.2
/usr/include/c++/4.2/backward
/usr/include/gcc/4.2
/usr/include
End of search list.
^C

$ /usr/local/libexec/gcc/powerpc64-portbld-freebsd11.0/4.9.1/cc1plus =
-std=3Dc++11
^C

$ /usr/libexec/cc1plus -std=3Dc++11
cc1plus: error: unrecognized command line option "-std=3Dc++11"
^C


=3D=3D=3D
Mark Millard
markmi at dsl-only.net

On 2015-Mar-12, at 02:33 PM, Warner Losh <imp at bsdimp.com> wrote:

Thanks Mark. :(

Is cc1plus the g++ compiler that is installed on your bootstrapped =
system, or is it the one that the powerpc64-gcc toolchain built? cc1plus =
-v will help determine that. You may have to find it on your system =
(there=E2=80=99s likely 2) and pass it the -std=3Dc++11 option to see =
which of them fail. We may have a leak / problem with mkdep that your =
unique setup is revealing.

Warner



> On Mar 13, 2015, at 5:42 AM, Mark Millard <markmi@dsl-only.net> wrote:
>=20
> Warner L. wrote about my attempt to use =
rpc64-xtoolchain-gcc/powerpc64-gcc in a powerpc (non-64) context that =
has no clang built:
>=20
>> Trying WITH_CLANG=3Dt ...
>=20
> So I did...
>=20
> make WITH_CLANG=3Dt CROSS_TOOLCHAIN=3Dpowerpc64-gcc toolchain =
KERNCONF=3DGENERICvtsc TARGET=3Dpowerpc TARGET_ARCH=3Dpowerpc
>=20
> This results in a different failure (cc1plus not understanding the =
-std=3Dc++11 option that it ends up being given):
>=20
> --------------------------------------------------------------
>>>> stage 1.2: bootstrap tools
> --------------------------------------------------------------
> ...
> mkdep -f .depend -a    =
-I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include =
-I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/tools/clang/incl=
ude =
-I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support =
-I. =
-I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/=
include -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS =
-D__STDC_CONSTANT_MACROS =
-DLLVM_DEFAULT_TARGET_TRIPLE=3D\"powerpc-unknown-freebsd11.0\" =
-DLLVM_HOST_TRIPLE=3D\"powerpc-unknown-freebsd11.0\" =
-DDEFAULT_SYSROOT=3D\"\" -I/usr/obj/usr/src/tmp/legacy/usr/include  =
-std=3Dc++11      =
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APFloa=
t.cpp
> ... <OMITTING MANY .cpp's> ... =
/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_os=
tream.cpp
> cc1plus: error: unrecognized command line option "-std=3Dc++11"
> cc1plus: error: unrecognized command line option "-std=3Dc++11"
> cc1plus: error: unrecognized command line option "-std=3Dc++11"
> ...
>=20
> =3D=3D=3D
> Mark Millard
> markmi at dsl-only.net
>=20
> On 2015-Mar-12, at 01:24 PM, Warner Losh <imp at bsdimp.com> wrote:
>=20
> Sorry to top post, but try adding WITH_CLANG=3Dt
>=20
> Warner
>=20
>> On Mar 13, 2015, at 4:18 AM, Mark Millard <markmi@dsl-only.net> =
wrote:
>>=20
>> Basic context:
>>=20
>> $ freebsd-version -ku; uname -a
>> 11.0-CURRENT
>> 11.0-CURRENT
>> FreeBSD FBSDG4C0 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r279514M: Mon =
Mar  9 22:24:27 PDT 2015     =
root@FBSDG4S0:/usr/obj/usr/srcC/sys/GENERICvtsc-NODEBUG  powerpc
>> $ svnlite info
>> Path: .
>> Working Copy Root Path: /usr/ports
>> URL: https://svn0.us-west.freebsd.org/ports/head
>> Relative URL: ^/head
>> Repository Root: https://svn0.us-west.freebsd.org/ports
>> Repository UUID: 35697150-7ecd-e111-bb59-0022644237b5
>> Revision: 380683
>> Node Kind: directory
>> Schedule: normal
>> Last Changed Author: demon
>> Last Changed Rev: 380683
>> Last Changed Date: 2015-03-07 03:31:11 -0800 (Sat, 07 Mar 2015)
>>=20
>> I bootstrapped into 11.0-CURRENT from 10.1-STABLE but misunderstood =
UPDATING for the combination of starting from 10.1 on powerpc/powerpc64 =
and ended up without clang for both powerpc and powerpc64 before I =
figure that out.
>>=20
>> While powerpc64-gcc (and so powerpc64-xtoolchain-gcc) fails to build =
when portmaster'd on powerpc64 it does build on powerpc.
>>=20
>> So I portmaster'd powerpc64-xtoolchain-gcc in the powerpc (non-64) =
11.0-CURRENT context to attempt a "cross" compile back to powerpc...
>>=20
>>=20
>>=20
>> The problem:
>> (Or is the below attempt a form of abuse of =
powerpc64-xtoolchain-gcc?)
>> (Remember: no clang exists beforehand.)
>>=20
>> For...
>>=20
>> make CROSS_TOOLCHAIN=3Dpowerpc64-gcc toolchain KERNCONF=3DGENERICvtsc =
TARGET=3Dpowerpc TARGET_ARCH=3Dpowerpc
>>=20
>> or
>>=20
>> make CROSS_TOOLCHAIN=3Dpowerpc64-gcc buildworld buildkernel =
KERNCONF=3DGENERICvtsc TARGET=3Dpowerpc TARGET_ARCH=3Dpowerpc
>>=20
>> Either way the result fails to complete by attempting to use =
clang-tblgen when it does not exist (yet?):
>>=20
>>> ...
>>> --------------------------------------------------------------
>>>>>> stage 1.2: bootstrap tools
>>> --------------------------------------------------------------
>>> ...
>>> =3D=3D=3D> lib/clang/libllvmx86instprinter (buildincludes)
>>> =3D=3D=3D> lib/clang/libllvmx86utils (buildincludes)
>>> =3D=3D=3D> lib/clang/include (buildincludes)
>>> clang-tblgen -gen-arm-neon  -d arm_neon.d -o arm_neon.h  =
/usr/src/lib/clang/include/../../../contrib/llvm/tools/clang/include/clang=
/Basic/arm_neon.td
>>> make[6]: exec(clang-tblgen) failed (No such file or directory)
>>> *** Error code 1
>>>=20
>>> Stop.
>>> make[6]: stopped in /usr/src/lib/clang/include
>>> *** Error code 1
>>>=20
>>> Stop.
>>> make[5]: stopped in /usr/src/lib/clang
>>> *** Error code 1
>>>=20
>>> Stop.
>>> make[4]: stopped in /usr/src/lib
>>> *** Error code 1
>>>=20
>>> Stop.
>>> make[3]: stopped in /usr/src/lib
>>> *** Error code 1
>>>=20
>>> Stop.
>>> make[2]: stopped in /usr/src
>>> *** Error code 1
>>>=20
>>> Stop.
>>> make[1]: stopped in /usr/src
>>> *** Error code 1
>>>=20
>>> Stop.
>>> make: stopped in /usr/src
>>=20
>>=20
>>=20
>> Even if overall this style of bootstrap should not work it seems odd =
to me that clang-tblgen use was attempted before it was built.
>>=20
>> =3D=3D=3D
>> Mark Millard
>> markmi at dsl-only.net
>>=20
>> _______________________________________________
>> freebsd-toolchain@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
>> To unsubscribe, send any mail to =
"freebsd-toolchain-unsubscribe@freebsd.org"
>=20
>=20






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?FD3C3142-B6CC-410E-8ADF-DFF17AB445A1>