Also disable this if NO_SAFE_LIBINSTALL is defined.
There is little harm in always using -S and it fixes several issues:
- A race during 'make libraries' where, for example, libgcc_s is being
installed while another library is trying to link against it. This is
possible because libgcc_s is connected in both _prereq_libs and
_startup_libs. The first build (_prereq_libs) sets MK_PROFILE=no
while the 2nd pass (_startup_libs) enables MK_PROFILE. Thus the
libgcc_s library *is* present in WORLDTMP for other libraries to
link to, so serializing further items in _startup_libs is not
required. Just ensuring that libgcc_s is installed atomically (via
rename(2)) is enough. [1]
- Installation to a running system where some library that cannot be
detected, copied and used from the temporary INSTALLTMP with LD_LIBRARY_PATH
that the build itself uses for installation. Such an example is having the
install an NSS module for user lookups that install(1) uses while
concurrently installing the module in another process. This is not
a problem for the FreeBSD base build but can be for downstream
vendors. While this is a very specific case, installation to a
running system with non-atomic library installation is prone to many
problems. A further step still is to install in proper dependency
ordering.
Reported by: dhw many times [1]
Sponsored by: Dell EMC Isilon
MFC after: 2 weeks
== Rationale ==
r295380 introduced "make check" and consolidated means for running
test code in an attempt to simplify running tests. One could either
install files/libraries/programs and run "make check", or run "make check"
with an explicit CHECKDIR, e.g., `make check CHECKDIR=$(make -V.OBJDIR)``.
One criticism that was received is that "make check" should be run with
the intent of making dev->test->commit easier, which means that the target
audience's workflow should be developers. One developer pattern available
in other opensource projects is to run test code from a developer sandbox,
instead of installing to a system.
== Method ==
This approach is slightly different from the standard approach, in the sense
that it builds and installs into a deterministic directory under .OBJDIR (as I call it,
the "sandbox"), then runs "make check" against that. In the event the test
run is successful, the deterministic directory is removed to save space.
== Approach ==
bsd.lib.mk, bsd.prog.mk:
To support this functionality, a new variable `HAS_TESTS` is being added.
HAS_TESTS enables appropriate behavior with bsd.lib.mk and bsd.prog.mk, as
follows:
- Add "make check" as an available target from the directory.
- Pass down appropriate variables via ${TESTS_ENV}, i.e.,
${TESTS_LD_LIBRARY_PATH} and ${TESTS_PATH}.
One should add "HAS_TESTS" to directories containing tests in them, e.g. from
bin/sh/Makefile,
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
HAS_TESTS doesn't automatically add the tests subdirectory for flexibility
reasons.
bsd.opts.mk, src.opts.mk:
- The knob ${MK_MAKE_CHECK_USE_SANDBOX} has been added, both to explicitly
direct (internally) when to set a deterministic ${DESTDIR} and to also allow
users to disable this behavior globally, i.e., via src.conf.
- MK_TESTS has been promoted from src.opts.mk to bsd.opts.mk to leverage
syntactic sugar for having MK_TESTS be a dependency for
MK_MAKE_CHECK_USE_SANDBOX, but to also ensure that src.opts.mk isn't required
to use suite.test.mk (which is a dependency of bsd.test.mk).
suite.test.mk:
- beforecheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified
from a no-op to:
-- Build.
-- Run "make hierarchy" on the sandbox dir.
-- Install the tests/files to the sandbox dir.
- aftercheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified
from a no-op to:
-- Remove the sandbox dir.
Again, because the dependency order set in bsd.test.mk is
beforecheck -> check -> aftercheck, "make check" will not be run unless
"beforecheck" completes successfully, and "aftercheck" will not be run unless
"beforecheck" and "check" complete successfully.
== Caveats ==
- This target must either be run with MK_INSTALL_AS_USER or as root. Otherwise
it will fail when running "make install" as the default user/group for many
makefiles when calling INSTALL is root/wheel.
- This target must be run from a suitable top-level directory. For example,
running tests from `tests/sys/fs/tmpfs` won't work, but `tests/sys/fs` will,
because `tests/sys/fs/tmpfs` relies on files installed by `tests/sys/fs`.
- Running MK_INSTALL_AS_USER may introduce determinism issues. However, using
it could identify deficiences in tests in terms of needing to be run as
root, which are not properly articulated in the test requirements.
- The doesn't negate the need for running "make installworld" and
"make checkworld", etc. Again, this just is intended to simplify the
dev->test->commit workflow.
== Cleanup done ==
- CHECKDIR is removed; one can use "MK_MAKE_CHECK_USE_SANDBOX=no" to enable
"legacy" (r295380) behavior.
MFC after: 2 months
Relnotes: yes (CHECKDIR removed; "make check" behavior changed)
Requested by: jhb
Reviewed by: arch (silence), testing (silence)
Differential Revision: D11905
time. Remove it from here. As far as I could tell, nothing in ports
use it (either __ARM_ARCH or __ARM_ARCH_6__ is used in all the
apatches). We do have a define for _ARM_ARCH_6, but it's mostly unused
(and will remain, since it isn't in this file).
This excess / was introduced in r280129, and fixed in r295230, but got
re-introduced while merging another branch in r298107.
Approved by: gjb
Differential Revision: https://reviews.freebsd.org/D11995
Consolidate all the regular expressions to convert from MACHINE_ARCH
to MACHINE_CPUARCH into a variable and use that variable in preference
to the almost identical copies in the tree (which should have been
identical).
Differential Revision: https://reviews.freebsd.org/D11986
svnversion metadata to the runtime and kernel packages.
Instead of traversing src/sys, as is done by newvers.sh for uname(1),
a full tree walk is done to prevent userland and/or modifications
from not being reflected in a modified tree (M).
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
New version is not compatible on supervisor mode with v1.9.1
(previous version).
Highlights:
o BBL (Berkeley Boot Loader) provides no initial page tables
anymore allowing us to choose VM, to build page tables manually
and enable MMU in S-mode.
o SBI interface changed.
o GENERIC kernel.
FDT is now chosen standard for RISC-V hardware description.
DTB is now provided by Spike (golden model simulator). This
allows us to introduce GENERIC kernel. However, description
for console and timer devices is not provided in DTB, so move
these devices temporary to nexus bus.
o Supervisor can't access userspace by default. Solution is to
set SUM (permit Supervisor User Memory access) bit in sstatus
register.
o Compressed extension is now turned on by default.
o External GCC 7.1 compiler used.
o _gp renamed to __global_pointer$
o Compiler -march= string is now in use allowing us to choose
required extensions (compressed, FPU, atomic, etc).
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D11800
The assembly in sys/mips/include/profile.h will only work for o32 ABI.
Submitted by: Alexander Richardson
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D11950
src.conf(5) should document which knobs are which and the dependency between each;
remove the comment so the variable can apply to non-"meta mode options".
MFC after: 2 weeks
- bsd.compiler.mk: Must ensure that the CCACHE_WRAPPER_PATH comes first
in PATH.
- Makefile.inc1: Must prepend the CCACHE_WRAPPER_PATH into BPATH as it
overrides the PATH set in bsd.compiler.mk in sub-makes. The PATH
set in bsd.compiler.mk is not exported and doing so would cause it to
then override the BPATH set from environment. The only sane solution
is to prepend into BPATH as needed.
CCACHE_PATH could possibly be used for some of this as well.
Sponsored by: Dell EMC Isilon
This uses the /usr/local/libexec/ccache/<cc,c++> wrappers rather than
modifying CC to be '/usr/local/bin/ccache cc'. Some forms of compilation
do not support the 'command' type.
Sponsored by: Dell EMC Isilon
already built with this flag so libstand should also be build as such.
This will be needed when moving to lld as it refuses to link due to
incompatible relocations.
Sponsored by: DARPA, AFRL
This fixes 'make cleandir' to use the same ordering as 'make cleanobj'.
Meaning that SUBDIR will be recursed before the current directory is
handled. This avoids an 'rm -rf /usr/obj/usr/src/lib/libc' while
a child 'rm -rf /usr/obj/usr/src/lib/libc/tests' is being ran next,
or even removing the current directory and then recursing into a child
and using the 'missing OBJDIR' logic to remove files rather than the
directory.
The most ideal ordering here would be for 'cleanobj' and 'cleandir' to
simply remove the .OBJDIR and then not recurse at all. This is only
safe if it is guaranteed that all children directories have no orphaned
files in their source checkout and are only using obj directories. This
is usually safe from the top-level build targets and when using
WITH_AUTO_OBJ. Improving the build for those cases is coming.
Reported by: cperciva, scottl
X-MFC-With: r321427
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
- Only recurse on cleanobj/cleandir if there is no .OBJDIR being used.
If we don't recurse then bsd.obj.mk will just rm -rf the OBJDIR dir.
- When recursing on cleanobj/cleandir don't remove dependfiles/dirs
redundantly from the child and main processes. Meaning '.depend', and
'tags', and '.depend.*' will now only be removed from the main
process.
- Stop recursing on 'cleandepend' since the main process can handle
removing all files via the default glob patterns in CLEANDEPENDFILES.
- This reverts r288201, by readding recursion on 'cleanobj', due to
r291635 changing how bsd.subdir.mk handles recursion.
This is primarily targeting ESTALE NFS errors from rm(1) during a
buildworld but is also a performance optimization as both issues fixed
were redundant anyway.
Reported by: cperciva, scottl
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Also switch the logic to enable this for any non-lld linker, since
filter library support is fairly simple and is very likely supported
by any other linker capable of linking the FreeBSD base system.
MFC after: 2 months
MFC with: r321369
Sponsored by: The FreeBSD Foundation
Create libdl.so.1 as a filter for libc.so.7 which exports public dl*
functions. The functions are resolved from the rtld instead, the goal
of creating library is to avoid errors from the static linker due to
missed libdl. For static binaries, an empty .o is compiled into
libdl.a so that static binaries still get dl stubs from libc.a.
Right now lld cannot create filter objects, disable libdl on arm64
when binutils are not used.
Reviewed by: bdrewery, dim (previos version); emaste
Exp run: PR 220525, done by antoine
Sponsored by: The FreeBSD Foundation
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D11504
`MK_ZONEINFO_LEAPSECONDS_SUPPORT == yes` and
`MK_ZONEINFO_OLD_TIMEZONES_SUPPORT == yes`.
Keep `LEAPSECONDS` and `OLDTIMEZONES` for backwards compatibility,
but print out a warning notifying users that they should use the new
variables, in an effort to migrate them to the variables. This is being
done mostly for automated build tools, etc, that might rely on these
variables being set. The variables will be removed in the future on
^/head, e.g., after ^/stable/12 is cut.
MFC after: 1 month
Relnotes: yes
Reviewed by: bdrewery
Differential Revision: D11376
In some cases bsd.linker.mk reports an error like:
make[4]: ".../share/mk/bsd.linker.mk" line 56:
Unknown linker from LD=ld -m elf32ppc_fbsd:"
For now change this to a .warning, and then assume GNU ld 2.17.50.
At present the linker type detection is used only for enabling build-id,
and we can carry on without it when type detection fails.
Also, show errors from ${LD} --version to aid in failure diagnosis.
Successful invocations of ${LD} --version produce no output on stderr
so this will not create any spam in non-failing builds.
Tested by: swills
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D11424
GNU binutils includes two linkers: ld.bfd and ld.gold. For clarity use
LINKER_TYPE=bfd to refer to ld.bfd, the original binutils linker that
identifies itself as "GNU ld".
Discussed with: bdrewery
The ports binutils stores the version in the 5th word so just look for
a version using a pattern instead.
Reported by: rpokala
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
This is similar to r289659 for bsd.compiler.mk.
MFC after: 2 weeks
Reviewed by: emaste
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11310
This is similar to r300350 for bsd.compiler.mk.
MFC after: 2 weeks
Reviewed by: emaste
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11309
- Rename _SKIP_READ_DEPEND to _SKIP_DEPEND since it also avoids writing.
- This now uses .NOMETA to avoid reading any .meta files related to
DEPENDOBJS. Objects not in OBJS/DEPENDOBJS may still have their .meta
files read in if they are in the dependency graph.
- This also avoids statting .meta and .depend files in the META_MODE +
-DNO_FILEMON case.
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Otherwise in META_MODE it may create an objwarn.meta if only bsd.obj.mk
is included; bsd.sys.mk already had .PHONY: objwarn.
MFC after: 3 days
Sponsored by: Dell EMC Isilon
This likely broke completely with r308599.
Apply the same fix for 'make destroy' which is a DIRDEPS_BUILD thing.
PR: 219819
Reported by: trasz
MFC after: 3 days
Sponsored by: Dell EMC Isilon
LIBADD is only supported for in-tree builds because we do not install
share/mk/src.libnames.mk (which provides LIBADD support) into /usr/share/mk.
So if a partial checkout is done then the LIBADDs are ignored and no LDADD is
ever added.
Provide limited support for this case for when LIBADD is composed entirely of
base libraries. This is to avoid clashes with ports and other out-of-tree
LIBADD uses that should not be mapped to LDADD and because we do not want to
support LIBADD out-of-tree right now.
Reported by: mckusick, kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon