jmmorato / openddsharp

OpenDDS wrapper for .NET languages
http://www.openddsharp.com
GNU Lesser General Public License v3.0
52 stars 12 forks source link

Linux support #109

Closed jorgefm closed 2 years ago

jorgefm commented 2 years ago

Hi, Is Linux supported in openddsharp? I have last OpenDDS running in Ubuntu18.04 and I would like to know if is it possible to communicate the HelloWorld test demo with your openddsharp_standard_helloworld project in some way... Thanks!

jmmorato commented 2 years ago

Hola Jorge,

I'm working on it, current beta version support Linux but it is just that, a beta version and requires Visual Studio for the compilation.

Soon I will release a new beta with better support (also OSX supported) and able to develop direclty without Visual Studio.

https://github.com/jmmorato/openddsharp/runs/5750252845?check_suite_focus=true

jorgefm commented 2 years ago

Hola Jose Manuel! I've been able to generate the openddsharp following the steps in your build_linux (x64,Release). Is it possible to generate your 'openddsharp_standard_helloworld' too? I would like to be able to test a c# demo in linux and finally be able to communicate the helloworld from OpenDDS with your helloworld in c#... do you think is it possible?? Thanks!

jmmorato commented 2 years ago

I've been able to generate the openddsharp following the steps in your build_linux (x64,Release). Is it possible to generate your 'openddsharp_standard_helloworld' too?

The current openddsharp_standard_helloworld application uses the published NuGet package, so you don't need to compile OpenDDSharp by yourself. But to be compiled/modified requires Windows OS (it only compile against WSL and Visual Studio) due the current version requirements.

I would like to be able to test a c# demo in linux and finally be able to communicate the helloworld from OpenDDS with your helloworld in c#... do you think is it possible?

It is possible... if both applications uses the same IDL type, I mean, I didn't base that example in the OpenDDS example, so for sure it will need code modifications in openddsharp_standard_helloworld to make it work. If you plan to modify the example in Linux you should wait for next beta release. I could prepare some NuGet packages for you after the next PR in develop

jorgefm commented 2 years ago

The current openddsharp_standard_helloworld application uses the published NuGet package, so you don't need to compile OpenDDSharp by yourself. But to be compiled/modified requires Windows OS (it only compile against WSL and Visual Studio) due the current version requirements.

Well, I think I've been able to compile OpenDDSharp. Once installed dotnet-sdk-3.1 and dotnet-sdk-5.0 packages and generate a OpenDDS v3.18.1 in openddsharp/ext/OpenDDS_Linux I've done the next steps without error:

dotnet run --project Build/OpenDDSharp.Build.Standard/OpenDDSharp.Build.Standard.csproj -- --target=BuildOpenDDSharpNativeTask --exclusive --BuildConfiguration=Release --BuildPlatform=x64 --OpenDdsVersion=3.18.1 --IgnoreThirdPartySetup=True --IgnoreThirdPartyBuild=True

dotnet restore OpenDDSharp.Standard.sln --no-cache --configfile nuget.config dotnet restore Examples/ConsoleDemoCore/ConsoleDemoCore.csproj --no-cache --configfile nuget.config dotnet restore Tests/TestSupportProcessCore/TestSupportProcessCore.csproj --no-cache --configfile nuget.config dotnet restore Tests/OpenDDSharp.Standard.UnitTest/OpenDDSharp.Standard.UnitTest.csproj --no-cache --configfile nuget.config

dotnet msbuild -target:build Sources/OpenDDSharp.BuildTasks/OpenDDSharp.BuildTasks.csproj -property:Configuration=Release dotnet msbuild -target:build OpenDDSharp.Standard.sln -property:Configuration=Release -property:Platform=x64

dotnet test Tests/OpenDDSharp.Standard.UnitTest/OpenDDSharp.Standard.UnitTest.csproj --no-build --no-restore -v n -property:Configuration=Release -property:Platform=x64

Then I've try to do the same with openddsharp_standard_helloworld without luck:

$ cd openddsharp_standard_helloworld/TestMessage $ dotnet build TestMessage.csproj -r linux-x64 Copyright (C) Microsoft Corporation. All rights reserved.

Determining projects to restore...

Restored /home/jorge/develop/OpenDDSharp/openddsharp_standard_helloworld/TestMessage/TestMessage.csproj (in 9.13 min). Add Visual C++ to the PATH... /home/jorge/.nuget/packages/openddsharp.standard.idlgenerator/0.8.21289.1-beta/build/OpenDDSharp.Standard.IdlGenerator.targets(59,5): error : vswhere.exe not found: Visual Studio required version >= 15.2 [/home/jorge/develop/OpenDDSharp/openddsharp_standard_helloworld/TestMessage/TestMessage.csproj]

Build FAILED.

/home/jorge/.nuget/packages/openddsharp.standard.idlgenerator/0.8.21289.1-beta/build/OpenDDSharp.Standard.IdlGenerator.targets(59,5): error : vswhere.exe not found: Visual Studio required version >= 15.2 [/home/jorge/develop/OpenDDSharp/openddsharp_standard_helloworld/TestMessage/TestMessage.csproj] 0 Warning(s) 1 Error(s)

