Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Mar 2015 02:17:04 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        freebsd-toolchain@freebsd.org
Cc:        FreeBSD PowerPC ML <freebsd-ppc@freebsd.org>
Subject:   A libc++ .depend status mismatch between /usr/src/Makefile.inc1 and bsd.prog.mk for ${X_COMPILER_TYPE} == gcc?
Message-ID:  <4E9596C3-375E-42DE-ABA3-5066BE3756C5@dsl-only.net>

next in thread | raw e-mail | index | archive | help
Basic context:

> # dmesg | head
> ...
> FreeBSD 11.0-CURRENT #1 r279514M: Sat Mar 21 05:15:23 PDT 2015
>    root@FBSDG5C0:/usr/obj/usr/srcC/sys/GENERIC64vtsc-NODEBUG powerpc
> gcc version 4.9.1 (FreeBSD Ports Collection for powerpc64)=20
> ...

(I used powerpc64-xtoolchain-gcc in a powerpc64 context to self-host, =
WITHOUT_CLANG=3D WITHOUT_LLDB=3D WITHOUT_GCC=3D WITHOUT_GNUCXX=3D =
WITHOUT_BOOT=3D WITHOUT_LIB32=3D . powerpc64-xtoolchain-gcc did not =
provide itself with a libstdc++ of its own.)

> # freebsd-version -ku; uname -apKU                                     =
                                                    11.0-CURRENT
> 11.0-CURRENT
> FreeBSD FBSDG5C0 11.0-CURRENT FreeBSD 11.0-CURRENT #1 r279514M: Sat =
Mar 21 05:15:23 PDT 2015     =
root@FBSDG5C0:/usr/obj/usr/srcC/sys/GENERIC64vtsc-NODEBUG  powerpc =
powerpc64 1100062 1100062

> make -j 8 CROSS_TOOLCHAIN=3Dpowerpc64-gcc \
> WITHOUT_CLANG_BOOTSTRAP=3D WITHOUT_CLANG=3D WITHOUT_CLANG_IS_CC=3D \
> WITHOUT_LLDB=3D \
> WITH_GCC_BOOTSTRAP=3D WITH_GCC=3D WITHOUT_GNUCXX=3D \
> WITHOUT_BOOT=3D WITHOUT_LIB32=3D \
> buildworld buildkernel \
> KERNCONF=3DGENERIC64vtsc-NODEBUG \
> TARGET=3Dpowerpc TARGET_ARCH=3Dpowerpc64

> # more /etc/src.conf=20
> NO_WERROR=3D
> WITH_LIBCPLUSPLUS=3D
> #CFLAGS+=3D-DELF_VERBOSE
> #WITH_DEBUG_FILES=3D
> #
> # For trying powerpc64-xtoolchain-gcc...
> # (Force stages that do not use XCC, XCXX, XCPP to
> #  also use powerpc64-xtoolchain.gcc's programs.)
> #
> CC=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-gcc
> CXX=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-g++
> CPP=3D/usr/local/bin/powerpc64-portbld-freebsd11.0-cpp
> CROSS_BINUTILS_PREFIX=3D/usr/local/powerpc64-freebsd/bin/
> X_COMPILER_TYPE=3Dgcc
> #
> # CXXFLAGS For buildworld/buildkernel CROSS_TOOLCHAIN=3Dpowerpc64-gcc =
use...
> # spans being-built and (failing finding those directories) live and =
so for
> # -DNO_CLEAN after being-built ones are in place and the results =
depend on
> # self-hosting where the two are sufficiently compatibile.
> #
> # I've used .../. paths below so I can tell use of these from other =
sources of paths.
> #
> # Actually only appropriate for for _includes _libraries _depend =
everything build32 :
> CXXFLAGS+=3D-I/usr/obj/usr/srcC/tmp/usr/include/c++/v1/. -std=3Dgnu++11 =
-L/usr/obj/usr/srcC/lib/libc++/.
> #
> # Actually only appropriate for for _worldtmp _legacy _bootstrap-tools =
_cleanobj _obj _build-tools _cross-tools :
> CXXFLAGS+=3D-I/usr/include/c++/v1/. -std=3Dgnu++11 -L/usr/lib/.
> #
> # But for self-hosting in a cross tools like manor sometimes having =
both can work.



The problem:

/usr/src/Makefile.inc1 has the following code for cross compilation =
contexts:

