.NET Core 2.1 / GDI+ / Linux
Does FastReport.NET support .NET Core 2.1 that can be run on non-Windows operation systems (Ubuntu 16.04, CentOS 7, etc.)?
I tried to use FastReport.NET on CentOS Server using .NET Core in console application that just generate simple pdf file, see code below:
But got exception with GDI+:
Package libgdiplus-2.10-9.el7.x86_64 has been installed from repository using command:
.NET Core 2.1 Runtime was installed like it was described here
Also LD_DEBUG=libs showed me this:
What can be wrong with my environment?
I tried to use FastReport.NET on CentOS Server using .NET Core in console application that just generate simple pdf file, see code below:
var r = new FastReport.Report();
r.Load("report.frx");
r.RegisterData(items, "data");
r.Prepare();
r.Export(new FastReport.Export.Pdf.PDFExport(), "report.pdf");
But got exception with GDI+:
System.TypeInitializationException: The type initializer for 'FastReport.Report' threw an exception.
---> System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'gdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libgdiplus: cannot open shared object file: No such file or directory
  at System.Drawing.GDIPlus.GdiplusStartup(UInt64& token, GdiplusStartupInput& input, GdiplusStartupOutput& output)
  at System.Drawing.GDIPlus..cctor()
  --- End of inner exception stack trace ---
  at System.Drawing.GDIPlus.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, PixelFormat format, IntPtr scan0, IntPtr& bmp)
  at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
  at FastReport.Utils.Config.Init()
  at FastReport.Report..cctor()
  --- End of inner exception stack trace ---
  at FastReport.Report..ctor()
  at FastReportConsole.Program.Main(String[] args) in D:\MY\DevExpressCoreReport\FastReportConsole\Program.cs:line 12
