Sigil-Ebook / Sigil

Sigil is a multi-platform EPUB ebook editor
GNU General Public License v3.0
5.94k stars 579 forks source link

Is there any basic tutorial how to compile Sigil from source under Windows? #195

Closed sdjskr closed 8 years ago

sdjskr commented 8 years ago

Hi, I'm a beginner on open source world. Basically, I'm not talking about some issues at all.

I can compile my own C++ code in VS 2015. but, I have little knowledge about compiling open source code. I can't find even a project file of that.

Anyway, I'd like to compile Sigil 0.9.4 version from source. My system is Windows 10 64bit, and Qt 5.6.0 is installed. I've been looking for any basic guide for that but I haven't found yet.

I have downloaded a source code zip file from the link https://github.com/Sigil-Ebook/Sigil/releases

And I have no idea what's the difference between Sigil-0.9.4-Code.zip and Source code (zip). Which one should I download to compile?

Intuitively, I used 'importing project' in Qt but I get message 'no rule to make target all. stop' Any instructions for that?

Thank you in advance!!!

dougmassay commented 8 years ago

Unfortunately, there's not much documentation for building Sigil on Windows right now. It IS high on my list of priorities, though. I'll leave this issue open to remind me to keep at it.

Quickly though: Sigil is pretty-much currently locked into VS 2013. This is because the compiler versions of Qt5 and Sigil have to match. And there's currently no precompiled Windows Qt5 builds for VS 2015 (nor is compiling Qt5.4--or even 5.5--with VS 2015 supported, or even remotely easy for those inclined to attempt it). Rumor has it that Qt5.6 will be VS2015-ready, but by then, the Windows Qt5.6 precompiled binaries may not be compatible with Sigil. So it's VS2013 for the time being.

There's an "Install.md" file in the docs folder of Sigil's source that's woefully outdated, but it may give a general idea. CMake (3.0+) is used to generate nmake makefiles (or IDE projects files) that VS 2013 can then use to build Sigil.

Take a peek at that document and give me a chance to try and knock together some up-to-date instructions. But if you're committed to VS 2015, you may have a bit of a wait before building Sigil with it will be supported.

sdjskr commented 8 years ago

@dougmassay

Hi! Thank you for the detailed information.

I have read the document you're referring to. As you said, it just gives me a general idea. I wanted a step by step manual for beginners.

So, as of now, are you saying there is no other way to compile Sigil on Windows without VS 2013? I thought I could compile it in Qt that is installed on my Windows system.

If it's not possible, there seems to be no way but to install VS 2013.

dougmassay commented 8 years ago

You could compile it with the Qt you have on your system IF (and only if) the Qt installed on your system was compiled with VS 2015 (and had all the necessary development headers and tools), as well. The problem is, there are no versions of Qt 5.4 or 5.5 floating around that were compiled with VS 2015. You could potentially compile Qt yourself, but as the versions available that will work with Sigil don't support being compiled with VS 2015, you'd have to manually patch Qt's source to do so (which by itself could be prohibitively daunting). So yes; for all practical purposes, VS 2013 is currently the only real choice for building Sigil on Windows right now.

I do plan to post some detailed instructions, but I simply haven't found the time. That--and to be perfectly honest--there hasn't been that many people who expressed an interest in hobby-compiling with the necessary Microsoft development tools. The cost of a capable build environment was always too prohibitive until recently. The Community versions of Visual Studio are changing that now, though. Which is a good thing, so I need to get the instructions out there.

