nodegui / qode

DEPRECATED: Please see https://github.com/nodegui/qodejs instead
https://nodegui.github.io/nodegui/#/tutorial/application-architecture?id=qode
92 stars 10 forks source link

Add QtSvg to build #11

Closed Ty3uK closed 4 years ago

Ty3uK commented 4 years ago

Will be used with other PRs that implements QSvgWidget and Svg React component.

a7ul commented 4 years ago

Hi @Ty3uK

Instead of adding QSvg to Qode can we make it a separate plugin ?

I really dont want to add additional libs to the core package.

Maybe do something like what Qt Webview plugin is trying to achieve ?

The main issue is that QtSvg wont be used in all the projects, so we can export is as a separate plugin instead.

a7ul commented 4 years ago

https://github.com/nodegui/nodegui-plugin-webview/

a7ul commented 4 years ago

Let me know and I can further help you out with this.

Ty3uK commented 4 years ago

Hi @Ty3uK

Instead of adding QSvg to Qode can we make it a separate plugin ?

I really dont want to add additional libs to the core package.

Maybe do something like what Qt Webview plugin is trying to achieve ?

Ok, thank you, I'll check it out!

Ty3uK commented 4 years ago

@master-atul can you check out repo?

When I run building without QT_INSTALL_DIR, I've errors with QtSvg module (obvious). But when I pass QT_INSTALL_DIR, demo crashes with new error:

objc[11006]: Class QT_ROOT_LEVEL_POOL__THESE_OBJECTS_WILL_BE_RELEASED_WHEN_QAPP_GOES_OUT_OF_SCOPE is implemented in both /Users/ty3uk/projects/js/nodegui-plugin-svg/node_modules/@nodegui/qode/dist/1.0.6/lib/QtCore.framework/Versions/5/QtCore (0x102167618) and /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (0x10ab72140). One of the two will be used. Which one is undefined.
objc[11006]: Class RunLoopModeTracker is implemented in both /Users/ty3uk/projects/js/nodegui-plugin-svg/node_modules/@nodegui/qode/dist/1.0.6/lib/QtCore.framework/Versions/5/QtCore (0x102167640) and /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore (0x10ab721b8). One of the two will be used. Which one is undefined.
a7ul commented 4 years ago

Let me quickly check this @Ty3uK

Ty3uK commented 4 years ago

@master-atul of course, thanks!

a7ul commented 4 years ago
Screenshot 2019-12-17 at 19 07 14

Seems to work pretty well with QT_INSTALL_DIR=/Users/atulr/Tools/qt/5.13.0/clang_64 npm run dev @Ty3uK

Ty3uK commented 4 years ago

@master-atul hmm, strange. I've install qt through homebrew.

a7ul commented 4 years ago

Could you post the actual path you are using in QT_INSTALL_DIR ?

Ty3uK commented 4 years ago

QT_INSTALL_DIR=/usr/local/Cellar/qt/5.13.2

a7ul commented 4 years ago

Could you quickly do ls /usr/local/Cellar/qt/5.13.2 and post the contents of the directory here?

Ty3uK commented 4 years ago
ll /usr/local/Cellar/qt/5.13.2
Permissions Size User  Date Modified Name
drwxr-xr-x     - ty3uk 28 окт 15:14  .brew
drwxr-xr-x     - ty3uk 28 окт 15:14  bin
drwxr-xr-x     - ty3uk 28 окт 15:14  doc
drwxr-xr-x     - ty3uk 28 окт 15:14  Frameworks
drwxr-xr-x     - ty3uk 28 окт 15:14  include
.rw-r--r--  3,2k ty3uk 10 дек 15:18  INSTALL_RECEIPT.json
drwxr-xr-x     - ty3uk 28 окт 15:14  lib
drwxr-xr-x     - ty3uk 28 окт 15:14  libexec
drwxr-xr-x     - ty3uk 10 дек 15:17  mkspecs
drwxr-xr-x     - ty3uk 28 окт 15:14  phrasebooks
drwxr-xr-x     - ty3uk 28 окт 15:14  plugins
drwxr-xr-x     - ty3uk 28 окт 15:14  qml
.rw-r--r--  3,8k ty3uk 28 окт 15:14  README
drwxr-xr-x     - ty3uk 28 окт 15:14  translations
a7ul commented 4 years ago

