From 9b5b752623131d891bf443e8ad8b5bbb7e6167b8 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Tue, 25 Jun 2024 12:03:12 -0700 Subject: [PATCH 1/2] Fix static-lib AOT Mono builds --- src/mono/mono/component/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/component/CMakeLists.txt b/src/mono/mono/component/CMakeLists.txt index 578ee25d3bd7e..d34c4b6dd1dd6 100644 --- a/src/mono/mono/component/CMakeLists.txt +++ b/src/mono/mono/component/CMakeLists.txt @@ -231,7 +231,9 @@ if (ENABLE_PERFTRACING AND "${MONO_DIAGNOSTICS_TRACING_COMPONENT_NAME}" IN_LIST list(APPEND mono-components-objects $ $) endif() if (TARGET mono-component-${MONO_DIAGNOSTICS_TRACING_COMPONENT_NAME}-static) - target_sources(mono-component-${MONO_DIAGNOSTICS_TRACING_COMPONENT_NAME}-static PRIVATE $ $) + # We don't add dn-containers here as any scenario that uses this target will also use the monosgen-static target, + # which will also have dn-containers linked into it. + target_sources(mono-component-${MONO_DIAGNOSTICS_TRACING_COMPONENT_NAME}-static PRIVATE $) endif() if (TARGET mono-component-${MONO_DIAGNOSTICS_TRACING_COMPONENT_NAME}) target_sources(mono-component-${MONO_DIAGNOSTICS_TRACING_COMPONENT_NAME} PRIVATE $ $) From 021b072ebbd2c132aeace03433374f768f5af763 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 1 Jul 2024 10:52:30 -0700 Subject: [PATCH 2/2] Only add component to mono-components-objects when diagnostics-tracing is being linked in --- src/mono/mono/component/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/component/CMakeLists.txt b/src/mono/mono/component/CMakeLists.txt index d34c4b6dd1dd6..575fbb52ad236 100644 --- a/src/mono/mono/component/CMakeLists.txt +++ b/src/mono/mono/component/CMakeLists.txt @@ -228,7 +228,11 @@ if (ENABLE_PERFTRACING AND "${MONO_DIAGNOSTICS_TRACING_COMPONENT_NAME}" IN_LIST # Link the diagnostics_tracing component to the EventPipe and DiagnosticServer libraries. if (TARGET ${MONO_DIAGNOSTICS_TRACING_COMPONENT_NAME}-objects) target_sources(${MONO_DIAGNOSTICS_TRACING_COMPONENT_NAME}-objects PRIVATE $ $) - list(APPEND mono-components-objects $ $) + # If we are going to link the diagnostics component via mono-components-objects, link in the supporting object libraries as well. + string(REPLACE + "$" + "$;$;$" + mono-components-objects "${mono-components-objects}") endif() if (TARGET mono-component-${MONO_DIAGNOSTICS_TRACING_COMPONENT_NAME}-static) # We don't add dn-containers here as any scenario that uses this target will also use the monosgen-static target,