Date: Tue, 5 Nov 2013 19:17:52 -0500 From: Julio Merino <julio@meroh.net> To: freebsd-testing@freebsd.org Cc: Rui Paulo <rpaulo@fnop.net> Subject: Fixing the build with TESTS Message-ID: <CADyfeQW4GwhKgg4P8OWELnGWvDO8mvSjjo7Og3WMk2uxAGBGoA@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hello,
The previous changes to enable the installation of tests broke the
build and is the reason why Rui had to default the TESTS knob to 'no'.
The reason for the breakage is the following:
When buildworld starts by building the basic "bootstrap" libraries, it
does a "make all" within various lib/* directories, including
libcrypt. libcrypt had tests added to it, which means that "make all"
recursed into the tests directory and attempted to build them. But, at
that point, the atf libraries had not yet been built. I did not
encounter this issue because I'm running builds with MK_CLEAN=no (yup,
lesson learned).
I think it's wrong for this stage of buildworld to attempt building
tests at all. atf is just one of the many dependencies we'd encounter,
and we should not try to build all dependencies upfront... because we
cannot. (Just imagine when libc starts getting tests.)
The fix-build-bootstrap.patch attached attempts to correct this by
explicitly disabling the build of any tests during the initial build
of the bootstrap components. I'm not sure this patch is nice enough,
although it follows the style of various other related knobs; if you
have better ideas, please share.
Additionally, we will encounter similar issues once we have tests that
use C++ (which we will, if only because of libatf-c++'s tests), so we
should also do what fix-build-atf-cxx.patch proposes.
Thoughts?
Thanks,
--
Julio Merino / @jmmv
[-- Attachment #2 --]
Add libatf-c++ to the prebuild libs.
Some tests may require C++ so we must ensure this library exists as part
of the bootstrap process or else they will fail to build.
Index: src/Makefile.inc1
===================================================================
--- src.orig/Makefile.inc1
+++ src/Makefile.inc1
@@ -1462,6 +1462,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1
${_kerberos5_lib_libroken} \
${_kerberos5_lib_libwind} \
${_lib_atf_libatf_c} \
+ ${_lib_atf_libatf_cxx} \
lib/libbz2 ${_libcom_err} lib/libcrypt \
lib/libelf lib/libexpat \
${_lib_libgssapi} ${_lib_libipx} \
@@ -1477,6 +1478,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1
.if ${MK_ATF} != "no"
_lib_atf_libatf_c= lib/atf/libatf-c
+_lib_atf_libatf_cxx= lib/atf/libatf-c++
.endif
.if ${MK_LIBTHR} != "no"
[-- Attachment #3 --]
Fix clean builds when WITH_TESTS is enabled.
The addition of the TESTS knob and its enabling of the build of tests in
lib/libcrypt/tests/ broke the build. The reason is that we cannot descend
into tests/ subdirectories until all prerequisites have been built, which
in the case of tests may be "a lot of things" (libatf-c in this case).
Ensure that we do not walk tests/ directories during the bootstrapping of
the libraries as part of buildworld.
Index: src/Makefile.inc1
===================================================================
--- src.orig/Makefile.inc1
+++ src/Makefile.inc1
@@ -1585,10 +1585,12 @@ ${_lib}__PL: .PHONY .MAKE
.if exists(${.CURDIR}/${_lib})
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_lib} && \
- ${MAKE} DIRPRFX=${_lib}/ obj && \
- ${MAKE} DIRPRFX=${_lib}/ depend && \
- ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all && \
- ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
+ ${MAKE} DIRPRFX=${_lib}/ -D_NO_TESTS_YET obj && \
+ ${MAKE} DIRPRFX=${_lib}/ -D_NO_TESTS_YET depend && \
+ ${MAKE} DIRPRFX=${_lib}/ -D_NO_TESTS_YET -DNO_PROFILE \
+ -DNO_PIC all && \
+ ${MAKE} DIRPRFX=${_lib}/ -D_NO_TESTS_YET -DNO_PROFILE \
+ -DNO_PIC install
.endif
.endfor
@@ -1597,10 +1599,10 @@ ${_lib}__L: .PHONY .MAKE
.if exists(${.CURDIR}/${_lib})
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_lib} && \
- ${MAKE} DIRPRFX=${_lib}/ obj && \
- ${MAKE} DIRPRFX=${_lib}/ depend && \
- ${MAKE} DIRPRFX=${_lib}/ all && \
- ${MAKE} DIRPRFX=${_lib}/ install
+ ${MAKE} DIRPRFX=${_lib}/ -D_NO_TESTS_YET obj && \
+ ${MAKE} DIRPRFX=${_lib}/ -D_NO_TESTS_YET depend && \
+ ${MAKE} DIRPRFX=${_lib}/ -D_NO_TESTS_YET all && \
+ ${MAKE} DIRPRFX=${_lib}/ -D_NO_TESTS_YET install
.endif
.endfor
@@ -1610,10 +1612,12 @@ ${_lib}__L: .PHONY .MAKE
lib/libpam__L: .PHONY .MAKE
${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
cd ${.CURDIR}/lib/libpam && \
- ${MAKE} DIRPRFX=lib/libpam/ obj && \
- ${MAKE} DIRPRFX=lib/libpam/ depend && \
- ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all && \
- ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
+ ${MAKE} DIRPRFX=lib/libpam/ -D_NO_TESTS_YET obj && \
+ ${MAKE} DIRPRFX=lib/libpam/ -D_NO_TESTS_YET depend && \
+ ${MAKE} DIRPRFX=lib/libpam/ -D_NO_TESTS_YET \
+ -D_NO_LIBPAM_SO_YET all && \
+ ${MAKE} DIRPRFX=lib/libpam/ -D_NO_TESTS_YET \
+ -D_NO_LIBPAM_SO_YET install
_prereq_libs: ${_prereq_libs:S/$/__PL/}
_startup_libs: ${_startup_libs:S/$/__L/}
Index: src/share/mk/bsd.own.mk
===================================================================
--- src.orig/share/mk/bsd.own.mk
+++ src/share/mk/bsd.own.mk
@@ -556,6 +556,13 @@ MK_CLANG_FULL:= no
MK_LLDB:= no
.endif
+.if defined(_NO_TESTS_YET)
+# At the beginning of a fresh buildworld, we must ensure that we don't
+# descend into any tests/ subdirectories until we have built all the
+# necessary dependent libraries.
+MK_TESTS:= no
+.endif
+
#
# Set defaults for the MK_*_SUPPORT variables.
#
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CADyfeQW4GwhKgg4P8OWELnGWvDO8mvSjjo7Og3WMk2uxAGBGoA>