This is super strange. d in both /Users/ty3uk/projects/js/nodegui-plugin-svg/node_modules/@nodegui/qode/dist/1.0.6/lib/QtCore.framework/Versions/5/QtCore (0x102167640) and /usr/local/opt/qt/lib/QtCore.framework/Versions/5/QtCore This clearly means it is trying to access qode's Qt.

This should have worked ideally. Is it too much for me to ask you to install official Qt ? I do remember that it was working with homebrew version also. Let me try it out with homebrew based qt installer as well

Ty3uK commented 4 years ago

@master-atul no problem, already started downloading :)

Ty3uK commented 4 years ago

Installed 5.14.0, got error:

Error: dlopen(/Users/ty3uk/projects/js/nodegui-plugin-svg/build/Release/nodegui_plugin_svg.node, 1): Library not loaded: @rpath/QtCore.framework/Versions/5/QtCore
  Referenced from: /Users/ty3uk/projects/js/nodegui-plugin-svg/build/Release/nodegui_plugin_svg.node
  Reason: Incompatible library version: nodegui_plugin_svg.node requires version 5.14.0 or later, but QtCore provides version 5.13.0

Trying to install 5.13.2

a7ul commented 4 years ago

So, I can confirm it is not working with homebrew version sadly. Will check it out in depth why.

But make sure you run npx cmake-js clean before switching the qt or delete the build directory.

Ty3uK commented 4 years ago

Yep, i've delete build before checking

Ty3uK commented 4 years ago

With 5.13.2 got next error:

Cannot mix incompatible Qt library (version 0x50d02) with this library (version 0x50d00)

With QT_DEBUG_PLUGINS=1 found that crash is related to macintosh plugin:

Got keys from plugin meta data ("macintosh")
QFactoryLoader::QFactoryLoader() checking directory path "/Users/ty3uk/projects/js/nodegui-plugin-svg/node_modules/@nodegui/qode/dist/1.0.6/styles" ...
loaded library "/Users/ty3uk/projects/js/nodegui-plugin-svg/node_modules/@nodegui/qode/dist/1.0.6/plugins/styles/libqmacstyle.dylib"
QFactoryLoader::QFactoryLoader() checking directory path "/Users/ty3uk/projects/js/nodegui-plugin-svg/node_modules/@nodegui/qode/dist/1.0.6/plugins/accessible" ...
QFactoryLoader::QFactoryLoader() checking directory path "/Users/ty3uk/projects/js/nodegui-plugin-svg/node_modules/@nodegui/qode/dist/1.0.6/accessible" ...
Cannot mix incompatible Qt library (version 0x50d02) with this library (version 0x50d00)
a7ul commented 4 years ago

Interesting. I am running 5.13.0 and thats why it works for me. Great! Now we know the plugin system needs a bit more of work. I ll need to dig a bit deep to resolve this. I know its a bit strange request. But maybe you can try the exact version 5.13.0 for now until we resolve this correctly so that you are not blocked. But thanks for discovering this.

Ty3uK commented 4 years ago

@master-atul 5.13.0 download in progress! :)

Ty3uK commented 4 years ago

@master-atul confirm, worked with 5.13.0

a7ul commented 4 years ago

I have a theory. When we do npm install we use qode's qt to build the nodegui core libarary. This is qt v5.13.0. So I think if we do QT_INSTALL_DIR=/Users/atulr/Tools/qt/5.13.2/clang_64 npm install after deleting node_modules it should compile with core nodegui library also with 5.13.2 and then when we build our plugin with 5.13.2 everything should be okay.

But since its working for you at the moment I will take a look at this sometime later.

Ty3uK commented 4 years ago

@master-atul I've tried install with QT_INSTALL_DIR - it's not working

Ty3uK commented 4 years ago

Anyway, thank you for help!

Ty3uK commented 4 years ago

@master-atul sorry, maybe you know what kind of problem is that. Building on Windows 10 with VS 2017 failed with next error:

..\node_modules\@nodegui\nodegui\config\..\build\Release\nodegui_core.node : fatal error LNK1107:  [C:\develop\nodegui-plugin-webview\build\nodegui_plugin_webview.vcxproj]

Same error with your webview plugin.