Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不支持System.Data.SqlClient?(System.Data.SqlClient unsupported?) #6

Open
lds2013 opened this issue Sep 3, 2020 · 35 comments
Open
Labels
bug Something isn't working
Milestone

Comments

@lds2013
Copy link

lds2013 commented Sep 3, 2020

机器环境为 龙芯3A4000,系统中标麒麟桌面版V7.0,运行时:aspnetcore-runtime-3.1.7-ea-20200831-linux-loongson3a.tar.gz,
可以正常运行.netcore 3.1 Demo(没有数据库连接),但是项目加入数据库连接(SQL Server),报如下错误:
System.Data.SqlClient is not supported on this platform..
01
02

@xiangzhai
Copy link

Hi @lds2013

SQL Server is available for Linux MIPS64R2?

Thanks,
Leslie Zhai

@lds2013
Copy link
Author

lds2013 commented Sep 3, 2020

SQL server is installed on another windows server 2012 server, and my project just connects to SQL server.

Hi @lds2013

SQL Server is available for Linux MIPS64R2?

Thanks,
Leslie Zhai

SQL server is installed on another windows server 2012 server, and my project just connects to SQL server.

@xiangzhai
Copy link

xiangzhai commented Sep 3, 2020

SQL server is installed on another windows server 2012 server, and my project just connects to SQL server.

I see!

But the connection library, just like libmysqlclient.so, is available for Linux MIPS64R2?

Thanks,
Leslie Zhai

@lds2013
Copy link
Author

lds2013 commented Sep 3, 2020

SQL server is installed on another windows server 2012 server, and my project just connects to SQL server.

I see!

But the connection library, just like libmysqlclient, is available for Linux MIPS64R2?

Thanks,
Leslie Zhai

The connection library implements . NetStandard, version = 2.1. I don't know it is available for Linux MIPS64R2 is supported.
03

@xiangzhai
Copy link

xiangzhai commented Sep 3, 2020

03

There is MySql.Data!

And libmysqlclient.so is available for MIPS64R2:

$ file /usr/lib64/mysql/libmysqlclient.so.18.0.0 
/usr/lib64/mysql/libmysqlclient.so.18.0.0: ELF 64-bit LSB shared object, MIPS, MIPS64 rel2 version 1 (SYSV), dynamically linked, BuildID[sha1]=51591fda97c72211a259f4e8be94b5de437c90ba, stripped

You can try to use MySQL instead of SQL Server only for test purpose.

Thanks,
Leslie Zhai

@xiangzhai
Copy link

Hi @am11

Is libSQLServerClient.so, just like libmysqlicent.so, available for Linux?

It needs to port SQL Server Client connection library for Linux MIPS64R2.

Any suggestion?

\cc @jkotas

Thanks,
Leslie Zhai

@lds2013
Copy link
Author

lds2013 commented Sep 3, 2020

03

There is MySql.Data!

And libmysqlclient.so is available for MIPS64R2:

$ file /usr/lib64/mysql/libmysqlclient.so.18.0.0 
/usr/lib64/mysql/libmysqlclient.so.18.0.0: ELF 64-bit LSB shared object, MIPS, MIPS64 rel2 version 1 (SYSV), dynamically linked, BuildID[sha1]=51591fda97c72211a259f4e8be94b5de437c90ba, stripped

You can try to use MySQL instead of SQL Server only for test purpose.

Thanks,
Leslie Zhai

I switch to MySQL and call it directly MySql.Data.dll Available.

@xiangzhai
Copy link

I switch to MySQL and call it directly MySql.Data.dll Available.

Good news!

Then you can use MySQL for development environment, but I have no idea about the product environment...

Thanks,
Leslie Zhai

@jkotas
Copy link

jkotas commented Sep 3, 2020

Is libSQLServerClient.so, just like libmysqlicent.so, available for Linux?

System.Data.SqlClient does not depend on a connection library like that on Linux.

@xiangzhai
Copy link

Hi @jkotas

Thanks for your response!

I will check it when I gotta home :) Windows is not available in my office.

Please waiting for my good news!

Thanks,
Leslie Zhai

@am11
Copy link

am11 commented Sep 3, 2020

@lds2013, do you see the same problem with the latest version of System.Data.SqlClient https://www.nuget.org/packages/System.Data.SqlClient/4.8.2? Similar issue was raised here: dotnet/runtime#28416. I think this is not related to MIPS64 architecture support. System.Data.SqlClient is a managed library so it should work on Linux with supported architectures.

@xiangzhai
Copy link

Hi @am11

Thanks for your kind response!

Similar issue was raised here: dotnet/runtime#28416

I will investigate it.

Thanks,
Leslie Zhai

@xiangzhai
Copy link