Package libgdiplus-2.10-9.el7.x86_64 has been installed from repository using command:
sudo yum install libgdiplus
.NET Core 2.1 Runtime was installed like it was described here
Also LD_DEBUG=libs showed me this:
1217:Â Â Â Â find library=libdl.so.2 [0]; searching
      1217:      search path=/mnt/a/netcoredeps/tls/x86_64:/mnt/a/netcoredeps/tls:/mnt/a/netcoredeps/x86_64:/mnt/a/netcoredeps        (RPATH from file /mnt/a/FastReportConsole)
      1217:      trying file=/mnt/a/netcoredeps/tls/x86_64/libdl.so.2
      1217:      trying file=/mnt/a/netcoredeps/tls/libdl.so.2
      1217:      trying file=/mnt/a/netcoredeps/x86_64/libdl.so.2
      1217:      trying file=/mnt/a/netcoredeps/libdl.so.2
      1217:      search cache=/etc/ld.so.cache
      1217:      trying file=/lib64/libdl.so.2
      1217:
      1217:    find library=libpthread.so.0 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      trying file=/lib64/libpthread.so.0
      1217:
      1217:    find library=libstdc++.so.6 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      trying file=/lib64/libstdc++.so.6
      1217:
      1217:    find library=libm.so.6 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      trying file=/lib64/libm.so.6
      1217:
      1217:    find library=libgcc_s.so.1 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      trying file=/lib64/libgcc_s.so.1
      1217:
      1217:    find library=libc.so.6 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      trying file=/lib64/libc.so.6
      1217:
      1217:    calling init: /lib64/libpthread.so.0
      1217:    calling init: /lib64/libc.so.6
      1217:    calling init: /lib64/libgcc_s.so.1
      1217:    calling init: /lib64/libm.so.6
      1217:    calling init: /lib64/libstdc++.so.6
      1217:    calling init: /lib64/libdl.so.2
      1217:
      1217:    initialize program: /mnt/a/FastReportConsole
      1217:
      1217:    transferring control: /mnt/a/FastReportConsole
      1217:
      1217:    calling init: /mnt/a/libhostfxr.so
      1217:
      1217:    calling init: /mnt/a/libhostpolicy.so
      1217:
      1217:    find library=librt.so.1 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      trying file=/lib64/librt.so.1
      1217:
      1217:    calling init: /lib64/librt.so.1
      1217:
      1217:    calling init: /mnt/a/libcoreclr.so
      1217:
      1217:    find library=liblttng-ust.so.0 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls/x86_64:/lib64/tls:/lib64/x86_64:/lib64:/usr/lib64/tls/x86_64:/usr/lib64/tls:/usr/lib64/x86_64:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/x86_64/liblttng-ust.so.0
      1217:      trying file=/lib64/tls/liblttng-ust.so.0
      1217:      trying file=/lib64/x86_64/liblttng-ust.so.0
      1217:      trying file=/lib64/liblttng-ust.so.0
      1217:      trying file=/usr/lib64/tls/x86_64/liblttng-ust.so.0
      1217:      trying file=/usr/lib64/tls/liblttng-ust.so.0
      1217:      trying file=/usr/lib64/x86_64/liblttng-ust.so.0
      1217:      trying file=/usr/lib64/liblttng-ust.so.0
      1217:
      1217:    find library=liblttng-ust-tracepoint.so.0 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls:/lib64:/usr/lib64/tls:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/liblttng-ust-tracepoint.so.0
      1217:      trying file=/lib64/liblttng-ust-tracepoint.so.0
      1217:      trying file=/usr/lib64/tls/liblttng-ust-tracepoint.so.0
      1217:      trying file=/usr/lib64/liblttng-ust-tracepoint.so.0
      1217:
      1217:    find library=liblttng-ust-tracepoint.so.0 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls:/lib64:/usr/lib64/tls:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/liblttng-ust-tracepoint.so.0
      1217:      trying file=/lib64/liblttng-ust-tracepoint.so.0
      1217:      trying file=/usr/lib64/tls/liblttng-ust-tracepoint.so.0
      1217:      trying file=/usr/lib64/liblttng-ust-tracepoint.so.0
      1217:
      1217:    /mnt/a/libcoreclr.so: error: symbol lookup error: undefined symbol: PAL_GetNumaHighestNodeNumber (fatal)
      1217:    /mnt/a/libcoreclr.so: error: symbol lookup error: undefined symbol: GetNumaHighestNodeNumber (fatal)
      1217:
      1217:    calling init: /mnt/a/libclrjit.so
      1217:
      1217:    /mnt/a/libcoreclr.so: error: symbol lookup error: undefined symbol: PAL_GetEnvironmentVariable (fatal)
      1217:    /mnt/a/libcoreclr.so: error: symbol lookup error: undefined symbol: GetEnvironmentVariable (fatal)
      1217:    /mnt/a/libcoreclr.so: error: symbol lookup error: undefined symbol: PAL_GetEnvironmentVariableW (fatal)
      1217:
      1217:    calling init: /mnt/a/System.Globalization.Native.so
      1217:
      1217:    /mnt/a/System.Globalization.Native.so: error: symbol lookup error: undefined symbol: DllMain (fatal)
      1217:    find library=libicuuc.so.50 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      trying file=/lib64/libicuuc.so.50
      1217:
      1217:    find library=libicudata.so.50 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      trying file=/lib64/libicudata.so.50
      1217:
      1217:    calling init: /lib64/libicudata.so.50
      1217:
      1217:    calling init: /lib64/libicuuc.so.50
      1217:
      1217:    /lib64/libicuuc.so.50: error: symbol lookup error: undefined symbol: u_strlen (fatal)
      1217:    find library=libicui18n.so.50 [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      trying file=/lib64/libicui18n.so.50
      1217:
      1217:    calling init: /lib64/libicui18n.so.50
      1217:
      1217:    /mnt/a/System.Globalization.Native.so: error: symbol lookup error: undefined symbol: GlobalizationNative_GetSortHandleW (fatal)
      1217:    /mnt/a/System.Globalization.Native.so: error: symbol lookup error: undefined symbol: GlobalizationNative_CompareStringW (fatal)
      1217:
      1217:    calling init: /mnt/a/System.Native.so
      1217:
      1217:    /mnt/a/System.Native.so: error: symbol lookup error: undefined symbol: DllMain (fatal)
      1217:    /mnt/a/System.Globalization.Native.so: error: symbol lookup error: undefined symbol: GlobalizationNative_GetDefaultLocaleNameW (fatal)
      1217:    /mnt/a/System.Globalization.Native.so: error: symbol lookup error: undefined symbol: GlobalizationNative_GetLocaleNameW (fatal)
      1217:    /mnt/a/System.Globalization.Native.so: error: symbol lookup error: undefined symbol: GlobalizationNative_GetLocaleInfoStringW (fatal)
Start
      1217:    /mnt/a/libcoreclr.so: error: symbol lookup error: undefined symbol: PAL_lstrlenA (fatal)
      1217:    /mnt/a/libcoreclr.so: error: symbol lookup error: undefined symbol: PAL_CoTaskMemFree (fatal)
      1217:    /mnt/a/libcoreclr.so: error: symbol lookup error: undefined symbol: PAL_LocalAlloc (fatal)
      1217:    find library=libc.so [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls:/lib64:/usr/lib64/tls:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/libc.so
      1217:      trying file=/lib64/libc.so
      1217:    find library=liblibc.so [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls:/lib64:/usr/lib64/tls:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/liblibc.so
      1217:      trying file=/lib64/liblibc.so
      1217:      trying file=/usr/lib64/tls/liblibc.so
      1217:      trying file=/usr/lib64/liblibc.so
      1217:
      1217:    /lib64/libc.so.6: error: symbol lookup error: undefined symbol: DllMain (fatal)
      1217:    /mnt/a/libcoreclr.so: error: symbol lookup error: undefined symbol: PAL_LocalFree (fatal)
      1217:    find library=gdiplus.so [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls:/lib64:/usr/lib64/tls:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/gdiplus.so
      1217:      trying file=/lib64/gdiplus.so
      1217:      trying file=/usr/lib64/tls/gdiplus.so
      1217:      trying file=/usr/lib64/gdiplus.so
      1217:
      1217:    find library=libgdiplus.so [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls:/lib64:/usr/lib64/tls:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/libgdiplus.so
      1217:      trying file=/lib64/libgdiplus.so
      1217:      trying file=/usr/lib64/tls/libgdiplus.so
      1217:      trying file=/usr/lib64/libgdiplus.so
      1217:
      1217:    find library=gdiplus [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls:/lib64:/usr/lib64/tls:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/gdiplus
      1217:      trying file=/lib64/gdiplus
      1217:      trying file=/usr/lib64/tls/gdiplus
      1217:      trying file=/usr/lib64/gdiplus
      1217:
      1217:    find library=libgdiplus [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls:/lib64:/usr/lib64/tls:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/libgdiplus
      1217:      trying file=/lib64/libgdiplus
      1217:      trying file=/usr/lib64/tls/libgdiplus
      1217:      trying file=/usr/lib64/libgdiplus
      1217:
Unhandled Exception:Â Â Â Â Â Â 1217:Â Â Â Â Â Â Â Â find library=Microsoft.DiaSymReader.Native.amd64.dll [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls:/lib64:/usr/lib64/tls:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/Microsoft.DiaSymReader.Native.amd64.dll
      1217:      trying file=/lib64/Microsoft.DiaSymReader.Native.amd64.dll
      1217:      trying file=/usr/lib64/tls/Microsoft.DiaSymReader.Native.amd64.dll
      1217:      trying file=/usr/lib64/Microsoft.DiaSymReader.Native.amd64.dll
      1217:
      1217:    /mnt/a/libcoreclr.so: error: symbol lookup error: undefined symbol: PAL_WideCharToMultiByte (fatal)
      1217:    find library=Microsoft.DiaSymReader.Native.amd64.dll [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls:/lib64:/usr/lib64/tls:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/Microsoft.DiaSymReader.Native.amd64.dll
      1217:      trying file=/lib64/Microsoft.DiaSymReader.Native.amd64.dll
      1217:      trying file=/usr/lib64/tls/Microsoft.DiaSymReader.Native.amd64.dll
      1217:      trying file=/usr/lib64/Microsoft.DiaSymReader.Native.amd64.dll
      1217:
      1217:    find library=Microsoft.DiaSymReader.Native.amd64.dll [0]; searching
      1217:      search cache=/etc/ld.so.cache
      1217:      search path=/lib64/tls:/lib64:/usr/lib64/tls:/usr/lib64                (system search path)
      1217:      trying file=/lib64/tls/Microsoft.DiaSymReader.Native.amd64.dll
      1217:      trying file=/lib64/Microsoft.DiaSymReader.Native.amd64.dll
      1217:      trying file=/usr/lib64/tls/Microsoft.DiaSymReader.Native.amd64.dll
      1217:      trying file=/usr/lib64/Microsoft.DiaSymReader.Native.amd64.dll
      1217:
The same app for Windows works perfectly.What can be wrong with my environment?
Comments
google : corecompat.system.drawing centos
Installing the Mono packages for libgdiplus solved my issue.