Shira-3749 / rstpad

Standalone reStructuredText editor with live preview (native app)
MIT License
52 stars 7 forks source link

How to build the project? (on Linux) #1

Closed olibre closed 7 years ago

olibre commented 7 years ago

Thank your for your cross-platform C++ alternative to reText. 😃 But I do not understand how to compile it 😞

I have customized the file rstpad.local.pro on my Linux Fedora 26:

# Python
PYTHON_LINK = -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic
PYTHON_INCLUDE_PATH = /usr/include/python2.7
PYTHON_SYS_PATH = /usr/lib/python2.7/site-packages 

# Web engine
DEBUG_WEBENGINE_REMOTE_PORT = 0
Shira-3749 commented 7 years ago

Opening the rstpad.pro file in Qt Creator should do it.

I didn't try to build it from the command line (as I've used Qt Creator) but this could help:

https://stackoverflow.com/questions/19206462/compile-a-qt-project-from-command-line

olibre commented 7 years ago

Oops, it's my fault, I had disabled Qmake support last year! 😕

This is what I had in menu Help > About Plugins...

[x] AutotoolsProjectManager
[x] CMakeProjectManager
[x] GenericProjectManager
[ ] QbsProjectManager
[ ] QmakeAndroidSupport
[ ] QmakeProjectManager
[x] QtSupport

Therefore, I have enable all Qt plugins and many more in other sections.

My rstpad.local.pro content is:

# Python
PYTHON_LINK = -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic
PYTHON_INCLUDE_PATH = /usr/include/python2.7
PYTHON_SYS_PATH = /usr/lib/python2.7/site-packages 

# Web engine
DEBUG_WEBENGINE_REMOTE_PORT = 0 

I proceed as the following:

  1. Start Qt Creator 4.2.2 on Fedora 26 (Linux)
  2. Enter menu File > Open File or Project...
  3. Select file rstpad.pro

Now I can open the project 😃

To fix the following error Unknown module(s) in QT: webenginewidgets, I have installed qtwebengine using sudo dnf install qt5-qtwebengine-devel.

23:12:38: Running steps for project rstpad...
23:12:38: Configuration unchanged, skipping qmake step.
23:12:38: Starting: "/usr/bin/make" 
/usr/bin/qmake-qt5 -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug -o Makefile ../rstpad/rstpad.pro
Project WARNING: Not deplying Python libraries - platform not supported
Project ERROR: Unknown module(s) in QT: webenginewidgets
make: *** [Makefile:186: Makefile] Error 3
23:12:38: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project rstpad (kit: Desktop)
The kit Desktop has configuration issues which might be the root cause for this problem.
When executing step "Make"
23:12:38: Elapsed time: 00:00.

Success the project build without any error 👍

I run the application using command line:

../build-rstpad-Desktop-Debug/app/RSTPad

I open a file *.rst but I have on the right pane window an error message

ImportError: No module named docutils.core

The package python2-docutils was already installed on my computer:

$ ls -gG /usr/lib/python2.7/site-packages/docutils
total 744
-rw-r--r--. 1  7564 Dec  9  2016 __init__.py
-rw-r--r--. 2  4444 Feb 11 20:04 __init__.pyc
-rw-r--r--. 2  4444 Feb 11 20:04 __init__.pyo
-rw-r--r--. 1  1589 Jul 11  2012 _compat.py
-rw-r--r--. 2  1654 Feb 11 20:04 _compat.pyc
-rw-r--r--. 2  1654 Feb 11 20:04 _compat.pyo
-rw-r--r--. 1 29426 Jun 25  2012 core.py
-rw-r--r--. 1 23765 Feb 11 20:04 core.pyc
-rw-r--r--. 1 23507 Feb 11 20:04 core.pyo
-rw-r--r--. 1  3959 Jan 19  2012 examples.py
-rw-r--r--. 2  3767 Feb 11 20:04 examples.pyc
-rw-r--r--. 2  3767 Feb 11 20:04 examples.pyo
-rw-r--r--. 1 35434 Jan  1  2013 frontend.py
-rw-r--r--. 2 30315 Feb 11 20:04 frontend.pyc
-rw-r--r--. 2 30315 Feb 11 20:04 frontend.pyo
-rw-r--r--. 1 17054 Apr 12  2015 io.py
-rw-r--r--. 1 15754 Feb 11 20:04 io.pyc
-rw-r--r--. 1 15529 Feb 11 20:04 io.pyo
drwxr-xr-x. 2  4096 Jul  9 01:18 languages
-rw-r--r--. 1 77359 Feb 16  2015 nodes.py
-rw-r--r--. 1 94940 Feb 11 20:04 nodes.pyc
-rw-r--r--. 1 94480 Feb 11 20:04 nodes.pyo
drwxr-xr-x. 3  4096 Jul  9 01:18 parsers
drwxr-xr-x. 2  4096 Jul  9 01:18 readers
-rw-r--r--. 1 57572 Jun 25  2012 statemachine.py
-rw-r--r--. 1 56711 Feb 11 20:04 statemachine.pyc
-rw-r--r--. 1 56294 Feb 11 20:04 statemachine.pyo
drwxr-xr-x. 2  4096 Jul  9 01:18 transforms
drwxr-xr-x. 3  4096 Jul  9 01:18 utils
drwxr-xr-x. 9  4096 Jul  9 01:18 writers

Do you have any idea to fix this python module import error?

Shira-3749 commented 7 years ago

You'll need to copy the contents of the PYTHON_SYS_PATH directory to a directory called "libs" (in the application build directory, next to the executable).

The filesystem structure should look something like this:

Normally, this happens automatically during the build process, but I've only defined it for Windows and OS X builds so far. You can either copy the files manually or add another else block to rstpad.pro :slightly_smiling_face:

olibre commented 7 years ago

Thanks for your help, I have created a directory and created links:

cd build-rstpad-Desktop-Debug/app
mkdir libs
ln -s /usr/lib/python2.7/site-packages/* .
ln -s /usr/lib/python2.7/* .

However I have the error:

ImportError: No module named unicodedata
  File "/home/olibre/rst/pad/build-rstpad-Desktop-Debug/app/libs/docutils/core.py", line 20, in <module>
    from docutils import frontend, io, utils, readers, writers
  File "/home/olibre/rst/pad/build-rstpad-Desktop-Debug/app/libs/docutils/frontend.py", line 41, in <module>
    import docutils.utils
  File "/home/olibre/rst/pad/build-rstpad-Desktop-Debug/app/libs/docutils/utils/__init__.py", line 17, in <module>
    import unicodedata

There are similar errors:

However I have finally fixed the issue 😄 and I can play with a beautiful and working RSTPad 😉

The fix:

cd build-rstpad-Desktop-Debug/app/libs
ln -s $HOME/.local/lib/python2.7/site-packages/* .
ln -s /usr/lib64/python2.7/lib-dynload/* .

I am to tired tonight to provide more testing in order to improve rstpad.pro.

Thank you -- olibre