Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Make.config
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,15 @@ DOTNET_DIR=$(abspath $(TOP)/builds/downloads/$(DOTNET_INSTALL_NAME))
export DOTNET_ROOT=$(DOTNET_DIR)
# dotnet now is being looked up in the PATH
export PATH := $(DOTNET_DIR):$(PATH)

# Disable build servers to prevent parallel make from hanging.
# Build servers (MSBuild server, Roslyn/VBCSCompiler) inherit jobserver file
# descriptors from make, and don't close them when daemonizing. This prevents
# make from detecting that all jobs have finished, causing it to hang
# indefinitely at the end of the build.
export DOTNET_CLI_USE_MSBUILD_SERVER=0
export UseSharedCompilation=false
export MSBUILDDISABLENODEREUSE=1
DOTNET=$(DOTNET_DIR)/dotnet
DOTNET_BCL_DIR:=$(abspath $(TOP)/packages/microsoft.netcore.app.ref/$(DOTNET_BCL_VERSION)/ref/$(DOTNET_TFM))
# when bumping to a new .NET version, there may be a period when some parts of .NET is still on the old .NET version, so handle that here for DOTNET_BCL_DIR
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ world: check-system
@$(MAKE) reset-versions
@$(MAKE) all -j8
@$(MAKE) install -j8
@echo "Build is done, the following workloads were built:"
@$(DOTNET) workload list

.PHONY: check-system
check-system:
Expand Down Expand Up @@ -68,9 +70,6 @@ install-hook::
exit 1; \
fi

all-hook install-hook::
$(Q) $(MAKE) -C dotnet shutdown-build-server

dotnet-install-system:
$(Q) $(MAKE) -C dotnet install-system

Expand Down
20 changes: 0 additions & 20 deletions dotnet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -536,23 +536,3 @@ clean-local::
$(Q) $(DOTNET) restore package/workaround-for-maccore-issue-2427/restore.csproj /bl:package/workaround-for-maccore-issue-2427/restore.binlog $(MSBUILD_VERBOSITY)
$(Q) touch $@

# We need to shut down the builder server, because:
# We're using parallel make, and parallel make will start a jobserver, managed by file descriptors, where these file descriptors must be closed in all subprocesses for make to realize it's done.
# 'dotnet pack' might have started a build server
# The build server does not close any file descriptors it may have inherited when daemonizing itself.
# Thus the build server (which will still be alive after we're done building here) might have a file descriptor open which make is waiting for.
# The proper fix is to fix the build server to close its file descriptors.
# The intermediate working is to shut down the build server instead. An alternative solution would be to pass /p:UseSharedCompilation=false to 'dotnet pack' to disable the usage of the build server.
#
# The 'shutdown-build-server' is executed in a sub-make (and not as a dependency to the all-hook target),
# to make sure it's executed after everything else is built in this file.
all-hook::
$(Q) $(MAKE) shutdown-build-server

shutdown-build-server:
$(Q) echo "Shutting down build servers:"
$(Q) $(DOTNET) build-server shutdown | sed 's/^/ /' || true
$(Q) echo "Listing .NET processes still alive:"
$(Q) pgrep -lf "^$(DOTNET)" | sed 's/^/ /' || true
$(Q) echo "Killing the above mentioned processes."
$(Q) pkill -9 -f "^$(DOTNET)" | sed 's/^/ /' || true
Loading