But the entire "C++ applications needing to be built with the same compiler version that the C++ DLLs it needs to access were built with" thing is entirely of their (Microsoft's) own making. It makes things (especially cross-platform projects) a lot more "fiddly" than most opensource developers are willing to mess with. But I need to make sure those who are interested have the details necessary to get started.

Quaturn commented 8 years ago

Visual Studio 2013 Community edition Qt from here: https://download.qt.io/archive/online_installers/2.0/qt-unified-windows-x86-2.0.3-online.exe Python 3.4.4 Cmake 3.5.0

Visual Studio 2013: Don't forget to install Visual Studio 2013. (I really do not know if Visual Studio 2015 works)

Cmake https://cmake.org/files/v3.5/cmake-3.5.0-win32-x86.msi

Inno Setup (isetup-5.5.8-unicode.exe) Install it and also do not forget to check Install Inno Setup Processor in the installer.

In Qt->Qt 5.5 check the following: msvc2013 64-bit msvc2013 32-bit msvc2012 32-bit You can most likely leave the rest as it is.

Python 3.4.4 64-bit https://www.python.org/downloads/release/python-344/ Just install the damn thing and make sure that it is in the path. (I am using Rapid Environment Editor for that (free of charge soft))

Open VS2013 x64 Cross Tools Command Prompt and do following (following is not my work):

x64 PATH=%PATH%;"C:\Program Files (x86)\CMake";"C:\Program Files (x86)\Inno Setup 5";"C:\Qt\5.5\msvc2013_64\bin" mkdir build_64 && cd build_64 cmake -G "NMake Makefiles" -DWIN_INSTALLER_USE_64BIT_CRT=1 -DFORCE_BUNDLED_COPIES=1 -DQt5_DIR="C:\Qt\5.5\msvc2013_64\lib\cmake\Qt5" -DCMAKE_BUILD_TYPE=Release .. nmake nmake makeinstaller

x86 PATH=%PATH%;"C:\Program Files (x86)\CMake";"C:\Program Files (x86)\Inno Setup 5";"C:\Qt\5.5\msvc2013\bin" mkdir build_32 cd build_32 cmake -G "NMake Makefiles" -DFORCE_BUNDLED_COPIES=1 -DQt5_DIR="C:\Qt\5.5\msvc2013\lib\cmake\Qt5" -DCMAKE_BUILD_TYPE=Release .. nmake nmake makeinstaller

dougmassay commented 8 years ago

The only things I see missing are the extra Python modules necessary to run Sigil (and those necessary to ensure a complete plugin framework): six, lxml (chardet, cssselect, cssutuls, html5lib, Pillow, and regex).

and...

For building the redistributable msi installer, two runtime redistributables must be placed in the "installer" directory of the Sigil source. The one for vs2013 -- renamed to vcredist2013_x(86|64).exe. And the vs2010 redistributable -- for Python 3.4 -- renamed to vcredist2010_x(86|64).exe.

sdjskr commented 8 years ago

@Quaturn

Hi Quanturn!!!!

Thank you for taking your time to describe it specifically, even by including the link for software that is required. But, still having some error issues. I'm struggling to solve the problem, now it's my share.

I think @dougmassay is right, I started to compile but failed because of not having the extra Python modules he is referring to. Should I download the modules, and place them in the installer folder too?

Anyway, I'm starting to walk!!!

By the way, the ultimate aim I'm trying to recompile Sigil from source is to find and correct some issue on some strange cursor behavior. The blinking cursor disappears as soon as I press Enter when typing Korean.

I thought I could compile in Qt Creator only if could import the project property. Also getting some message ":-1: error: No rule to make target 'all'. Stop."

I have no idea why I must install VS2013, when Mingw version of Qt also can see the source code. It's quite strange.

As for the issue, I want to rectify, I found some clue in "BookViewPreview.cpp"

// We need to make sure that the Book View has focus, // but just calling setFocus isn't enough because Nokia // did a terrible job integrating Webkit. So we first // have to steal focus away, and then give it back. // If we don't steal focus first, then the QWebView // can have focus (and its QWebFrame) and still not // really have it (no blinking cursor). // We also still need to attempt to GrabFocus even // when shown as a Preview page (even though no cursor // is shown) or else the QStackWidget will explode on // Windows when switching to another tab when it tries // to determine where the previous focus was.

dougmassay commented 8 years ago

I have no idea why I must install VS2013, when Mingw version of Qt also can see the source code. It's quite strange.

Because quite simply put: MingW can't compile Sigil's source code without some major patching/changes. And because Sigil's CMake configurations don't take MingW into account. It's not strange at all.

Regardless ... this venue is not the proper place to discuss building Sigil with a non-supported tool-chain. Nor is it the place for tutorials on HOW to build Sigil. The Issues database is primarily for bug-reports. I'm glad that you're getting closer to success (and I do still plan to get some updated build instructions for Windows out there), but I'm going to close this issue for now.

Sigil's support forums on mobileread.com are a better place for discussions of this sort.

Quaturn commented 8 years ago

Well to be honest I did not needed to install additional modules in Python. For some reason it was enough to just install Python from the before mentioned link and it was compiling without any problems.