sassanh / qnvim

Neovim backend for Qt Creator
MIT License
134 stars 8 forks source link

Qt Creator crashes on startup after this plugin is installed (4.9.0-rc1, macOS 10.14) #8

Closed Jerry-Ma closed 5 years ago

Jerry-Ma commented 5 years ago

Hi,

First, thank you very much for your work. This is brilliant!

However, I tried to compile the plugin with the latest QTC 4.9.0-rc1, and it succeeded, but QTC won't start.

Things that I did:

  1. checkout qt-creator v4.9.0-rc1 and build
  2. checkout neovim-qt and build
  3. modify the qvim.pro file and build

Observation 1: Run the built QTC (run my installed QTC version (also 4.9.0-rc1) results in the identical behavior): A dialog pops up saying the dependencies (Core and TextEdit) is not found, qnvim plugin is not loaded.

Observation 2: Copy the libCore.dylib and libTextEdit.dylib to the same folder as the plugin (~/Libarary ...), run QTC: The program fails to start.

Any ideas? I am on macOS 10.14, Qt version 5.12.1

sassanh commented 5 years ago

Hi @Jerry-Ma,

Latest version I checked qnvim with is 4.8.2 (worked both in Ubuntu 18.10 and macOS 10.14). I'll check QtCreator 4.9 this weekend. Meanwhile it'll be great if you could see it's working in 4.8.2 on your machine.

I can think of this things:

Observation 1: Run the built QTC (run my installed QTC version (also 4.9.0-rc1) results in the identical behavior): A dialog pops up saying the dependencies (Core and TextEdit) is not found, qnvim plugin is not loaded.

This error shouldn't be related with qnvim, Code and TextEdit are internal plugins of QTC. Are you sure you checked out 4.9.0-rc1 tag in QTC code base? These kind of errors raise when there's a version mismatch.

Observation 2: Copy the libCore.dylib and libTextEdit.dylib to the same folder as the plugin (~/Libarary ...), run QTC: The program fails to start.

You shouldn't need to copy libCore.dylib and libTextEdit.dylib (internal plugins) of a built QTC to a location that is read by official QTC. In the process of installing qnvim you only need to copy its own plugin to ~/Library/.... Otherwise it'll potentially cause version mismatch issues.

Jerry-Ma commented 5 years ago

Thanks for the reply.

I double checked the versions and they do match. In particular, when I run the built-from-source QTC, whose build tree is used to build qnvim , I till get the missing dependencies error dialog.

Just to make sure, I also installed Qt 10.12.2, which is the SDK that is used to build the official QTC. I compiled everything using this Qt version but still get the same issue.

sassanh commented 5 years ago

Are you able to run your compiled QTC without qnvim? (random question until I get the time to test it on my machine, in hopes that you can run it as soon as possible.)

Jerry-Ma commented 5 years ago

Yes. My compiled QTC runs normally.

sassanh commented 5 years ago

@Jerry-Ma it should be fixed now.

Jerry-Ma commented 5 years ago

@sassanh Thank you very much for investigate it. Unfortunately it still shows up the same dependency could not load error. I guess someday I'll try do it with older version of the QTC, just to see if it is bound to 4.9.x only or it is due to my build environment.

sassanh commented 5 years ago

@Jerry-Ma I'm wondering why it doesn't work for you, it works here. If you have the time we can work on it. First step would be to give me an screen shot of the error dialog (or copy the error text in case it's seen in terminal.)

Jerry-Ma commented 5 years ago
Screen Shot 2019-04-22 at 11 50 27 Screen Shot 2019-04-22 at 11 49 12 Screen Shot 2019-04-22 at 11 48 24 Screen Shot 2019-04-22 at 11 48 08 Screen Shot 2019-04-22 at 11 47 23 Screen Shot 2019-04-22 at 11 47 00
Jerry-Ma commented 5 years ago

Please see the attached screenshots. Thank you!

sassanh commented 5 years ago

Thanks, it depends on version 4.9.82 of the internal plugins, I think it's because qnvim is build against 4.9.0-rc1 or 4.9.0-beta or things like that, and not 4.9.0. You have screenshots showing your qt-create source directory is on 4.9.0 but I guess your build is not a fresh build on 4.9.0. I think you pulled 4.9.0 and then went into the build directory of Qt Creator and ran build again on an already built directory. You need to first make clean that directory (I'd even delete the build directory altogether) and build from scratch. I usually do it over night because it takes so long.

So my suggestion is:

  1. Delete build directory of Qt Creator
  2. Make sure it's on 4.9.0 (just like your screenshots show)
  3. Build it
  4. make clean on build directory of qnvim
  5. Build qnvim
  6. Run Qt Creator

I hope it works for you this time.

Jerry-Ma commented 5 years ago

@sassanh Thank you very much for the insight. After cleanup everything and re-compile, now I am able to get nvim inside QTC, great.

However, there is still one problem: If I run the macOS app Qt Creator.app, as soon as I do anything related to QNVIM, the program crashes. See attached crash report. crash.txt

If I go into the Qt Creator.app directory and manually call the executable there /Applications/Qt/Qt Creator.app/Contents/MacOS/Qt Creator, everything works fine.

sassanh commented 5 years ago

If I go into the Qt Creator.app directory and manually call the executable there /Applications/Qt/Qt Creator.app/Contents/MacOS/Qt Creator, everything works fine.

I'm glad you were able to make it work for you. I'm sorry for all the inconveniences, most of it is due to the fact that qnvim is a separate plugin, if for example FakeVim wasn't delivered with Qt Creator and you had to compile it separately you'd probably faced same problems for it too (mismatching versions, etc).

I'll try to update installation instructions in README.md based on the issues reported to minimum this inconveniences.

However, there is still one problem: If I run the macOS app Qt Creator.app, as soon as I do anything related to QNVIM, the program crashes. See attached crash report.

Running macOS on my laptop is a bit tricky (It doesn't work with my HDMI port so I have to connect a VGA monitor and the VGA monitor is packed in my store. But I'll try to do it in coming days.

Meanwhile I guess it may be an environment variable issue. To check this you can run 2 instances of Qt Creator, one by running Qt Creator.app and anotehr by running Qt Creator.app/Contents/MacOS/Qt Creator and then open a project without interacting with it (so that it doesn't crash) then go to Projects tab and compare Build Environment in both instances:

image

For easier comparison you can consider clicking on Open Terminal and running env > /tmp/qtc-env-1 in the opened terminal for one instance and env > /tmp/qtc-env-2 in the terminal of the other instance and compare them with diff /tmp/qtc-env-1 /tmp/qtc-env-2

Jerry-Ma commented 5 years ago

You are totally correct about the env.

If I lunch QTC from a terminal using either open Qt Creator.app or directly the executable, everything works fine, but if I click the QTC icon on my dock , it crashes upon using QNVIM

The open terminal button for some reason does not work for me, so I cannot dump the list of env vars easily, instead I just attach some screenshots.

One obvious work around is to fix my macOS so that it loads the .bashrc I used. I am trying to make this option work right now.

If you have better way please let me know.

This is launched from terminal:

Screen Shot 2019-04-30 at 12 21 01 Screen Shot 2019-04-30 at 12 21 11 Screen Shot 2019-04-30 at 12 21 58

Then launched from system Gui (the Dock):

Screen Shot 2019-04-30 at 12 23 17
sassanh commented 5 years ago

Considering you said that it's working for you when you open it in terminal, it seems like the issue is not related to qnvim, we can create another issue for improving documentation or bootstrapping to ease the setup process for developers, but I think the main issue here is resolved, please feel free to reopen.