fbarresi / SoftPlc

Software plc with docker support
MIT License
109 stars 28 forks source link

Cant run on Macbook M1 Pro #4

Open birliks opened 7 months ago

birliks commented 7 months ago

Hello fbarresi,

when i try to run SoftPlc on Macbook Pro M1, i am getting below error. i have already move files from native folder to net6.0 folder. if you have any suggestion it would be great.

PS /Users/xxxxx/VisualStudioProjects/_Custom/SoftPlc/SoftPlc> dotnet run bin\Debug\net6.0\SoftPlc.dll --plcPort=102 --urls="http://localhost:8080/" Initializing plc service... Unhandled exception. System.DllNotFoundException: Unable to load shared library 'snap7' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libsnap7, 0x0001): tried: 'libsnap7' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibsnap7' (no such file), '/usr/lib/libsnap7' (no such file, not in dyld cache), 'libsnap7' (no such file), '/usr/local/lib/libsnap7' (no such file), '/usr/lib/libsnap7' (no such file, not in dyld cache) at SoftPlc.S7Server.Srv_Create() at SoftPlc.S7Server..ctor() in /Users/xxxxx/VisualStudioProjects/_Custom/SoftPlc/SoftPlc/Snap7/snap7.net.cs:line 1918 at SoftPlc.Services.PlcService..ctor(IConfiguration configuration) in /Users/xxxxx/VisualStudioProjects/_Custom/SoftPlc/SoftPlc/Services/PlcService.cs:line 23 at System.RuntimeMethodHandle.InvokeMethod(Object target, Span1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType) at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func`2 valueFactory) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider) at Program.

$(String[] args) in /Users/xxxxx/VisualStudioProjects/_Custom/SoftPlc/SoftPlc/Program.cs:line 48

fbarresi commented 6 months ago

Hi!

What do you mean with you copied the native files into the .net6 folder?

The related native library should be copied into your destination build path.

Eventually, we might need to provide the native libra compiled for m1.

Did you already give a try with docker?

Best regards, FB

birliks commented 6 months ago

Hi fbarresi,

"The related native library should be copied into your destination build path." I did that. But error is about low level addressing issue, so compatibility issue with m1 processor. because i have limited time to complete project, i purchased a windows pc for now.

i also tried docker on mac, but again i get compatibility related errors. so i gave up and switched to windows pc. but compiling for m1 processors, should be good.

thanks for your reply and support.

have a nice day. birliks

fbarresi commented 6 months ago

All right. I always had a bunch of such simulated plc running as a docker on a raspberry pi, so that might be an alternative. I will look for this compatibility fix and update the project. Sadly, I don't have the chance to quickly rebuild on this architecture, so it might take a while.

Best regards, FB

birliks commented 6 months ago

as i said, now i dont need a solution because i buy windows pc. but for others may suffer from the same issue, making mac(osx) version can be good.

Thank you for your support.

Regards, birliks