ddobrev / QtSharp

Mono/.NET bindings for Qt
Other
571 stars 51 forks source link

Building on Mac OS X #59

Open durswd opened 7 years ago

durswd commented 7 years ago

I try to execute in Mac. I maybe find a bug.

public static string GetModuleNameFromLibFile(string libFile) { var qtModule = Path.GetFileNameWithoutExtension(libFile); if (Platform.IsWindows) { return "Qt" + qtModule.Substring("Qt".Length + 1); } return libFile.Substring("lib".Length); }

In Mac, libFile is Qt3DQuickInput, QtCore, etc. So this function return DQuickInput, ore, etc because 3 characters is removed from a head.

I think that it should return libFile in Mac.

In addition, I fix it. But it print "CppSharp has encountered an error while parsing code." because of missing files.

ddobrev commented 7 years ago

Hello @durswd . The parser errors are printed in the console, could you please tell me what they are?

durswd commented 7 years ago

Parsing libraries... Error parsing 'Qt3DCore' Error parsing 'Qt3DExtras' Error parsing 'Qt3DInput' Error parsing 'Qt3DLogic' Error parsing 'Qt3DQuick' Error parsing 'Qt3DQuickExtras' Error parsing 'Qt3DQuickInput' Error parsing 'Qt3DQuickRender' Error parsing 'Qt3DRender' Error parsing 'QtBluetooth' Error parsing 'QtCLucene' Error parsing 'QtConcurrent' Error parsing 'QtCore' Error parsing 'QtDBus' Error parsing 'QtDesigner' Error parsing 'QtDesignerComponents' Error parsing 'QtGui' Error parsing 'QtHelp' Error parsing 'QtLocation' Error parsing 'QtMacExtras' Error parsing 'QtMultimedia' Error parsing 'QtMultimediaQuick_p' Error parsing 'QtMultimediaWidgets' Error parsing 'QtNetwork' Error parsing 'QtNfc' Error parsing 'QtOpenGL' Error parsing 'QtPositioning' Error parsing 'QtPrintSupport' Error parsing 'QtQml' Error parsing 'QtQuick' Error parsing 'QtQuickControls2' Error parsing 'QtQuickParticles' Error parsing 'QtQuickTemplates2' Error parsing 'QtQuickWidgets' Error parsing 'QtScxml' Error parsing 'QtSensors' Error parsing 'QtSerialBus' Error parsing 'QtSerialPort' Error parsing 'QtSql' Error parsing 'QtSvg' Error parsing 'QtTest' Error parsing 'QtWebChannel' Error parsing 'QtWebSockets' Error parsing 'QtWebView' Error parsing 'QtWidgets' Error parsing 'QtXml' Error parsing 'QtXmlPatterns' Parsing code... A file from 'guiddef.h,Qt3DCore,Qt3DExtras,Qt3DInput,Qt3DLogic,Qt3DQuick,Qt3DQuickExtras,Qt3DQuickInput,Qt3DQuickRender,Qt3DRender,QtBluetooth,QtCLucene,QtConcurrent,QtCore,QtDBus,QtDesigner,abstractactioneditor.h,abstractdnditem.h,abstractformbuilder.h,abstractformeditor.h,abstractformeditorplugin.h,abstractformwindow.h,abstractformwindowcursor.h,abstractformwindowmanager.h,abstractformwindowtool.h,abstractintegration.h,abstractlanguage.h,abstractmetadatabase.h,abstractnewformwidget.h,abstractobjectinspector.h,abstractoptionspage.h,abstractpromotioninterface.h,abstractpropertyeditor.h,abstractresourcebrowser.h,abstractsettings.h,abstractwidgetbox.h,abstractwidgetdatabase.h,abstractwidgetfactory.h,container.h,customwidget.h,default_extensionfactory.h,dynamicpropertysheet.h,extension.h,extension_global.h,extrainfo.h,formbuilder.h,layoutdecoration.h,membersheet.h,propertysheet.h,qdesigner_components.h,qdesigner_components_global.h,qdesignerexportwidget.h,qextensionmanager.h,qtdesignerversion.h,sdk_global.h,taskmenu.h,uilib_global.h,QtDesignerComponents,QtGui,QtHelp,QtLocation,QtMacExtras,QtMultimedia,QtMultimediaQuick_p,QtMultimediaWidgets,QtNetwork,QtNfc,QtOpenGL,QtPositioning,QtPrintSupport,QtQml,QtQuick,QtQuickControls2,QtQuickParticles,QtQuickTemplates2,QtQuickWidgets,QtScxml,QtSensors,QtSerialBus,QtSerialPort,QtSql,QtSvg,QtTest,QtWebChannel,QtWebSockets,QtWebView,QtWidgets,QtXml,QtXmlPatterns' was not found CppSharp has encountered an error while parsing code. Generation failed.

ddobrev commented 7 years ago

Thank you. Did you install Qt from its installers for macOS?

durswd commented 7 years ago

Yes, I used Qt Online Installer for macOS. Version is 5.8

durswd commented 7 years ago

I removed this line driver.Project.AddFile("guiddef.h"); because I think that this file is not required in Mac.

So errors are changed.

much 'error: source file is not valid UTF-8' and 'error: embedding a #include directive within macro arguments is not supported'