> .if ${XCC:M/*}
> ...
> .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} =3D=3D gcc
> XCFLAGS+=3D       -isystem ${WORLDTMP}/usr/include =
-L${WORLDTMP}/usr/lib
> XCXXFLAGS+=3D     -I${WORLDTMP}/usr/include/c++/v1 -std=3Dgnu++11 =
-L${WORLDTMP}/../lib/libc++
> DEPFLAGS+=3D      -I${WORLDTMP}/usr/include/c++/v1
> .else
> ...

In essence having gcc based XCXX cross compilers (X_COMPILER_TYPE) use =
libc++'s headers and library for XCXX with gnu++11 (so implicitly c++11) =
enabled. libstdc++ is not used.

[Note: atf-c++ did did not get automatic header access from the above =
for some reason but my /etc/src.conf assignments covered that case.]

bsd.prog.mk has the following contrasting code:

> .if defined(PROG)
> _EXTRADEPEND:
>   .if defined(LDFLAGS) && !empty(LDFLAGS:M-nostdlib)
>     .if defined(DPADD) && !empty(DPADD)
>         echo ${PROG_FULL}: ${DPADD} >> ${DEPENDFILE}
>     .endif
>   .else
>         echo ${PROG_FULL}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
>     .if defined(PROG_CXX)
>       .if ${COMPILER_TYPE} =3D=3D "clang" && =
empty(CXXFLAGS:M-stdlib=3Dlibstdc++)
>         echo ${PROG_FULL}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
>       .else
>         echo ${PROG_FULL}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
>       .endif
>     .endif
>   .endif
> .endif


[There is no direct tie between X_COMPILER_TYPE and COMPILER_TYPE in =
general but with my /etc/src.conf there is.]

In essence (other than -nostdlib and also non-c++ code):

Only when COMPILER_TYPE for c++ indicates clang explicitly (without =
there being a -stdlib=3Dlibstdc++) is a libc++ dependency written out. =
The other c++ cases without -nostdlib always write out a libstdc++ =
dependency.



My powerpc64-xtoolchain-gcc buildworld buildkernel logs do not show =
libc++ additions to .depend files.

But they do show the following (from grep activity), although not =
necessarily from the above code in every case:

echo gperf: /usr/lib/libstdc++.a >> .depend
echo grodvi: /usr/lib/libstdc++.a >> .depend
echo addftinfo: /usr/lib/libstdc++.a >> .depend
echo groff: /usr/lib/libstdc++.a >> .depend
echo hpftodit: /usr/lib/libstdc++.a >> .depend
echo grn: /usr/lib/libstdc++.a >> .depend
...
echo troff: /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a >> .depend
echo hpftodit: /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a >> .depend
echo tests_test: /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a >> =
.depend.tests_test
echo indxbib: /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a >> .depend
echo lkbib: /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a >> .depend
echo utils_test: /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a >> =
.depend.utils_test
echo lookbib: /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a >> .depend
echo tfmtodit: /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a >> .depend
echo cpp_helpers: /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a >> =
.depend.cpp_helpers
echo users: /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a >> .depend



Some stale .depend notices for libstdc++.a are also generated (more grep =
activity):

make[5]: /usr/obj/usr/srcC/libexec/atf/atf-check/.depend, 105: ignoring =
stale .depend for /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[5]: /usr/obj/usr/srcC/libexec/atf/atf-sh/.depend, 89: ignoring =
stale .depend for /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[4]: /usr/obj/usr/srcC/sbin/devd/.depend, 99: ignoring stale .depend =
for /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[8]: /usr/obj/usr/srcC/gnu/usr.bin/groff/src/devices/grodvi/.depend, =
34: ignoring stale .depend for /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[8]: =
/usr/obj/usr/srcC/gnu/usr.bin/groff/src/devices/grohtml/.depend, 151: =
ignoring stale .depend for /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[8]: /usr/obj/usr/srcC/gnu/usr.bin/groff/src/devices/grolbp/.depend, =
36: ignoring stale .depend for /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
...
make[4]: /usr/obj/usr/srcC/usr.bin/users/.depend, 77: ignoring stale =
.depend for /usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[7]: =
/usr/obj/usr/srcC/lib/atf/libatf-c++/tests/.depend.atf_c++_test, 197: =
ignoring stale .depend.atf_c++_test for =
/usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[7]: /usr/obj/usr/srcC/lib/atf/libatf-c++/tests/.depend.build_test, =
199: ignoring stale .depend.build_test for =
/usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[7]: /usr/obj/usr/srcC/lib/atf/libatf-c++/tests/.depend.check_test, =
204: ignoring stale .depend.check_test for =
/usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[7]: /usr/obj/usr/srcC/lib/atf/libatf-c++/tests/.depend.macros_test, =
201: ignoring stale .depend.macros_test for =
/usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[7]: /usr/obj/usr/srcC/lib/atf/libatf-c++/tests/.depend.tests_test, =
187: ignoring stale .depend.tests_test for =
/usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[7]: /usr/obj/usr/srcC/lib/atf/libatf-c++/tests/.depend.utils_test, =
186: ignoring stale .depend.utils_test for =
/usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a
make[7]: =
/usr/obj/usr/srcC/lib/atf/tests/test-programs/.depend.cpp_helpers, 95: =
ignoring stale .depend.cpp_helpers for =
/usr/obj/usr/srcC/tmp/usr/lib/libstdc++.a



Context details:

# more /etc/make.conf=20
WRKDIRPREFIX=3D/usr/obj/portswork
#WITH_DEBUG=3D
MALLOC_PRODUCTION=3D

# svnlite info /usr/srcC/
Path: .
Working Copy Root Path: /usr/srcC
URL: https://svn0.us-west.freebsd.org/base/head
Relative URL: ^/head
Repository Root: https://svn0.us-west.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 279514
Node Kind: directory
Schedule: normal
Last Changed Author: adrian
Last Changed Rev: 279514
Last Changed Date: 2015-03-01 18:27:25 -0800 (Sun, 01 Mar 2015)

# svnlite status /usr/srcC/ --no-ignore
?       /usr/srcC/.snap
M       /usr/srcC/contrib/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
M       /usr/srcC/lib/libpjdlog/pjdlog.c
?       /usr/srcC/restoresymtable
M       /usr/srcC/sys/ddb/db_main.c
M       /usr/srcC/sys/ddb/db_script.c
?       /usr/srcC/sys/powerpc/conf/GENERIC64vtsc
?       /usr/srcC/sys/powerpc/conf/GENERIC64vtsc-NODEBUG
?       /usr/srcC/sys/powerpc/conf/GENERICvtsc
?       /usr/srcC/sys/powerpc/conf/GENERICvtsc-NODEBUG
M       /usr/srcC/sys/powerpc/ofw/ofw_machdep.c
M       /usr/srcC/sys/powerpc/ofw/ofwcall64.S

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4E9596C3-375E-42DE-ABA3-5066BE3756C5>