zeroc-ice / ice

All-in-one solution for creating networked applications with RPC, pub/sub, server deployment, and more.
https://zeroc.com
GNU General Public License v2.0
2.03k stars 592 forks source link

Ice::UnsupportedEncodingException: unsupported encoding version: 0.0 #1302

Closed Jast4U closed 2 years ago

Jast4U commented 3 years ago

I compiled the ICE and demo myself by using gcc in MinGW7.3.0 64bit. I built the demo cases by Qt Creator (MingW7.3.0) 64 bit When I test the demo ice/hello by , it shows below error:

........\ICE_DemoStudy\ICE_HOME\include/Ice/Protocol.h:186: Ice::UnsupportedEncodingException: encoding error: unsupported encoding version: 0.0 (can only support encodings compatible with version 1.1)

I previously run the demo case about 1 year ago, it worked fine. Don't know why it suddenly went wrong...

Capture
pepone commented 3 years ago

You must use one of the supported platforms see https://doc.zeroc.com/rel/ice-releases/ice-3-6/ice-3-6-4-release-notes/supported-platforms-for-ice-and-ice-touch-3-6-4#SupportedPlatformsforIceandIceTouch3.6.4-IceandIceTouchforC++

For new projects better use the latest release, https://github.com/zeroc-ice/ice/releases/tag/v3.7.6

Jast4U commented 3 years ago

You must use one of the supported platforms see https://doc.zeroc.com/rel/ice-releases/ice-3-6/ice-3-6-4-release-notes/supported-platforms-for-ice-and-ice-touch-3-6-4#SupportedPlatformsforIceandIceTouch3.6.4-IceandIceTouchforC++

For new projects better use the latest release, https://github.com/zeroc-ice/ice/releases/tag/v3.7.6

  1. The 3.6.4 supports MinGW/Qt previously, I just wonder why it suddenly not worked?? because I re-install my OS?
  2. For v3.7.6, seems there is no makefile for MinGW compilation, which is a big challenge.
pepone commented 3 years ago

MinGW compiler was only supported to build Ice for Ruby on Windows.

The first error seems to indicate that your proxy string is bogus, can you paste it?

Jast4U commented 3 years ago

MinGW compiler was only supported to build Ice for Ruby on Windows.

The first error seems to indicate that your proxy string is bogus, can you paste it?

****1. I previously used MinGW compiler to successfully compile ICE and worked fine with demos

  1. There should no problem with the proxy string, as below.****

Hello.Proxy=hello:tcp -p 10006:udp -p 10000:ssl -p 10001 Ice.Default.Host=localhost Ice.Warn.Connections=1 Ice.Plugin.IceSSL=IceSSL:createIceSSL IceSSL.DefaultDir=../../../certs IceSSL.CAs=cacert.pem IceSSL.CertFile=client.p12 IceSSL.Password=password IceSSL.Keychain=client.keychain IceSSL.KeychainPassword=password

pepone commented 3 years ago
  1. There should no problem with the proxy string, as below.

You are right, the proxy string looks correct, did you update the MinGW compiler recently if so you might need to recompile Ice?

Jast4U commented 3 years ago
  1. There should no problem with the proxy string, as below.

You are right, the proxy string looks correct, did you update the MinGW compiler recently if so you might need to recompile Ice?


About 1 year ago, I compiled the ICE3.6.4 by MSYS with MinGW gcc v7.3.0 for basic libraries : iceutil.dll, icessl.dll, ice.dll, Glacier2Lib.dll , and integrated them into my C++ Application written by Qt (because I want cross-platform feature). It worked very well.

Recently I re-install my OS, and recover the development environment exactly the same as previous. However, It turned out the ICE not worked. I re-compile the ICE again and again and again, but still report the same error.
I was stucked here for many weeks and no progress. It is very depressed.

pepone commented 3 years ago

Try attaching the debugger and see why this warning "Proxy contains unknown endpoints:..." is being emitted

https://github.com/zeroc-ice/ice/blob/1636647018f471ba5d918e58b7c374b12ef0ca19/cpp/src/Ice/ReferenceFactory.cpp#L99

Jast4U commented 3 years ago

Try attaching the debugger and see why this warning "Proxy contains unknown endpoints:..." is being emitted

https://github.com/zeroc-ice/ice/blob/1636647018f471ba5d918e58b7c374b12ef0ca19/cpp/src/Ice/ReferenceFactory.cpp#L99