BTW @sunny868 fixed Microsoft.Data.Sqlite issue for MIPS64 ericsink/SQLitePCL.raw#360

Thanks,
Leslie Zhai

@xiangzhai
Copy link

xiangzhai commented Sep 3, 2020

Hi @lds2013

I reproduced the issue for MIPS64!

ConsoleApp1.zip was created and built under Windows 10 with Visual Studio 2019 by following the article in Chinese simpilfied:

Installed the System.Data.SqlClient via NuGet in the Visual Studio 2019:

PM>  Install-Package System.Data.Common
PM>  Install-Package System.Data.SqlClient

MIPS64:

$ ~/zhaixiang/dotnet-sdk-3.1.107-ea-20200831-linux-loongson3a/dotnet ConsoleApp1.dll
Hello World!
Unhandled exception. System.PlatformNotSupportedException: System.Data.SqlClient is not supported on this platform.
   at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
   at ConsoleApp1.Program.Main(String[] args) in D:\project\xiangzhai\ConsoleApp1\ConsoleApp1\Program.cs:line 12
已放弃

But it is OK for Linux X64:

$  ~/dotnet-sdk-3.1.401-linux-x64/dotnet ConsoleApp1.dll
Hello World!

We will double check the corefx for MIPS64 cc @sunny868

Thanks,
Leslie Zhai

@xiangzhai
Copy link

It is lack of MIPS64:

