-
-
Notifications
You must be signed in to change notification settings - Fork 594
Instructions_for_compilation_under_Linux
You can always ask for help at discussions.
- You will need all the dependencies as described at what you need, below.
- Then you need to download source code, as described at downloading source code
- Your source code after unpacking should look like described at source code layout
-
cd
/home/user/projects/sqlitestudio/scripts/linux
-
compile.sh
- If you want to use your custom Qt version (not the default one used by straing 'qmake' command), then pass the full path to your custom
qmake
as an argument tocompile.sh
script, like:compile.sh
/opt/Qt/5.x.x/bin/qmake
- This script may ask you few questions (like how many CPU cores would you like to use for compilation), so answer them.
- After questions are answered, compilation will start and will take couple of minutes, maybe more, depending on computer performance.
- If you want to use your custom Qt version (not the default one used by straing 'qmake' command), then pass the full path to your custom
- When compilation is finished you will want to create a ready to use, runnable disribution. Run
create_portable.sh
- Again, if you want to use custom Qt installation, pass path to its
qmake
as an argument to this script. - This will take a while and in the end will print:
- Again, if you want to use custom Qt installation, pass path to its
Portable distribution created at: /home/user/projects/sqlitestudio/output/portable/SQLiteStudio
That's it. You can copy /home/user/projects/sqlitestudio/output/portable/SQLiteStudio
directory to wherever you like and then delete whole /home/user/projects/sqlitestudio
. You don't need it anymore.
- Get a Qt library
- Download SQLiteStudio sources and plugins, see downloading source code.
- Setup source directories like described here: source code layout
- Create and go to directory where you want the output files to be created and call:
qmake
path/to/SQLiteStudio3/project/directory
- Then call:
make
- Repeat 2 previous steps for Plugins directory.
- Binaries can be found in
../output
. Enjoy ;)
If you're running Linux like Ubuntu, Fedora, Mint, or similar, be aware that all dependencies will require a *-dev package, obviously, so C/C++ headers are available for compilation.
- gcc - 4.8 or later (SQLiteStudio project uses C++11 standard) - all Linux distributions provide it.
-
Qt 5.12 or later (required Qt modules: core, gui, widgets, script, network, xml, svg, uitools, printsupport) - it's usually installed in most of popular Linux distributions, just make sure to have at least version 5.3 (
qmake
--version
) - readline - for Command Line Interface only. This is available in most Linuxes. Compilation of CLI can be disabled. Click here for more details.
-
tcl - dependency for ScriptingTcl plugin (optional - you can disable compiling ScriptingTcl by editing the
Plugins.pro
file). You get it in most distributions by default, or you can install the ActiveTcl distribution.
The source code can be downloaded from the official download page: http://sqlitestudio.pl/?act=download
Alternatively you can download a current development source code from GitHub..
- Main source code (the application) and standard plugins:
git clone https://github.com/pawelsalawa/sqlitestudio.git sqlitestudio
Remember, that this is unstable code, being developed per daily basis.
bash-4.2$ pwd
/home/user/projects/sqlitestudio
bash-4.2$ tree -L 2
.
|-- Plugins
| |-- Plugins.pro
| |-- DbSqlite2
| `-- SqlExport
`-- SQLiteStudio3
|-- SQLiteStudio3.pro
|-- Tests
|-- coreSQLiteStudio
|-- dirs.pri
|-- guiSQLiteStudio
|-- plugins.pri
|-- sqlitestudio
|-- sqlitestudiocli
`-- utils.pri
8 directories, 5 files
During compilation the "output" directory will be created, just next to SQLiteStudio3 and Plugins. It will contain compilation objects in "build" subdirectory and the final executables in "SQLiteStudio" subdirectory.
You need to prepare "build directory" for output files:
cd /home/user/projects/sqlitestudio
mkdir output
cd output
mkdir build
cd build
Project is based on Qt framework, so each project (main, plugins) will basically require 2 steps (don't execute them like this yet, keep reading, we will execute them later, but with some arguments):
qmake
make
Note, that if you have multiple Qt versions installed on your system, you will need to make sure which qmake
your running. Test it:
qmake --version
If it's not the one you want to build with, then you need to type full path to the qmake you want, for example:
/opt/myQtVersion/bin/qmake
Some plugins might depend on some external libraries. If dependency headers and libraries are in unusual directories, you will have to provide those directories in a standard manner for qmake
, for example:
qmake "INCLUDEPATH += /my/custom/path/include" "LIBS += -L/my/custom/path/lib"
Don't execute it yet. This is just an example of additional parameters for qmake
that you might need later on.
We will apply what we learned from above:
$ pwd
/home/user/projects/sqlitestudio/output/build
$ qmake ../../SQLiteStudio3
$ make
That's it! Compilation will start. Compilation process will produce 2 kinds of output files - temporary build files (makefiles, c++ object files, etc) in /home/user/projects/sqlitestudio/output/build
and output executables and libraries in /home/user/projects/sqlitestudio/output/SQLiteStudio
.
To force portable distribution under Linux/Unix you have to add one more option when executing qmake
:
$ qmake "CONFIG += portable" .....
This applies for both the application and plugins compilation.
Portable dependencies distribution: SQLiteStudio has couple of dependencies which will have to be shipped together with the portable distribution in order for the application to work. All those dependencies have to be copied into the output directory, where the SQLiteStudio application was created. See List of portable dependencies which you have to copy.
Files in the secondary directory are the subject of interest. You have a working application binary there.
$ pwd
/home/user/projects/sqlitestudio/output/build
$ mkdir Plugins
$ cd Plugins
and then we go:
$ qmake ../../../Plugins
$ make
That's all. Plugin binary will be placed in /home/user/projects/sqlitestudio/output/SQLiteStudio/plugins
If you don't want to compile some plugin (for example DbSqlite2, because you don't have its required dependency), then just edit Plugins.pro
file and remove it from the list.
For each plugin you will need to add one build directory more, so it has it's own:
$ pwd
/home/user/projects/sqlitestudio/output/build
$ mkdir MyPlugin
$ cd MyPlugin
and then we go:
$ qmake ../../../MyPlugin
$ make
You have to repeat the same steps for each plugin directory.
This steps does the final package building or installing:
To build Portable distribution package go to scripts/linux
directory and run create_portable.sh
. If you'd like to use custom Qt installation, please pass full path to its qmake
as an argument to the script.
In case of Unix-like application distribution you will want to install everything in the installation path, by calling in the build
and also in build/Plugins
directory:
$ make install
You might want to provide paths for headers and libraries that the project depends on (for SQLite library for example). Here's how you do it:
-
For headers:
qmake ../../SQLiteStudio3 "INCLUDEPATH += /path/to/includes/dir"
-
For libraries:
qmake ../../SQLiteStudio3 "LIBS += /path/to/libraries/dir"
You can pass additional flags either to qmake
if you want to define some compile-time values of the application. Here are flags and what do they mean:
PLUGINS_DIR=/path/to/plugins | Additional directory to look up for plugins. |
ICONS_DIR=/path/to/icons | Additional directory to look up for icons. |
FORMS_DIR=/path/to/forms | Additional directory to look up for *.ui files (forms used by plugins). |
Example of how to do it:
qmake "DEFINES += PLUGINS_DIR=/usr/lib/sqlitestudio" "DEFINES += ICONS_DIR=/usr/share/sqlitestudio/icons" \
"DEFINES += FORMS_DIR=/usr/share/sqlitestudio/forms"
If you have multi-core CPU, you can speed up compilation by passing "-j " option to make, where is number of cores you want to use, for example:
make -j 4
Since version 3.0.6 automatic updates are compiled always when the portable distribution is being compiled (and only then). Otherwise automatic updates are disabled.
Before 3.0.6:
Prior to version 3.0.6 automatic updates were enabled by default and could be disabled by flag NO_AUTO_UPDATES
passed to qmake:
qmake "DEFINES += NO_AUTO_UPDATES"
When compiling Unix-like application distribution (default under Linux) you may want to specify where the libraries are installed and where binaries are installed. You can do it by passing additional options to qmake:
qmake LIBDIR=/opt/lib BINDIR=/opt/bin
By changing LIBDIR
you are also changing a default path for PLUGINS_DIR
defined at Compile-time directories definition, so the plugins dir will be a sqlitestudio
subdirectory in LIBDIR
, unless you overwrite PLUGINS_DIR
by your custom path.
It's possible to link DbSqliteCipher and DbSqliteWx plugins with appropriate SQLCipher and wxSQLite3 libraries provided by system. This is a common practive under unix systems to re-use shared libraries.
DbSqliteCipher
To link dynamically with system-provided SQLCipher use qmake like this, when executing it for Plugins.pro:
/path/to/qmake "SQLCIPHER_LIB=-lsqlcipher" path/to/Plugins.pro
This will exclude sqlcipher.c from compilation and will link against system library.
DbSqliteWx
To link dynamically with system-provided wxsqlite3 use qmake like this, when executing it for Plugins.pro:
/path/to/qmake "WXSQLITE_LIB=-lwxcode_gtk2u_wxsqlite3-3.0" path/to/Plugins.pro
This will exclude wxsqlite3.c (and other generic wxsqlite code) from compilation and will link against system library.
Answer: Things to check out:
- Make sure you have required version of Qt (see dependencies at the begining of this document).
- Make sure that you used
qmake
from the correct Qt installation. - If the error is about sqlite symbol, see if you have sqlite header and library available to the compiler and if the sqlite is in required version (see dependencies at the begining of this document).