Time Elapsed 00:09:08.72

I suppose that's the warning you were talking about.

It is possible... if both applications uses the same IDL type, I mean, I didn't base that example in the OpenDDS example, so for sure it will need code modifications in openddsharp_standard_helloworld to make it work. If you plan to modify the example in Linux you should wait for next beta release. I could prepare some NuGet packages for you after the next PR in develop

Well, I'll be waiting for a working linux example. Changing the IDL from OpenDDS I think it will be easy

Thanks!

jmmorato commented 2 years ago

Hi again,

You can try with the last pre-release version following the new Getting Started article

jorgefm commented 2 years ago

Hi, I've been able to generate a HelloWorldPublisher and HelloWorldSubscriber following the instructions from the Getting Started and your openddsharp_standard_helloworld project. To run both apps I've to set LD_LIBRARY_PATH to HelloWorld[Publisher|Subscriber]/bin/Debug/net6.0/runtimes/linux-x64/native

I've enabled the logging options -DCPSDebugLevel 10 -ORBDebugLevel 10 and I get:

$ ./HelloWorldSubscriber (5741|5741) INFO: set_DCPS_debug_level: set to 10 (5741|5741) NOTICE: Service_Participant::get_domain_participant_factory Going to load configuration from (5741|5741) NOTICE: using DCPSDebugLevel value from command option (overrides value if it's in config file) (5741|5741) NOTICE: Service_Participant::load_domain_ranges(): config does not have a [DomainRange] section. (5741|5741) NOTICE: TransportRegistry::load_transport_templates(): config does not have a [transport_template] section.

$ ./HelloWorldPublisher (5748|5748) INFO: set_DCPS_debug_level: set to 10 (5748|5748) NOTICE: Service_Participant::get_domain_participant_factory Going to load configuration from (5748|5748) NOTICE: using DCPSDebugLevel value from command option (overrides value if it's in config file) (5748|5748) NOTICE: Service_Participant::load_domain_ranges(): config does not have a [DomainRange] section. (5748|5748) NOTICE: TransportRegistry::load_transport_templates(): config does not have a [transport_template] section.

Both remains waiting forever for something...

In a working OpenDDS demo with the same traces enabled I get (5290|5290) INFO: set_DCPS_debug_level: set to 10 (5290|5290) NOTICE: Service_Participant::get_domain_participant_factory Going to load configuration from <../rtps.ini> (5290|5290) NOTICE: using DCPSDebugLevel value from command option (overrides value if it's in config file) (5290|5290) NOTICE: Service_Participant::load_domain_ranges(): config does not have a [DomainRange] section. (5290|5290) NOTICE: TransportRegistry::load_transport_templates(): config does not have a [transport_template] section. (5290|5290) NOTICE: Service_Participant::load_domain_configuration(): failed to open [domain] section - using code default. (5290|5290) NOTICE: StaticDiscovery::parse_topics no [topic] sections. (5290|5290) NOTICE: StaticDiscovery::parse_datawriterqos no [datawriterqos] sections. (5290|5290) NOTICE: StaticDiscovery::parse_datareaderqos no [datareaderqos] sections. (5290|5290) NOTICE: StaticDiscovery::parse_publisherqos no [publisherqos] sections. (5290|5290) NOTICE: StaticDiscovery::parse_subscriberqos no [subscriberqos] sections. (5290|5290) NOTICE: StaticDiscovery::parse_endpoints no [endpoint] sections. ...

Any hint?

jmmorato commented 2 years ago

Ok, I found it.

Looks that the libOpenDDS_Rtps_Udp.so is not copied correctly in the NuGet package and only is present the libOpenDDS_Rtps_Udp.so.3.20.0. If you just copy paste it and rename it should work.

BTW, it is better to use dotnet build HelloWorldPublisher.csproj --runtime linux-x64 --no-self-contained to build the application, like that all files will be placed in the same folder. I will update the the tutorial later. You should modify your LD_LIBRARY_PATH to point to the new location too.

jorgefm commented 2 years ago

Yes! Now it works :) I've take note about the parameters to generate the projects to take a look. Thanks!

jorgefm commented 2 years ago

Hi again! I've been testing it again. I thought wrongly that it was working fooled by all the tracing messages... Running the helloworld again without -DCPSDebugLevel 10 and -ORBDebugLevel 10 parameters I get that works ok when I run first the publisher then the subscriber, but the subscriber doesn't receive anything if I run first then the publisher. The publisher sends the message and exit ok in both situations. Maybe there is a method in the MessageDataReader to update the StatusChanges in this code?

        MessageDataReader messageReader = new(reader);

        Console.WriteLine("Wait for message...");
        while (true)
        {
            StatusMask mask = messageReader.StatusChanges;
            if ((mask & StatusKind.DataAvailableStatus) != 0)
            {
jorgefm commented 2 years ago

Setting publisher/subscriber QOS to ReliabilityQosPolicyKind.ReliableReliabilityQos seems to solve the issue...

jmmorato commented 2 years ago

Yes, that could happens with the current BestEffortReliability configuration and the good solution is what you applied. I will added to the Getting Started code to ensure always the reception.

I'm closing this ticket but feels free to open new Issues or Discussions about the subject.