There is no exception throw in the function IceInternal::ReferenceFactory::create(...) Actually, I found some strange as I set break point , as below pictures shown. in the function BasicStream* startWriteParams(Ice::FormatType format) it calls _os.startWriteEncaps(_encoding, format); the _encoding value is 1.1 However, when step into the function void startWriteEncaps(const Ice::EncodingVersion& encoding, Ice::FormatType format) the passed parameter encoding value suddenly changes into 0.0,
DON"T KNOW WHY ?????

step1 step2
Jast4U commented 3 years ago

Anybody has any idea ? How to compile the V3.7.6 BY MinGW?

bentoi commented 3 years ago

Can you copy/paste a sample of the compiler flags when building one of the Ice sources? Are you building with optimization flags for instance?

Jast4U commented 3 years ago

Can you copy/paste a sample of the compiler flags when building one of the Ice sources? Are you building with optimization flags for instance?

As below. I use both optimization flags = yes/no for debug/release, but the result shows the same. By the way, I download the 3.6.5 and complied , it still shows the encoding problem.

3333
pepone commented 2 years ago

Hi @Jast4U ,

Did you figure out the issue? I can take a look otherwise and see if is something we can reproduce.

Can you clarify what MinGW installer are you using to test with the same environment?

Cheers, Jose

Jast4U commented 2 years ago

Hi @Jast4U ,

Did you figure out the issue? I can take a look otherwise and see if is something we can reproduce.

Can you clarify what MinGW installer are you using to test with the same environment?

Cheers, Jose

Still not and working hard on it. for compiling tools: (a) I use Qt 5.12.3, with MinGW730 inside for my whole project. (b) I use the MSYS1.1 to compile the ice 3.6.4 libs, only 3 are used: iceutil.dll, ice.dll, icessl.dll the MSYS link the MinGW730 exactly from Qt installation path.

pepone commented 2 years ago

Hey,

I was able to reproduce the issue with MinGW 7.3.0 from Qt 5.12, seems like a compiler bug, uninlining the method fixes the problem. Try the attached patch. 0001-MinGW-workaround-for-inline-method-bug.txt

I also try with our test suite and didn't find any issues, so it can be caused by an incompatibility with the build flags set by Qt builds...

Jast4U commented 2 years ago

sed by an incompatibility with the

Hi, Thanks very much for your nice help. I adopted your suggestion and tested in the ice official simple "Hello" project and it worked fine. I later used it in my own project but it seems Still NOT working.... I will check out for more ...

pepone commented 2 years ago

It will be good to test with a more recent compiler supported by Qt and see if things work better

Jast4U commented 2 years ago

It will be good to test with a more recent compiler supported by Qt and see if things work better

Yeah, you are right. Even in my project it still not working now, but at least you provide me good clue to further solve it. What I am interested is : How did you think out this solution ? I never think that inline will cause such problem.

pepone commented 2 years ago

A college suggested it, something was up with the compiler as the value just change from one method to another, and one thing that made this function different is that it was inline (defined in the header file).

Jast4U commented 2 years ago

ollege suggested it, something was up with the compiler as the value ju

Thanks, that depends on rich experience. So in the future, will the ICE move the inline functions to cpp ??

By the way, I use glacier2 in my project, maybe there is something similar need to change ? I will find out more.

pepone commented 2 years ago

So in the future, will the ICE move the inline functions to cpp ??

No, this is a compiler bug. Why don't you switch to 3.7 and VS Compiler that is now freely available, will make things simpler?

Jast4U commented 2 years ago

So in the future, will the ICE move the inline functions to cpp ??

No, this is a compiler bug. Why don't you switch to 3.7 and VS Compiler that is now freely available, will make things simpler?

Because my entire project is written by Qt & QtCreator. Using ICE compiled by VS will incompatible with my project. One thing I don't understand is that why 1 year ago, I use the same compiler and my project worked fine ?? rather confusing..

Jast4U commented 2 years ago

Hey, I finally solve my problem, the "OutgoingAsyn.h/cpp" are also need to be un-inlined. Thanks very much.

I shall use the latest compiler to check out more :)

Jast4U commented 2 years ago

Thanks to Pepone for nice help !

codedog-2018 commented 2 months ago

@Jast4U hey,can you support ice lib for mingw7.3 64,thanks