Closed rhy-ama closed 4 years ago
It will. See the next comment:
https://github.com/fslaborg/Deedle/issues/477#issuecomment-510518924
Thanks.
Is Deedle + FSharp.Core supported under Xamarin Forms / Xamarin iOS ?
The following code does not compile and hangs Xamarin build process (equivalent code compiles without Deedle + DSharpe.Core)
var series = new SeriesBuilder<DateTime, float>();
SimulationRun(1.1500f, 0.0005f, new DateTime(2001, 1, 1, 0, 0, 0), 800)
.Subscribe(v =>
{
series.Add(v.Item2, v.Item1);
});
var LineData = new ObservableCollection<TimeSeries>(
series.ToObservable()
.Select(i => new TimeSeries() { t = i.Key, x = i.Value })
.ToEnumerable());
// bind LineData to GUI
code used for the simulation
public class SimulationState
{
public int step;
public float y;
public DateTime z;
}
public class TimeSeries
{
public float x { get; set; }
public DateTime t { get; set; }
}
protected static double GetRandomNumber(Random RNG, double minimum, double maximum)
{
if (RNG == null)
throw new ArgumentNullException(nameof(RNG));
return RNG.NextDouble() * (maximum - minimum) + minimum;
}
public static IObservable<Tuple<float, DateTime>> SimulationRun(float startX, float xStd, DateTime startT, int count)
{
var maxCount = count;
var simState = new SimulationState() { step = 0, y = startX, z = startT };
var RNG = new System.Random(DateTime.UtcNow.Millisecond);
return Observable.Generate(
simState,
v => v.step < count,
state =>
{
float yt = (float) ( state.y * Math.Exp((0 - 0.5f * xStd * xStd) + xStd * Math.Sqrt(1) * Normal.InvCDF(0, 1, GetRandomNumber(RNG, 0.0f, 1.0f))) );
TimeSpan dt = new TimeSpan(0, 0, 0, (int)GetRandomNumber(RNG, 1.0f, 50.0f), 0);
DateTime zt = state.z.Add(dt);
return new SimulationState() { step = state.step + 1, y = yt, z = zt };
},
state => new Tuple<float, DateTime>(state.y, state.z)
);
}
this non-Deedle implementation compiles on Xamarin.iOS project of Xamarin Forms solution without issues:
//non-Deedle implementation
var LineData = new ObservableCollection<TimeSeries>();
SimulationRun(1.1500f, 0.0005f, new DateTime(2001, 1, 1, 0, 0, 0), 800)
.Subscribe(v =>
{
LineData.Add(new TimeSeries() { t = v.Item2, x = v.Item1 });
});
Is Deedle + FSharp.Core supported under Xamarin Forms / Xamarin iOS ?
With or without enabled AOT?
https://docs.microsoft.com/en-us/xamarin/ios/internals/architecture
full AOT is always used by Xamarin as indicated when hanging "Compiling to native"
Thanks. That's interesting.
Anyway I suggest you to create MCVE and open an issue in xamarin-macios or some other xamarin repo (not sure where to create it better). Please let me know If you will go this way.
Thank you I will.
Time to change Deedle marketing from C# library to F#?
Half the doc is obsolete or non-existant for C# and the rest, including the code, is F#. And as you can see from this experience, Deedle portability suffers and does not follow C#.
Just to be clear, the linking fails on Deedle (after ~2h compile attempt):
2>"C:\LocalProjects\DependencyTest\DependencyTest\DependencyTest.iOS\DependencyTest.iOS.csproj" (Build;BuiltProjectOutputGroup;BuiltProjectOutputGroupDependencies;DebugSymbolsProjectOutputGroup;DebugSymbolsProjectOutputGroupDependencies;DocumentationProjectOutputGroup;DocumentationProjectOutputGroupDependencies;SatelliteDllsProjectOutputGroup;SatelliteDllsProjectOutputGroupDependencies;SGenFilesOutputGroup;SGenFilesOutputGroupDependencies target) (1) ->
2>(_CompileToNative target) ->
2> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): error : unable to execute command: Bus error: 10
2> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): error : linker command failed due to signal (use -v to see invocation)
2> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(842,3): error MT5216: Native linking failed for '/Users/rhy-dev-mac02/Library/Caches/Xamarin/mtbs/builds/DependencyTest.iOS/2d331c79b5bace84fe40841da56374e9/obj/iPhone/Debug/device-builds/iphone7.2-12.4.3/mtouch-cache/arm64/libDeedle.dll.dylib'. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
I will post verbose output when available.
@rhy-ama I am wrapping up some initial work on Deedle.Math
. Will definitely include FSharp.Core
in the dependency in the new release.
Unfortunately I do not have experience in Xamarin. Cannot tell much what is going on there.
As for C# usage, Deedle was developed in F#. Not all functions are properly exposed to C#. I do plan to make some efforts to align more functionalities in C# and update docs. I am also thinking about creating cheat sheets similar to RStudio's tidyverse.
But these efforts take time. Please send issue or pull requests if you feel like helping around. Thanks!
@FoggyFinder , @zyzhu - thank you very much for your kind and prompt replies.
I known that fsharp / fsharp.core could be used in Xamarin projects since a long time. I am aware there were some issues and never had really looked into it. Looking at how hard fsharp guys had worked, fsharp.core is fully netstandard 2.0 compatible and should be supported by Xamarin (maybe with a dependency to Math.net numerics - not sure if it has collisions with Deedle.Math).
The issue, from the looks of it, is the use of non-obvious reflection techniques within Deedle, so that the Xamarin linker can not link correctly (link-out non-used code). May I suggest you check similar projects to understand the issue, for example here (EntityFrameworkCore).
Apple has restrictions on what type of dynamic linking is allowed within store apps and the individual file sizes. Xamarin describes this here (Linking Xamarin.iOS Apps) and here (Xamarin-Linker configuration).
I will submit the issue to xamarin-macio - they might circle it back to you.
Updated: xamarin submission is here
@rhy-ama I've just released Deedle 2.1.0 that has FSharp.Core dependency. Give it a shot to see whether that causes the problem.
Close this as discussions are moved to mono repo https://github.com/mono/mono/issues/17709
It would be nice if the nugget listed ALL relevant dependencies.