QtSharp icon indicating copy to clipboard operation
QtSharp copied to clipboard

Linux support

Open karliss opened this issue 11 years ago • 18 comments

Here are some observations on trying to run QtSharp on linux

  • Minor differences in library names
  • shared libraries are located in qmake -query QT_INSTALL_LIBS not QT_INSTALL_BINS
  • System include directories - "g++ -v -E -x c++ - </dev/null" should give better results than guessing from target and compiler version
  • -fPIC -> -mreloaction-model pic -pic-level 2
  • NullReferenceException caused by TagType without Declaration, va_list from qvsnprintf

karliss avatar Sep 22 '14 08:09 karliss

@karliss thank you for testing. In case you've been able to work around these problems, I'd love to see your changes and try incorporating them. A patch would be even more welcome.

ddobrev avatar Sep 22 '14 10:09 ddobrev

@karliss I'd like to let you know that the va_list bug has been fixed for more than two weeks - I am sorry for not informing you earlier.

ddobrev avatar Oct 15 '14 16:10 ddobrev

Great, that got me a bit further. Some .cs files were generated. And i got a bunch of CS0246 QEvent and QObject. Does CppSharp automatically tries to compile generated files?

karliss avatar Oct 15 '14 20:10 karliss

Yes, it does. About the problem itself, I am afraid I don't have the time at the moment. @golddranks has been working on the problem of dependencies which causes the majority of compilation errors so you could help him if you want. Alternatively, I can take patches for your other suggestions.

ddobrev avatar Oct 15 '14 21:10 ddobrev

@ddobrev i get this on Linux after compiling Qtsharp on ubuntu

Error parsing 'QtCore' /usr/include/qt5/QtCore/qglobal.h(82,10): fatal: 'algorithm' file not found

and then a null refrence exception at some where in QtSharp.QtSharp.Preprocess(CppSharp.Driver driver, CppSharp.AST.ASTContext lib),

one question i am not very good with regular expressions , can you explain this so i may help https://github.com/ddobrev/QtSharp/blob/master/QtSharp/QtSharp.cs#L30

shahid-pk avatar Nov 02 '14 20:11 shahid-pk

@shahid-pk could you please look in the debugger and tell me the value of "library"?

ddobrev avatar Nov 02 '14 20:11 ddobrev

@ddobrev its value is libQt5Core.so

shahid-pk avatar Nov 02 '14 20:11 shahid-pk

@ddobrev after commenting out this line https://github.com/ddobrev/QtSharp/blob/master/QtSharp/QtSharp.cs#L68 i got QtCore parsed, and got cs wrappers , now the c# compiler is complaining, which can be fixed easily, but the thing i am woried about is that QtCore parsing error which is still not fixed

/usr/include/qt5/QtCore/qglobal.h(82,10): fatal: 'algorithm' file not found,

shahid-pk avatar Nov 02 '14 21:11 shahid-pk

@shahid-pk so the null ref wasn't at the regex line, that's a relief. I couldn't figure out why it would crash there. About the line you've commented out, it crashes because of the missing header. I am working on another issue at the moment, when I'm done, I'll apply an improved way of getting the MinGW headers which should fix your issue.

ddobrev avatar Nov 02 '14 21:11 ddobrev

@shahid-pk I've implemented @karliss 's third suggestion (thanks!) and you should now have no problem with headers.

ddobrev avatar Nov 03 '14 14:11 ddobrev

@ddobrev oh that is great to hear. i am giving it a try.

shahid-pk avatar Nov 03 '14 16:11 shahid-pk

@ddobrev i get into another trouble which is related to CppSharp, this project is using CppSharp.Parser.CLI while on linux you can not build that assembly, because that will need a c++/cli compiler, correct me if i am wrong. so i tried to use CppSharp.Parser.Csharp instead of CppSharp.Parser.CLI but this project is using things that are not present in that assembly. the compiler complains with this error CppSharp.Parser.ParserOptions is defined in an assembly that is not referenced and four others like it.

shahid-pk avatar Nov 03 '14 20:11 shahid-pk

@shahid-pk I thought you had compiled C++# on Linux, otherwise you wouldn't have been able to even start the parser. What exact references do you use?

ddobrev avatar Nov 03 '14 20:11 ddobrev

@ddobrev yes i compiled CppSharp on Linux .. but the thing is on Linux i can not compile CppSharp.Parser.CLI because of obvious reasons, their is no C++/Cli compiler on Linux if i am not mistaken. building of CppSharp.Parser.CLI is excluded from the Linux build. But before i merged the latest commits i was able to compile the Qtsharp project by using CppSharp.Parser.Charp instead of CppSharp.Parser.CLI, all other assemblies are the same , and of course the native CppSharp.CppParser.dll is also different on Linux it is libCppSharp.CppParser.so

shahid-pk avatar Nov 03 '14 21:11 shahid-pk

Sorry for that not being clear. CppSharp.Parser.Charp is indeed used on non-Windows systems. I'll look into switching to it for Windows as well as to avoid confusion.

ddobrev avatar Nov 03 '14 21:11 ddobrev

@ddobrev switching at this time is the correct option in my opinion , because you are using only a few things from CLI that is not in CSharp.So the switch will require less effort.

shahid-pk avatar Nov 03 '14 21:11 shahid-pk

Hi ddobrev, any news for linux support ?

armando-basile avatar Oct 25 '15 18:10 armando-basile

@armando-basile I am afraid not. I have two more bugs to fix to make a more stable Windows alpha which I should be able to finish by the middle of November. However, I would welcome any assistance for the Linux port so let me know if there's anything that gets in your way.

ddobrev avatar Oct 25 '15 18:10 ddobrev