Portable NET Core on Linux Jan Vorlicek Microsoft
Portable. NET Core on Linux Jan Vorlicek Microsoft
. NET Core on different Linux distros • Core. CLR / Core. FX use several native platform libraries (standard C/C++ libraries, CURL, ICU, SSL, …) • Managed code calls to those via thin PAL layer • Their SO names and supported APIs can differ per Linux distro or even distro versions • Native parts of Core. CLR / Core. FX built on one distro don‘t necessarily work on others • Targeting Linux if. NET Core native components are built as distro dependent complicates building. NET Core apps
Making. NET Core on Linux portable • Fixing issues with standard C/C++ libraries - build native components on the oldest supported distro. • Fixing issues with ICU / SSL / CURL • Shims to load the 3 rd party libraries and resolve their symbols. • ICU – handle different SO name for each ICU version (libicuuc. so. 52. 1, libicuuc. so. 53. 1, …). On most distros, the symbol names contain version number too (u_strlen_52, u_strlen_52_1). • SSL – handle different SO name on Fedora based distros (libssl. so. 10) and different one on the others (libssl. so. 1. 0. 0). Debian 9 started to use libssl. so. 1. 0. 2. • SSL - optional usage of some elliptic curves cryptography functions. • CURL – dynamic detection and optional handling of HTTP 2. 0 request multiplexing.
Enabling standalone portable. NET Core apps • Using the RPATH in the host executable (apphost) • Set to $ORIGIN/netcoredeps • Developers can create that subfolder next to the main executable and store copies all native dependencies they want in there • Linux loader looks into this folder when loading dependencies before looking into standard locations • It works transitively (for dependencies of these dependencies etc. )
- Slides: 4