Skip to content

Commit 3024212

Browse files
committed
Force portable OpenSSL when NativeAOT.
1 parent 0bd9415 commit 3024212

File tree

10 files changed

+16
-6
lines changed

10 files changed

+16
-6
lines changed

Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@
311311
'$(OfficialBuildId)' == ''">true</DisableSourceLink>
312312
<!-- Runtime doesn't support Arcade-driven target framework filtering. -->
313313
<NoTargetFrameworkFiltering>true</NoTargetFrameworkFiltering>
314+
<!-- NativeAOT doesn't use the linker flags required for linking with non-portable OpenSSL builds. -->
315+
<PortableSsl Condition="'$(NativeAotSupported)' == 'true'">true</PortableSsl>
314316
</PropertyGroup>
315317

316318
<!-- RepositoryEngineeringDir isn't set when Installer tests import this file. -->

eng/SourceBuild.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<InnerBuildArgs>$(InnerBuildArgs) --nodereuse false</InnerBuildArgs>
3838
<InnerBuildArgs>$(InnerBuildArgs) --warnAsError false</InnerBuildArgs>
3939
<InnerBuildArgs>$(InnerBuildArgs) --outputrid $(TargetRid)</InnerBuildArgs>
40+
<InnerBuildArgs Condition="'$(NativeAotSupported)' != ''">$(InnerBuildArgs) /p:NativeAotSupported=$(NativeAotSupported)</InnerBuildArgs>
4041
<!-- PackageOS and ToolsOS control the rids of prebuilts consumed by the build.
4142
They are set to RuntimeOS so they match with the build SDK rid. -->
4243
<InnerBuildArgs Condition="'$(RuntimeOS)' != ''">$(InnerBuildArgs) /p:PackageOS=$(RuntimeOS) /p:ToolsOS=$(RuntimeOS)</InnerBuildArgs>

eng/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ usage()
8181
echo " --gcc Optional argument to build using gcc in PATH (default)."
8282
echo " --gccx.y Optional argument to build using gcc version x.y."
8383
echo " --portablebuild Optional argument: set to false to force a non-portable build."
84+
echo " --portablessl Optional argument: set to true to force a portable OpenSSL build."
8485
echo " --keepnativesymbols Optional argument: set to true to keep native symbols/debuginfo in generated binaries."
8586
echo " --ninja Optional argument: set to true to use Ninja instead of Make to run the native build."
8687
echo " --pgoinstrument Optional argument: build PGO-instrumented runtime"

eng/native/build-commons.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ while :; do
411411
__PortableBuild=0
412412
;;
413413

414+
portablessl=true|-portablebuild=true)
415+
__PortableSsl=1
416+
;;
417+
414418
release|-release)
415419
__BuildType=Release
416420
;;
@@ -511,6 +515,8 @@ if [[ "$__PortableBuild" == 0 ]]; then
511515
__CommonMSBuildArgs="$__CommonMSBuildArgs /p:PortableBuild=false"
512516
fi
513517

518+
__PortableSsl="${__PortableSsl:-$__PortableBuild}"
519+
514520
if [[ "$__TargetArch" == wasm ]]; then
515521
# nothing to do here
516522
true
@@ -524,7 +530,7 @@ elif [[ "$__TargetOS" == android ]]; then
524530
# nothing to do here
525531
true
526532
else
527-
__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs"
533+
__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableSsl $__CMakeArgs"
528534
fi
529535

530536
# Configure environment if we are doing a cross compile.

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ The .NET Foundation licenses this file to you under the MIT license.
136136
<LinkerArg Include="-static-pie" Condition="'$(StaticExecutable)' == 'true' and '$(PositionIndependentExecutable)' != 'false'" />
137137
<LinkerArg Include="-dynamiclib" Condition="'$(_IsApplePlatform)' == 'true' and '$(NativeLib)' == 'Shared'" />
138138
<LinkerArg Include="-shared" Condition="'$(_IsApplePlatform)' != 'true' and '$(NativeLib)' == 'Shared'" />
139-
<!-- source-build links directly with openssl (-lssl -lcrypto) -->
140-
<LinkerArg Include="-lssl" Condition="'$(_targetOS)' == 'linux'" />
141-
<LinkerArg Include="-lcrypto" Condition="'$(_targetOS)' == 'linux'" />
142139
<!-- binskim warning BA3001 PIE disabled on executable -->
143140
<LinkerArg Include="-pie -Wl,-pie" Condition="'$(_IsApplePlatform)' != 'true' and '$(NativeLib)' == '' and '$(StaticExecutable)' != 'true' and '$(PositionIndependentExecutable)' != 'false'" />
144141
<LinkerArg Include="-Wl,-no-pie" Condition="'$(_IsApplePlatform)' != 'true' and '$(NativeLib)' == '' and '$(StaticExecutable)' != 'true' and '$(PositionIndependentExecutable)' == 'false'" />

