FakeVim icon indicating copy to clipboard operation
FakeVim copied to clipboard

FakeVim doesn't work?

Open linxd5 opened this issue 8 years ago • 15 comments

Hello, My ReText version is 5.2.1 (using PyMarkups 0.6.1), and FakeVim doesn't work ~ below is my configuration file:

[General] autoSave=true highlightCurrentLine=true previewState=true restorePreviewState=true saveWindowGeometry=true spellCheck=true useFakeVim=true useWebKit=true windowGeometry="@ByteArray(\x1\xd9\xd0\xcb\0\x2\0\0\0\0\x3\xe\0\0\0\xef\0\0\a\xa1\0\0\x4;\0\0\x3\x18\0\0\x1\x15\0\0\a\x97\0\0\x4\x31\0\0\0\0\0\0\0\0\a\x80)"

Thank you~

linxd5 avatar Nov 04 '15 06:11 linxd5

The configuration file is from ReText and doesn't have anything to do with FakeVim library.

As mentioned in retext-project/retext#162, FakeVim library and Python bindings need to be installed. Unfortunately there is currently no package to make this easy.

hluk avatar Nov 05 '15 08:11 hluk

I have installed Python2 as well as Python3 in my Ubuntu15.04, and build the FakeVim as mentioned in README.md (qmake; make) There are no errors occur in console, but I can't use FakeVim in ReText; Does it has any additional instructions in order to use FakeVim in ReText while installing FakeVim? Or how to "bindings" Python to FakeVim library as mentioned above ?

linxd5 avatar Nov 05 '15 08:11 linxd5

I cannot test this currently but the whole build process is something like the following.

# From FakeVim repo ...
# Build FakeVim shared library.
make
qmake

# Build Python bindings (this also runs test application).
PYTHON=python3 ./python/build.sh

# Tell Python apps where to find the bindings.
export PYTHONPATH="$PWD/build:$PYTHONPATH"

# Run ReText.

If you have trouble building Python bindings read python/README.md.

Maybe you can run make install for the library and the bindings so you won't have to set the environment variables but I'm not sure if the qmake build files support this now.

hluk avatar Nov 05 '15 09:11 hluk

I get an error while I run the command: python3 ./build.sh

➜ python python3 ./build.sh File "./build.sh", line 10 export QMAKE=${QMAKE:-qmake} ^ SyntaxError: invalid syntax

I don't understand why using python3 to execute shell script~

so I run the command this way: ./build.sh and the get the error as follow:

python: can't open file '/home/FakeVim-master/python/python/configure.py': [Errno 2] No such file or directory

I vim the build.sh, in the comment it tell me to

Example (see variable exports below):

QMAKE=qmake-qt4 PYTHON=python2 ./python/build.sh

I run the command QMAKE=qmake; PYTHON=python3; ./build.sh, but it fails again just as above~

linxd5 avatar Nov 05 '15 09:11 linxd5

Sorry, yes, it should be PYTHON=python3 ./build.sh (comment above fixed).

hluk avatar Nov 05 '15 09:11 hluk

The project path seems to be currently wrong too so you should use:

PROJECT_PATH="$PWD/.." PYTHON=python3 ./build.sh

hluk avatar Nov 05 '15 09:11 hluk

The structure of this project is like this:

------------------- fakevim
|
------------------- python
                      |
                      ----------------------- fakevim.sip
                      |
                      ----------------------- build.sh
                      |
                      ----------------------- configure.py
                      |
                      ----------------------- test.py

However, the content in build.sh in as follow:

export PROJECT_PATH=${PROJECT_PATH:-"$PWD"}
export LIBRARY_PATH=${LIBRARY_PATH:-"$PROJECT_PATH/fakevim"}
export SIP_FILE_PATH=${SIP_FILE_PATH:-"$PROJECT_PATH/python/fakevim.sip"}
...
"$PYTHON" "$PROJECT_PATH/python/configure.py"
...
"$PYTHON" "$PROJECT_PATH/python/test.py"

So I think the build.sh file need to be placed at the root of the project, not under the python directory;

I run the command mv build.sh ../; ./build.sh , it get the error as below:

/usr/bin/ld: cannot find -lfakevim
collect2: error: ld returned 1 exit status
Makefile:161: recipe for target 'FakeVim.so' failed
make: *** [FakeVim.so] Error 1

linxd5 avatar Nov 05 '15 10:11 linxd5

You shouldn't move the script. Just set PROJECT_PATH or run the script from main repo directory (I've updated the commands to build the library and bindings).

hluk avatar Nov 05 '15 11:11 hluk

I follow the way, but get the following error:

/usr/bin/ld: cannot find -lfakevim
collect2: error: ld returned 1 exit status
Makefile:161: recipe for target 'FakeVim.so' failed
make: *** [FakeVim.so] Error 1

I run the command apt-cache search libfakevim-dev but get nothing;

Then I find the lfakevim in Makefile under the build directory, get nothing again;

I don't know where the lfakevim libray is generated ??

linxd5 avatar Nov 05 '15 11:11 linxd5

And if you leave out setting LD_LIBRARY_PATH? I've tried it now and it seems to work without it (the build script takes care of passing correct path to bindings generator).

hluk avatar Nov 05 '15 11:11 hluk

I move to this step: PYTHON=python3 ./python/build.sh, and get the error:

+ export PYTHONPATH=/home/panjinbo/software/FakeVim-master/build
+ PYTHONPATH=/home/panjinbo/software/FakeVim-master/build
+ python3 /home/panjinbo/software/FakeVim-master/python/test.py
python3: siplib.c:8505: sip_api_can_convert_to_type: Assertion `(((td)->td_flags & 0x0007) == 0x0000) || (((td)->td_flags & 0x0007) == 0x0002)' failed.
./python/build.sh: line 39: 30588 Aborted                 (core dumped) "$PYTHON" "$PROJECT_PATH/python/test.py"

linxd5 avatar Nov 05 '15 12:11 linxd5

Whoa, looks like bug in SIP (the bindings generator).

You can remove build subdirectory and try again -- perhaps it'll help. Also make sure that qmake is for Qt5 (qmake --version) and use the same for compiling library and building bindings.

hluk avatar Nov 05 '15 12:11 hluk

python3: siplib.c:8505: sip_api_can_convert_to_type: Assertion `(((td)->td_flags & 0x0007) == 0x0000) || (((td)->td_flags & 0x0007) == 0x0002)' failed.

This usually means you are trying to run code compiled against old sip with new sip. We have got the same assertion with QScintilla packages in Ubuntu, and a rebuild fixed that. Such incompatibility was undocumented and could be treated as a sip bug, though.

mitya57 avatar Nov 05 '15 17:11 mitya57

I feel confused when I rebuild PyQt-gpl-5.5.1 with sip-4.16.3 and the errors occur:

Error: This version of PyQt5 requires sip 4.16.6 or later.

In order to use FakeVim in ReText , we need to install python, python-markups, sip, pyqt5, fakevim, retext. And I install

  • python-3.4.3
  • markups-0.6.3
  • sip-4.16.3
  • pyqt5-5.5.1
  • fakevim-master
  • retext-master

I don't know what's the right version of these projects, respectively, or may be many ??

linxd5 avatar Nov 06 '15 03:11 linxd5

@linxd5 In retext-project/retext#162, you mentioned that you are using Ubuntu 15.04. Why can't you then just use the distro versions of sip and PyQt? Ubuntu 15.04 has sip 4.16.6 which is newer than your 4.16.3.

mitya57 avatar Nov 06 '15 19:11 mitya57