Users/xxx/Qt/5.8/clang_64/lib/QtDesigner.framework/QtDesigner(24414,2): error: unterminated function-like macro invocation (88,25): error: expected '}' Users/xxx/Qt/5.8/clang_64/lib/QtDesigner.framework/QtDesigner(24413,53): error: expected ';' after top level declarator

ddobrev commented 7 years ago

@durswd I am not sure if I can fix the error on your machine but I might have time by the end of the week to generate a binary release for you, would this work?

durswd commented 7 years ago

Thank you. I'm trying to generate a binary too.

durswd commented 7 years ago

I changed Qt 5.8 into Qt5.9. But same errors are caused.

I seem that a file reader is something wrong.

Parsing libraries... Error parsing 'QtCore' Parsing code... Error parsing 'QtCore' /Users/x/Qt/5.9/clang_64/lib/QtCore.framework/QtCore(1,1): error: source file is not valid UTF-8 /Users/x/Qt/5.9/clang_64/lib/QtCore.framework/QtCore(1,2): error: source file is not valid UTF-8 /Users/x/Qt/5.9/clang_64/lib/QtCore.framework/QtCore(1,3): error: source file is not valid UTF-8 ...

durswd commented 7 years ago

I found that a binary file is included through an alias instead of a header file. For example, Versions/5/QtCore is included.

So I comment out module.IncludeDirs.Add(cb);

As a result of this, source file is not valid UTF-8 are not shown. But CppSharp has encountered an error while parsing code. is still shown and parser errors are not shown.

ddobrev commented 7 years ago

@durswd I am really sorry to say I am still extremely busy. However, if you contact me in private, we could work something out. Look for my e-mail in my commit messages.

durswd commented 7 years ago

I sent a mail to you.

durswd commented 7 years ago

I sent and merged PR. But this errors are still caused. I try to fix it.

  at CppSharp.Generators.CSharp.CSharpSources.GetValidMethodAccess (CppSharp.AST.Method method) [0x0002c] in <2c8e65c9c2444ebfbc9c0d8b751545b6>:0 
  at CppSharp.Generators.CSharp.CSharpSources.GenerateMethod (CppSharp.AST.Method method, CppSharp.AST.Class class) [0x0001d] in <2c8e65c9c2444ebfbc9c0d8b751545b6>:0 
  at CppSharp.Generators.CSharp.CSharpSources.GenerateClassMethods (System.Collections.Generic.IList`1[T] methods) [0x0011e] in <2c8e65c9c2444ebfbc9c0d8b751545b6>:0 
  at CppSharp.Generators.CSharp.CSharpSources.VisitClassDecl (CppSharp.AST.Class class) [0x003a0] in <2c8e65c9c2444ebfbc9c0d8b751545b6>:0 
  at CppSharp.AST.Class.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <069c880acada475196bb74f146cb4512>:0 
  at CppSharp.Generators.CSharp.CSharpSources.VisitDeclContext (CppSharp.AST.DeclarationContext context) [0x000cc] in <2c8e65c9c2444ebfbc9c0d8b751545b6>:0 
  at CppSharp.Generators.CodeGenerator.VisitTranslationUnit (CppSharp.AST.TranslationUnit unit) [0x00001] in <2c8e65c9c2444ebfbc9c0d8b751545b6>:0 
  at CppSharp.AST.TranslationUnit.Visit[T] (CppSharp.AST.IDeclVisitor`1[T] visitor) [0x00001] in <069c880acada475196bb74f146cb4512>:0 
  at CppSharp.Generators.CSharp.CSharpSources.Process () [0x00071] in <2c8e65c9c2444ebfbc9c0d8b751545b6>:0 
  at CppSharp.Generators.Generator.GenerateSingleTemplate (System.Collections.Generic.ICollection`1[T] outputs) [0x00084] in <2c8e65c9c2444ebfbc9c0d8b751545b6>:0 
  at CppSharp.Generators.Generator.Generate () [0x00037] in <2c8e65c9c2444ebfbc9c0d8b751545b6>:0 
  at CppSharp.Driver.GenerateCode () [0x00007] in <2c8e65c9c2444ebfbc9c0d8b751545b6>:0 
  at CppSharp.ConsoleDriver.Run (CppSharp.ILibrary library) [0x0016a] in <2c8e65c9c2444ebfbc9c0d8b751545b6>:0 
  at QtSharp.CLI.Program.Main (System.String[] args) [0x00132] in /Users/xxx/QtSharp/QtSharp.CLI/Program.cs:198 
durswd commented 7 years ago

These bugs are solved on latest CppSharp. But other bugs are caused.

/Users/x/QtSharp/QtSharp.CLI/bin/Release/QtCore.Sharp.cs(65909,16) : error CS0400: The type or namespace name QtWidgets' could not be found in the global namespace. Are you missing an assembly reference? /Users/x/QtSharp/QtSharp.CLI/bin/Release/QtCore.Sharp.cs(65929,16) : error CS0400: The type or namespace nameQtWidgets' could not be found in the global namespace. Are you missing an assembly reference? /Users/x/QtSharp/QtSharp.CLI/bin/Release/QtCore.Sharp.cs(65948,16) : error CS0400: The type or namespace name QtWidgets' could not be found in the global namespace. Are you missing an assembly reference? /Users/x/QtSharp/QtSharp.CLI/bin/Release/QtCore.Sharp.cs(65950,72) : error CS0400: The type or namespace nameQtGui' could not be found in the global namespace. Are you missing an assembly reference?

.......