{                                                                                  
  "runtimeTarget": {                                                               
    "name": ".NETCoreApp,Version=v3.1",                                            
    "signature": ""                                                                
  },                                                                               
  "compilationOptions": {},                                                        
  "targets": {                                                                     
    ".NETCoreApp,Version=v3.1": {                                                  
      "ConsoleApp1/1.0.0": {                                                       
        "dependencies": {                                                          
          "System.Data.Common": "4.3.0",                                           
          "System.Data.SqlClient": "4.8.2"                                         
        },                                                                         
        "runtime": {                                                               
          "ConsoleApp1.dll": {}                                                    
        }                                                                          
      },                                                                           
      "Microsoft.NETCore.Platforms/3.1.0": {},                                     
      "Microsoft.NETCore.Targets/1.1.0": {},                                       
      "Microsoft.Win32.Registry/4.7.0": {                                          
        "dependencies": {                                                          
          "System.Security.AccessControl": "4.7.0",                                
          "System.Security.Principal.Windows": "4.7.0"                             
        }                                                                          
      },                                                                           
      "runtime.native.System.Data.SqlClient.sni/4.7.0": {                          
        "dependencies": {                                                          
          "runtime.win-arm64.runtime.native.System.Data.SqlClient.sni": "4.4.0",
          "runtime.win-x64.runtime.native.System.Data.SqlClient.sni": "4.4.0",  
          "runtime.win-x86.runtime.native.System.Data.SqlClient.sni": "4.4.0"   
        }                                                                          
      },                                                                           
      "runtime.win-arm64.runtime.native.System.Data.SqlClient.sni/4.4.0": {        
        "runtimeTargets": {                                                        
          "runtimes/win-arm64/native/sni.dll": {                                   
            "rid": "win-arm64",                                                    
            "assetType": "native",                                                 
            "fileVersion": "4.6.25512.1"                                           
          }                                                                        
        }                                                                          
      },                                                                           
      "runtime.win-x64.runtime.native.System.Data.SqlClient.sni/4.4.0": {          
        "runtimeTargets": {                                                        
          "runtimes/win-x64/native/sni.dll": {                                     
            "rid": "win-x64",                                                      
            "assetType": "native",                                                 
            "fileVersion": "4.6.25512.1"                                           
          }                                                                        
        }                                                                          
      },                                                                           
...                          

We face the similar issues about vstest and roslyn.

Any suggestion?

\cc @heiher

Thanks,
Leslie Zhai

@jkotas
Copy link

jkotas commented Sep 3, 2020

These architecture specific dependencies are for Windows. You are not doing Windows MIPS port. I do not see the problem.

@xied75
Copy link
Member

xied75 commented Sep 3, 2020

Could this be a little help? dotnet/SqlClient#385

@xiangzhai
Copy link

xiangzhai commented Sep 4, 2020

I am looking for System.Data.SqlClient arm.

Testcase: ConsoleApp1

Windows X64, Linux X64/ARM64 is not able to reproduce the issue.

Thanks,
Leslie Zhai

@xiangzhai
Copy link

Could this be a little help? dotnet/SqlClient#385

dotnet/SqlClient namespace is Microsoft.Data.SqlClient but not System.Data.Sqlclient...

@am11
Copy link

am11 commented Sep 4, 2020

@xiangzhai could you get lldb backtrace with SOS? Also strace -f dotnet bin/..../ConsoleApp1.dll sometimes show useful information, if it is trying to load a binary missing on the system.

@xiangzhai
Copy link

Hi @am11

Thanks for your kind response!

I reproduced the issue for Linux X64 on purposely:

$ diff -Naur ConsoleApp1.deps.json.bak ConsoleApp1.deps.json
--- ConsoleApp1.deps.json.bak	2020-09-04 11:23:03.182385910 +0800
+++ ConsoleApp1.deps.json	2020-09-04 11:20:41.812490677 +0800
@@ -90,7 +90,7 @@
         },
         "runtimeTargets": {
           "runtimes/unix/lib/netcoreapp2.1/System.Data.SqlClient.dll": {
-            "rid": "unix",
+            "rid": "xunix",
             "assetType": "runtime",
             "assemblyVersion": "4.6.1.2",
             "fileVersion": "4.700.20.37001"

Linux X64:

$ ~/dotnet-sdk-3.1.107-linux-x64/dotnet ConsoleApp1.dll
Hello World!
Unhandled exception. System.PlatformNotSupportedException: System.Data.SqlClient is not supported on this platform.
   at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
   at ConsoleApp1.Program.Main(String[] args) in D:\project\xiangzhai\ConsoleApp1\ConsoleApp1\Program.cs:line 12
Aborted (core dumped)

Thanks,
Leslie Zhai

@xiangzhai
Copy link

Good news is MySql.Data.MySqlClient able to work for MIPS64:

Testcase: HelloMySQL.zip

$ ~/zhaixiang/to_ship_sdk/dotnet bin/Debug/netcoreapp3.1/HelloMySQL.dll
Connecting to MySQL...
localhost -- root
localhost.localdomain -- root
127.0.0.1 -- root
::1 -- root
localhost -- 
localhost.localdomain -- 
Done.

RID issue:

$ ~/zhaixiang/to_ship_sdk/dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.107
 Commit:    617a3e03f4

Runtime Environment:
 OS Name:     loongnix
 OS Version:  1.0
 OS Platform: Linux
=> RID:         linux-x64
 Base Path:   /home/loongson/zhaixiang/to_ship_sdk/sdk/3.1.107/

Host (useful for support):
  Version: 3.1.7
  Commit:  59181f06b4

.NET Core SDKs installed:
  3.1.107 [/home/loongson/zhaixiang/to_ship_sdk/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.7 [/home/loongson/zhaixiang/to_ship_sdk/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.7 [/home/loongson/zhaixiang/to_ship_sdk/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

But how to enum all Linux distros for MIPS64?

Thanks,
Leslie Zhai

@am11
Copy link

am11 commented Sep 4, 2020

@xiangzhai, is MIPS64 RID not implemented? It is surprising how things are working without proper RID. Typically RID is the important aspect to run dotnet apps, interesting.
You probably already know this, but we need to add RID for mips64 in the following files:

Basically parts of what we did for illumos/Solaris RID implementation: https://github.com/dotnet/runtime/pull/37016/files.

@xiangzhai
Copy link

xiangzhai commented Sep 4, 2020

is MIPS64 RID not implemented?

Unimplemented. TBD.

Basically parts of what we did for illumos/Solaris RID implementation: https://github.com/dotnet/runtime/pull/37016/files.

Thanks for your teaching!

@lds2013
Copy link
Author

lds2013 commented Sep 4, 2020

Thank you very much for your replies. My problem here is that errors only occur when connecting to SQL Server (2008R2 and 2014) on the Loongson platform. CentOS 7.6 on x86 can connect to SQL Server normally. Recently, it has been migrated to Loongson platform. The above error occurred: System.Data.SqlClient is not supported on this platform, so I suspect that Loongson has not dealt with the related issues, and the conversion to MySQL can be used normally.

@xiangzhai
Copy link

Fixed!

[loongson@localhost netcoreapp3.1]$ ~/zhaixiang/to_ship_sdk/dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.107
 Commit:    617a3e03f4

Runtime Environment:
 OS Name:     loongnix
 OS Version:  1.0
 OS Platform: Linux
 RID:         loongnix.1.0-mips64
 Base Path:   /home/loongson/zhaixiang/to_ship_sdk/sdk/3.1.107/

Host (useful for support):
  Version: 3.1.7
  Commit:  59181f06b4

.NET Core SDKs installed:
  3.1.107 [/home/loongson/zhaixiang/to_ship_sdk/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.7 [/home/loongson/zhaixiang/to_ship_sdk/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.7 [/home/loongson/zhaixiang/to_ship_sdk/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
[loongson@localhost netcoreapp3.1]$ ~/zhaixiang/to_ship_sdk/dotnet ConsoleApp1.dll
Hello World!

Thank @am11 so much!

@lds2013 Please waiting for the next EA release.

Cheers,
Leslie Zhai

@xiangzhai
Copy link

BTW @lds2013 Please paste cat /etc/issue for the 中标麒麟桌面版V7.0

Thanks,
Leslie Zhai

@theaoqi theaoqi added this to the Future milestone Sep 4, 2020
@theaoqi theaoqi added the bug Something isn't working label Sep 4, 2020
@lds2013
Copy link
Author

lds2013 commented Sep 4, 2020

[root@localhost 桌面]# cat /etc/issue
NeoKylin Linux Desktop release 7.0 (loongson)
Kernel \r on an \m (\l)

04

@theaoqi theaoqi changed the title 不支持System.Data.SqlClient? 不支持System.Data.SqlClient?(System.Data.SqlClient unsupported?) Sep 4, 2020
@xiangzhai
Copy link

NeoKylin Linux Desktop release 7.0 (loongson)
Kernel \r on an \m (\l)

Thanks!

@xied75
Copy link
Member

xied75 commented Sep 4, 2020

Is this RID too narrowly defined? RID: loongnix.1.0-mips64
Should it be something like linux-mips64?

@am11
Copy link

am11 commented Sep 4, 2020

IMO, it should be something like linux-mips64 per the docs: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog and https://github.com/dotnet/runtime/blob/4f9ae42/src/libraries/pkg/Microsoft.NETCore.Platforms/readme.md#appendix--details-of-rid-graph-generation

[os name].[version]-[architecture]-[additional qualifiers]

@xiangzhai
Copy link

xiangzhai commented Sep 4, 2020

Modify port/pkg/Microsoft.NETCore.Platforms/runtimeGroups.props to enum ALL Linux distros for MIPS64 such as: debian, loongnix, neokylin, uos, etc:

   <RuntimeGroup Include="debian">
      <Parent>linux</Parent>
      <Architectures>x64;x86;arm;armel;arm64;mips64</Architectures>
      <Versions>8;9;10</Versions>
      <TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
   </RuntimeGroup>

   <RuntimeGroup Include="loongnix">
      <Parent>linux</Parent>
      <Architectures>mips64</Architectures>
      <Versions>1.0</Versions>
      <TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
   </RuntimeGroup>

   <RuntimeGroup Include="neokylin">
      <Parent>linux</Parent>
      <Architectures>mips64</Architectures>
      <Versions>7.0</Versions>
      <TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
   </RuntimeGroup>

   <RuntimeGroup Include="uos">
      <Parent>linux</Parent>
      <Architectures>mips64</Architectures>
      <Versions>20</Versions>
      <TreatVersionsAsCompatible>false</TreatVersionsAsCompatible>
   </RuntimeGroup>

Re-build.sh with /p:UpdateRuntimeFiles=true to re-generate pkg/Microsoft.NETCore.Platforms/runtime.compatibility.json and pkg/Microsoft.NETCore.Platforms/runtime.json

Fallback to linux-mips64 if not enumed:

$ cat ./dotnet-sdk-3.1.107-ea-20200831-linux-loongson3a/sdk/3.1.107/.version 
617a3e03f4f24184a7ce83e08805ac84d0103127
3.1.107
linux-mips64
ea-20200831

Thanks,
Leslie Zhai

@am11
Copy link

am11 commented Sep 4, 2020

@xiangzhai, thanks. Sorry I did not realize that loongnix is a distro on its own. :(

There are two concepts: portable and nonportable RIDs (ref: https://github.com/dotnet/runtime/blob/8ceca25036b395d12c1feedf6f3318786ddb355c/eng/native/init-distro-rid.sh). With portable RID, we should expect linux-mips64. With non-portable RID, it is correct. Lately (since after .NET Core 2.0 i think), portable RID is preferred over non-portable RID; as it is easier for nuget package (third-party) maintainers. If the maintainer wants to specialize the distro for some reason (e.g. branding for Debian), they can do that and host (core-setup in 3.1 and installer in dotnet/runtime) will resolve it correctly.

@xiangzhai
Copy link

Sorry I did not realize that loongnix is a distro on its own. :(

You are welcome! I was a Linux distros Developer too :)

portable and nonportable RIDs

Please see my comment.

@am11
Copy link

am11 commented Sep 4, 2020

Just for clarification; the RID reported by dotnet --info is something which tells us whether the product is built as potable=true or false.
If the binary compatibility is generally there between the distros (ignoring some edge case), portable=true is preferred. e.g. linux-x64 binaries work on Gentoo, Ubuntu and Fedora alike. However, during the runtime, the host knows about the specific RID (e.g. ubuntu.18.04-x64), and then nuget etc. use RID graph to find the best match.

jkotas pushed a commit to dotnet/runtime that referenced this issue Sep 14, 2020
@theaoqi theaoqi modified the milestones: Future, ea-20201104 Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants