Sarcasm / flycheck-irony

C, C++ and Objective-C support for Flycheck, using Irony Mode
56 stars 10 forks source link

I'm getting a charset error, i think, on windows #19

Closed joaopaulo23 closed 6 years ago

joaopaulo23 commented 6 years ago

I was able to compile the irony-server on msys2, but, when i try to start flycheck with irony-server, it is returning this error:

Error while checking syntax automatically: (irony-server-error "irony-server is broken! Invalid version syntax: ‘1.0.0^M‘
 ’")

Anyone knows how to fix it? I need to recompile at different charset?

Sarcasm commented 6 years ago

Not sure what is wrong. I call (process-lines "irony-server" "--version"). I would expect process-lines to handle Windows line endings.

What happen if you do something like:

(process-lines "echo" "toto")

Do you have ("toto") or something like ("toto^M")?

joaopaulo23 commented 6 years ago

The first call returned ("irony-server version 1.0.0^M" "clang version 4.0.0 (tags/RELEASE_400/final)^M") the second ("toto") This "^M" work as breakline i guess.

Sarcasm commented 6 years ago

Other Windows users have not reported any issue like this before, so I'm suspecting it's something up with your environment. I could try to work around it, but I'm afraid it would hide the real issue.

Maybe it's something related to the mysys environment, which Emacs could consider "unixy" and expect \n newline, while the binary is run with a Windows launcher and return \r\n. Ideally you could try with a simple hello world app compile the same as irony-server to see if the behavior is the same. I don't have much advice to offer, I expect "process-lines" to not return the ^M, or that we understand why it does.

joaopaulo23 commented 6 years ago

I guess that i could just modify something in some .el to repair that. I'll try to change the C code, removing \n or using another charset. I really guess that is the charset problem, that "^M" seems to be a "\n" in other charset, but i'm not so sure. If it helps, i will post here what i changed to help another who could be struggling in this problem.

joaopaulo23 commented 6 years ago

I guess i was able to fix the error. go to irony-mode/server/src/main.cpp, find the print version parte of the code and substitute for this.

static void printVersion() {
  // do not change the format for the first line, external programs should be
  // able to rely on it
  std::cout << "irony-server version " IRONY_PACKAGE_VERSION;

  /*CXString cxVersionString = clang_getClangVersion();
  std::cout << clang_getCString(cxVersionString)<<" ";
  clang_disposeString(cxVersionString);*/
} 

It fixed, but still a little weird, i guess it could be a flycheck problem. Sorry for bother you, i'm new at emacs.