src/coreclr/runtime.proj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<_CoreClrBuildArg Condition="'$(ContinuousIntegrationBuild)' == 'true'" Include="-ci" />
3131
<_CoreClrBuildArg Condition="'$(CrossBuild)' == 'true'" Include="-cross" />
3232
<_CoreClrBuildArg Condition="'$(PortableBuild)' != 'true'" Include="-portablebuild=false" />
33+
<_CoreClrBuildArg Condition="'$(PortableSsl)' == 'true'" Include="-portablessl=true" />
3334
<_CoreClrBuildArg Condition="'$(KeepNativeSymbols)' != 'false'" Include="-keepnativesymbols" />
3435
<_CoreClrBuildArg Include="-os $(_BuildNativeTargetOS)" />
3536

src/native/corehost/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export __BinDir __IntermediatesDir __RuntimeFlavor
8282
__CMakeArgs="-DCLI_CMAKE_HOST_VER=\"$__host_ver\" -DCLI_CMAKE_COMMON_HOST_VER=\"$__apphost_ver\" -DCLI_CMAKE_HOST_FXR_VER=\"$__fxr_ver\" $__CMakeArgs"
8383
__CMakeArgs="-DCLI_CMAKE_HOST_POLICY_VER=\"$__policy_ver\" -DCLI_CMAKE_PKG_RID=\"$__OutputRid\" -DCLI_CMAKE_FALLBACK_OS=\"$__HostFallbackOS\" -DCLI_CMAKE_COMMIT_HASH=\"$__commit_hash\" $__CMakeArgs"
8484
__CMakeArgs="-DRUNTIME_FLAVOR=\"$__RuntimeFlavor\" $__CMakeArgs"
85-
__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs"
85+
__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableSsl $__CMakeArgs"
8686

8787
# Specify path to be set for CMAKE_INSTALL_PREFIX.
8888
# This is where all built CoreClr libraries will copied to.

src/native/corehost/corehost.proj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
<BuildArgs>$(BuildArgs) -cmakeargs "-DVERSION_FILE_PATH=$(NativeVersionFile)"</BuildArgs>
7676
<BuildArgs Condition="'$(ConfigureOnly)' == 'true'">$(BuildArgs) -configureonly</BuildArgs>
7777
<BuildArgs Condition="'$(PortableBuild)' != 'true'">$(BuildArgs) -portablebuild=false</BuildArgs>
78+
<BuildArgs Condition="'$(PortableSsl)' == 'true'">$(BuildArgs) -portablessl=true</BuildArgs>
7879
<BuildArgs Condition="'$(KeepNativeSymbols)' != 'false'">$(BuildArgs) -keepnativesymbols</BuildArgs>
7980
<BuildArgs Condition="'$(CrossBuild)' == 'true'">$(BuildArgs) -cross</BuildArgs>
8081
<BuildArgs Condition="'$(Compiler)' != ''">$(BuildArgs) $(Compiler)</BuildArgs>

src/native/libs/build-native.proj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
-->
4242
<_ProcessorCountArg> -numproc $(MSBuildNodeCount)</_ProcessorCountArg>
4343
<_PortableBuildArg Condition="'$(PortableBuild)' != 'true'"> -portablebuild=false</_PortableBuildArg>
44+
<_PortableBuildArg Condition="'$(PortableSsl)' == 'true'"> -portablessl=true</_PortableBuildArg>
4445
<_CrossBuildArg Condition="'$(CrossBuild)' == 'true'"> -cross</_CrossBuildArg>
4546
<_KeepNativeSymbolsBuildArg Condition="'$(KeepNativeSymbols)' != 'false'"> -keepnativesymbols</_KeepNativeSymbolsBuildArg>
4647
<_CMakeArgs Condition="'$(CMakeArgs)' != ''"> -cmakeargs "$(CMakeArgs)"</_CMakeArgs>

src/native/libs/build-native.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ elif [[ "$__TargetOS" == android && -z "$ROOTFS_DIR" ]]; then
8787
# nothing to do here
8888
true
8989
else
90-
__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs"
90+
__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableSsl $__CMakeArgs"
9191
__CMakeArgs="-DCMAKE_STATIC_LIB_LINK=$__StaticLibLink $__CMakeArgs"
9292

9393
if [[ "$__TargetOS" != linux-bionic && "$__TargetArch" != x86 && "$__TargetArch" != x64 && "$__TargetArch" != "$__HostArch" ]]; then

0 commit comments

Comments
 (0)