2018-06-10

5: Building an Environment for Developing UNO Programs in Linux

<The previous article in this series | The table of contents of this series | The next article in this series>

For developing macros, external UNO programs, and/or UNO extensions in Java, C++, and/or Python.

Topics


About: UNO (Universal Network Objects)
About: LibreOffice
About: Apache OpenOffice
About: The Java programming language
About: C++
About: The Python programming language

The table of contents of this article


Starting Context



Target Context


  • The reader will know how to build an environment for developing UNO programs (macros, external UNO programs, and/or UNO extensions) in Linux.

Orientation


An environment for Windows will be built in the next article.

The knowledges of UNO and the basic elements of UNO are required for judging what are required for your environment.

C# and Visual Basic.NET are not covered by this article because a proper Microsoft .NET Framework (not .NET Core or Mono) is required for any C# or Visual Basic.NET UNO program to work (at least, for LibreOffice 6.4.6 and older).

This site uses a text editor and Gradle, not any IDE, and presents reasonable explanations that should be able to be applied to your favorite IDE (if you will).

We will see various sample programs that can be built in this environment, in some future articles.


Main Body

Stage Direction
Here are Hypothesizer 7, Objector 5A, and Objector 5B in front of a computer.


1: What Are (at Least Almost) Absolutely Required?


Hypothesizer 7
Let us clarify what are (at least almost) absolutely required.

By "absolutely required", I mean that they are required whatever your taste is.

For example, any IDE is not absolutely required.

Objector 5A
I absolutely require an IDE!

Hypothesizer 7
That is about your taste, sir.

Anyway, what are absolutely required are conditional on what you are developing.

Objector 5B
Huh? That's an oxymoron!

Hypothesizer 7
Madam, for example, if you are developing a C++ UNO program, a C++ compiler is at least almost absolutely required, but otherwise, it is not.

I said "at least almost" because you could manually compile your C++ source without any compiler, but most probably, you will not.

Objector 5B
"manually"? Do you mean, figuring out the bytes sequence in my head and inputting it into a file with a binary editor?

Hypothesizer 7
For example, yes.

Objector 5B
Who would do such a thing?

Hypothesizer 7
At least theoretically, it is possible.

Furthermore, I may say that a GCC is required although another compiler might not be absolutely impossible, because considering that option does not seem worthwhile.

Objector 5B
What if I want to use a non-GCC compiler?

Hypothesizer 7
Then, please do so at your discretion.

Anyway, these are (at least almost) absolutely required.

ArtifactRequired When
a LibreOffice or Apache OpenOfficein any case
the corresponding LibreOffice SDK or Apache OpenOffice SDKyou develop any UNO datum type
and/or
you develop any C++ UNO program
a JDKyou develop any Java UNO program
a GCCyou develop any C++ UNO program
the corresponding Python-UNO (may be included in the LibreOffice or Apache OpenOffice)you develop any Python UNO program

Objector 5A
. . . I need a Python itself if I develop Python programs, don't I?

Hypothesizer 7
Of course you do, but I did not include it above because it will be automatically installed with the Python-UNO.

Objector 5A
Well, how about versions?

Hypothesizer 7
I can only say that reasonably new versions will probably do.

Objector 5B
"may be included"?

Hypothesizer 7
That depends on the package you use in installing the LibreOffice or Apache OpenOffice; if the package is the Ubuntu 20.04 'libreoffice' package or the '7.0.3 Linux (64-bit) (deb)' or '4.1.8 Linux 64-bit (x86-64) (DEB)' package downloaded from the LibreOffice or Apache OpenOffice download page, it is included.


2: What Is Our Development Environment Like?


Hypothesizer 7
While there are many Linux distributions on which installations depend, here, I can cite only a single Linux distribution. So, if you use a different Linux distribution, you may have to tweak some installations.

As we will install also some non-absolutely-required products (because they are used by some programs introduced in this site), if you do not need some of them, of course, you can skip them.

This is our environment here, as of 2020-11-26.

Platform: Lubuntu 20.04 64-bit with bash 5.0.17

ArtifactUsed for
LibreOffice 6.4.6 or 7.0.3 or Apache OpenOffice 4.1.8developing any UNO program
LibreOffice SDK or Apache OpenOffice SDK (the corresponding version)developing any UNO datum type and developing any C++ UNO program
OpenJDK 11.0.9 or 15.0.1 + OpenJFX 11.0.9 or 15.0.1developing any UNO program (required in order to make Gradle work, even if you do not develop any Java program); OpenJFX is not required if you do not use JavaFX.
Gradle 4.4.1 or 6.7.1developing any UNO program
GCC 9.3.0 + wxWidgets 3.0.4 or 3.0.5 + OpenSSL 1.1.1developing any C++ UNO program; wxWidgets is not required if you do not use it; OpenSSL is not required if you do not use it.
Python-UNO (the corresponding version)developing any Python UNO program
Python (the corresponding version) + mypy (the corresponding version) + wxPython 4.1.0developing any Python UNO program (an external Python is used in this site); mypy is not required if you do not use it; wxPython is not required if you do not use it.
wmctrl 1.07automatically and gracefully shutting down LibreOffice or Apache OpenOffice instances before registering any UNO extension

Objector 5A
. . . "Lubuntu"?

Hypothesizer 7
As it is a variant of Ubuntu, at least almost all the descriptions of this site will apply also to Ubuntu.

Objector 5A
Why are 2 versions cited there for each of most artifacts with "or"?

Hypothesizer 7
In order not to completely depend on the Linux distribution, we will see also some installations that do not use the packages management system of the Linux distribution; the latter of the 2 versions is for installing without using the packages management system.

Objector 5A
. . . What about the IDE?

Hypothesizer 7
We do not use any IDE here.

Objector 5A
. . . Why?

Hypothesizer 7
Because 1st, I do not want my descriptions to depend on any specific IDE; 2nd, typical IDEs are too heavy for my computers; 3rd, I want to use my favorite text editor.

Objector 5A
But your descriptions will depend on Gradle.

Hypothesizer 7
Sir, Gradle appears only when building the project, while the IDE would thrust itself into the whole process. The degrees of intrusion are quite different.

Objector 5A
I need an IDE for sure . . .

Hypothesizer 7
You are very free to use any, but I just point out that as my programs in this site come with Gradle build scripts, they will not be able to be built as they are, without Gradle. Note that my Gradle scripts do not do only usual compiling and linking but also perform UNO specific tasks (for example, compiling UNOIDL files, creating UNO datum types merged files, creating programming-language-specific files from UNO datum types merged files, creating UNO extension files, and registering UNO extensions).

Objector 5A
. . . So?

Hypothesizer 7
As for usual compiling and linking, your IDE will be able to do by just referring to the necessary header files and libraries, but as for UNO specific tasks, you will have to think how you make your IDE perform them.

Objector 5A
. . . What are necessary headers and libraries?

Hypothesizer 7
We will see what have to be referred to by your IDE, for each artifact.

Objector 5A
What is "mypy"?

Hypothesizer 7
As I do not favor so-called "Duck Typing", I use the static types checker for Python.


3: Installing and Configuring Artifacts



3-1: Some Notes


Hypothesizer 7
Below, we will sometimes use the 'bsdtar' command, which allows us to strip the root directory when we expand any ZIP file. That is because although some ZIP files have the root, version directories, I do not want those version directories because they necessitate me to change path settings when their versions are changed.

Objector 5A
Does 'the root, version directory' mean the root directory in any ZIP file, that has the name of the version of the software?

Hypothesizer 7
Yes.

Objector 5A
Not wanting the version directory is just your taste . . .

Hypothesizer 7
I know. . . . However, as my Gradle build scripts have default settings without the version directories, if you retain the version directories, you may have to modify some of the Gradle build scripts.

Objector 5A
Whatever.

Hypothesizer 7
I will just add that 'bsdtar' can be installed on my platform by this command.

Stage Direction
Hypothesizer 7 opens a terminal, and executes this command in the terminal.

@bash Source Code
sudo apt-get install bsdtar

Objector 5A
OK.

Hypothesizer 7
As another note, as I have a habit of not using any space in any directory name, my build scripts have been tested only for directories whose names do not have any space.

Objector 5A
So?

Hypothesizer 7
So, if there is a problem for directories whose names have spaces, you will have to fix some of the Gradle build scripts or change the directory names, or you may prefer not using such directory names from the beginning.

Objector 5A
. . .


3-2: Installing LibreOffice


Hypothesizer 7
We will install LibreOffice. If you are going to use Apache OpenOffice, this will be unnecessary.

The way 1 is through the packages management system: we execute these commands in a terminal (change the latter language pack package as necessary).

Stage Direction
Hypothesizer 7 opens a terminal, and executes some commands in it.

@bash Source Code
sudo apt-get install libreoffice
sudo apt-get install libreoffice-l10n-ja

Hypothesizer 7
On my platform, the former command installs a group of packages that are of LibreOffice.

Objector 5A
"a group of packages"?

Hypothesizer 7
For example, 'libreoffice-script-provider-python', 'libreoffice-script-provider-bsh', and 'libreoffice-script-provider-js' are packages for using Python, BeanShell, and JavaScript respectively in LibreOffice. If your LibreOffice doesn't show menu items for some of those programming languages, the corresponding packages should be missing in your system.

The way 2 is through downloading packages from a Web site: we download an archive file of the deb packages of the main body and an archive file of the deb packages of a 'Translated User Interface' from the LibreOffice download Web page into somewhere ('~/myData/downloadedFiles' in this case), and execute these commands in a terminal (please change the directory paths and the archive file names as necessary).

Stage Direction
Hypothesizer 7 starts a Web browser, downloads some Linux 64-bit deb packages tar.gz files, and executes some commands in the terminal.

@bash Source Code
mkdir -p ~/myData/downloadedFiles/libreOffice
tar -xvzf ~/myData/downloadedFiles/LibreOffice_7.0.3_Linux_x86-64_deb.tar.gz -C ~/myData/downloadedFiles/libreOffice --strip-components=1
tar -xvzf ~/myData/downloadedFiles/LibreOffice_7.0.3_Linux_x86-64_deb_langpack_ja.tar.gz -C ~/myData/downloadedFiles/libreOffice --strip-components=1
sudo dpkg -i ~/myData/downloadedFiles/libreOffice/DEBS/*.deb

Hypothesizer 7
The application has been installed into '/opt/libreoffice7.0'.

What would have to be referred to by your IDE are these.

For Java programming, as Jar files, the 'unoil.jar', 'jurt.jar', 'ridl.jar', and 'juh.jar' files in the 'program/classes' directory in the product directory.

For Python programming, as modules paths, the 'program' directory in the product directory.


3-3: Installing Apache OpenOffice


Hypothesizer 7
We will install Apache OpenOffice. If you are going to use LibreOffice, this will be unnecessary.

As my packages management system does not include Apache OpenOffice, we will install it through downloading packages from a Web site: we download an archive file of the deb packages of the main body and an archive file of the deb packages of a language pack from the Apache OpenOffice download Web page into somewhere ('~/myData/downloadedFiles' in this case), and execute these commands in a terminal (please change the directory paths and the archive file names as necessary).

Stage Direction
Hypothesizer 7 downloads some Linux 64-bit deb packages tar.gz files, and executes some commands in a terminal.

@bash Source Code
mkdir -p ~/myData/downloadedFiles/apacheOpenOffice
tar -xvzf ~/myData/downloadedFiles/Apache_OpenOffice_4.1.8_Linux_x86-64_install-deb_en-US.tar.gz -C ~/myData/downloadedFiles/apacheOpenOffice --strip-components=1
tar -xvzf ~/myData/downloadedFiles/Apache_OpenOffice_4.1.8_Linux_x86-64_langpack-deb_ja.tar.gz -C ~/myData/downloadedFiles/apacheOpenOffice --strip-components=1
sudo dpkg -i ~/myData/downloadedFiles/apacheOpenOffice/DEBS/*.deb

Hypothesizer 7
The packages have been installed into '/opt/openoffice4'.

What would have to be referred to by your IDE are these.

For Java programming, as Jar files, the 'unoil.jar', 'jurt.jar', 'ridl.jar', and 'juh.jar' files in the 'program/classes' directory in the product directory.

For Python programming, as modules paths, the 'program' directory in the product directory.


3-4: Installing LibreOffice SDK


Hypothesizer 7
We will install LibreOffice SDK. If you are going to use Apache OpenOffice or are not going to develop any UNO datum type or any C++ code piece, this will be unnecessary.

The way 1 is through the packages management system: we execute these commands (if you do not need the document, the latter command will be unnecessary) in a terminal.

Stage Direction
Hypothesizer 7 executes some commands in the terminal.

@bash Source Code
sudo apt-get install libreoffice-dev
sudo apt-get install libreoffice-dev-doc

Hypothesizer 7
The way 2 is through downloading a package from a Web site: we download an archive file of the deb package from the LibreOffice download Web page into somewhere ('~/myData/downloadedFiles' in this case), and execute these commands in a terminal (please change the directory paths, the archive file name, and the package name as necessary).

Stage Direction
Hypothesizer 7 downloads the Linux 64-bit deb package tar.gz file, and executes some commands in the terminal.

@bash Source Code
tar -xvzf ~/myData/downloadedFiles/LibreOffice_7.0.3_Linux_x86-64_deb_sdk.tar.gz -C ~/myData/downloadedFiles/libreOffice --strip-components=1
sudo dpkg -i ~/myData/downloadedFiles/libreOffice/DEBS/libobasis7.0-sdk_7.0.3.1-1_amd64.deb

Hypothesizer 7
What would have to be referred to by your IDE are these.

For C++ programming, as header files paths, the 'sdk/include' directory in the product directory; as libraries paths, the 'sdk/lib' directory; as library names, 'uno_cppuhelpergcc3', 'uno_cppu', 'uno_purpenvhelpergcc3', 'uno_salhelpergcc3', and 'uno_sal'.


3-5: Installing Apache OpenOffice SDK


Hypothesizer 7
We will install Apache OpenOffice SDK. If you are going to use LibreOffice or are not going to develop any UNO datum type or any C++ code piece, this will be unnecessary.

As my packages management system doesn't include Apache OpenOffice SDK, we will install it through downloading a package from a Web site: we download an archive file of the deb package from the Apache OpenOffice download Web page into somewhere ('~/myData/downloadedFiles' in this case), and execute these commands in the terminal (please change the directory paths, the archive file name, and the package name as necessary).

Stage Direction
Hypothesizer 7 downloads the Linux 64-bit deb package tar.gz file, and executes some commands in the terminal.

@bash Source Code
tar -xvzf ~/myData/downloadedFiles/Apache_OpenOffice-SDK_4.1.8_Linux_x86-64_install-deb_en-US.tar.gz -C ~/myData/downloadedFiles/apacheOpenOffice --strip-components=1
sudo dpkg -i ~/myData/downloadedFiles/apacheOpenOffice/DEBS/openoffice-sdk_4.1.8-1_amd64.deb

Hypothesizer 7
What would have to be referred to by your IDE are these.

For C++ programming, as header files paths, the 'sdk/include' directory in the product directory; as libraries paths, the 'sdk/lib' directory; as library names, 'uno_cppuhelpergcc3', 'uno_cppu', 'uno_purpenvhelpergcc3', 'uno_salhelpergcc3', and 'uno_sal'.


3-6: Installing and Configuring OpenJDK + OpenJFX


Hypothesizer 7
We will install OpenJDK.

The way 1 is through the packages management system: we execute this command in a terminal.

Stage Direction
Hypothesizer 7 executes a command in the terminal.

@bash Source Code
sudo apt-get install default-jdk

Hypothesizer 7
The way 2 is through downloading an archive file from a Web site: we download an archive file from the OpenJDK download Web page into somewhere ('~/myData/downloadedFiles' in this case), and execute these commands in the terminal (please change the directory paths and the archive file name as necessary).

Stage Direction
Hypothesizer 7 downloads the Linux 64-bit tar.gz file, and executes some commands in the terminal.

@bash Source Code
mkdir -p ~/myApplications/execution/openJdk
tar -xvzf ~/myData/downloadedFiles/openjdk-15.0.1_linux-x64_bin.tar.gz -C ~/myApplications/execution/openJdk --strip-components=1

Hypothesizer 7
We will install OpenJFX. If you are not going to use JavaFX, this will be unnecessary.

We download an archive file (JavaFX Linux SDK 11.0.9 or JavaFX Linux SDK 15.0.1, depending on the OpenJDK version) from the OpenJFX download Web page into somewhere ('~/myData/downloadedFiles' in this case), and execute these commands in a terminal (please change the directory paths and the archive file name as necessary).

Stage Direction
Hypothesizer 7 downloads the JavaFX Linux SDK 11.0.9 ZIP file, and executes some commands in the terminal.

@bash Source Code
mkdir -p ~/myApplications/libraries/javaFx
bsdtar -xvf ~/myData/downloadedFiles/openjfx-11.0.9_linux-x64_bin-sdk.zip -C ~/myApplications/libraries/javaFx --strip-components=1

Hypothesizer 7
Then, if OpenJDK has not been installed through the packages management system, the JDK binary directory will be added to the shell commands paths. In addition, whether OpenJDK has been installed through the packages management system or not, a necessary environment variable will be set. In fact, we edit the '~/.bashrc' file to add these (the first line is unnecessary if OpenJDK has been installed through the packages management system) at the top most part of the file.

Stage Direction
Hypothesizer 7 opens the '~/.bashrc' file, and add these into the file.

@bash Source Code
export PATH=~/myApplications/execution/openJdk/bin:${PATH}
export JAVA_HOME=$(readlink -f $(which javac) | sed "s/\/bin\/javac$//")

Hypothesizer 7
What would have to be referred to by your IDE are these.

For Java programming, as module paths, the 'lib' directory in the OpenJFX product directory; as module names, 'javafx.controls,javafx.fxml'.


3-7: Installing and Configuring Gradle


Hypothesizer 7
We will install Gradle.

The way 1 is through the packages management system: we execute this command in a terminal.

Stage Direction
Hypothesizer 7 executes a command in the terminal.

@bash Source Code
sudo apt-get install gradle

Hypothesizer 7
The way 2 is through downloading an archive file from a Web site: we download an archive file of the package from the Gradle download Web page into somewhere ("~/myData/downloadedFiles" in this case), and execute this command (please change the directory paths and the archive file name as necessary) in a terminal.

Stage Direction
Hypothesizer 7 downloads the ZIP file, and executes these commands in the terminal.

@bash Source Code
mkdir -p ~/myApplications/execution/gradle
bsdtar -xvf ~/myData/downloadedFiles/gradle-6.7.1-bin.zip -C ~/myApplications/execution/gradle --strip-components=1

Hypothesizer 7
Then, if Gradle has not been installed through the packages management system, the Gradle binary directory will be added to the shell commands paths. In addition, whether Gradle has been installed through the packages management system or not, a necessary environment variable will be set. In fact, we edit the '~/.bashrc' file to add these (the first line is unnecessary if Gradle has been installed through the packages management system) at the top most part of the file.

Stage Direction
Hypothesizer 7 opens the '~/.bashrc' file, and add these into the file.

@bash Source Code
export PATH=~/myApplications/execution/gradle/bin:${PATH}
export GRADLE_HOME=$(readlink -f $(which gradle) | sed "s/\/bin\/gradle$//")


3-8: Installing GCC + wxWidgets + OpenSSL


Hypothesizer 7
We will install GCC. If you are not going to develop any C++ code piece, this will be unnecessary.

I will not delve into how to install GCC without through the packages management system, because any distribution should have it, probably. In fact, we execute this command in a terminal.

Stage Direction
Hypothesizer 7 executes this command in the terminal.

@bash Source Code
sudo apt-get install build-essential

Hypothesizer 7
We will install wxWidgets. If you are not going to use wxWidgets, this will be unnecessary.

The way 1 is through the packages management system: we execute this command in a terminal.

Stage Direction
Hypothesizer 7 executes this command in the terminal.

@bash Source Code
sudo apt-get install libwxgtk3.0-gtk3-dev

Hypothesizer 7
The way 2 is through downloading an archive file that contains the source files from a Web site: we download an archive file that contains the source files from the wxWidgets download Web page into somewhere ("~/myData/downloadedFiles" in this case), and execute these commands (please change the directory paths as necessary) in a terminal.

Stage Direction
Hypothesizer 7 downloads the "Source for Linux, macOS, etc" tar.bz2 file, and executes these commands in the terminal.

@bash Source Code
mkdir -p ~/myApplications/libraries/wxWidgets
bsdtar -xvjf ~/myData/downloadedFiles/wxWidgets-3.0.4.tar.bz2 -C ~/myApplications/libraries/wxWidgets --strip-components=1
cd ~/myApplications/libraries/wxWidgets
./configure --enable-stl --with-gtk=3
make

Hypothesizer 7
We will install OpenSSL. If you are not going to use OpenSSL, this will be unnecessary. OpenSSL is used for using some hashing algorithms for hashing passwords, in this cite.

As I guess that it is included in the packages management system in most cases, I only introduce a way that is through the packages management system: we execute this command in a terminal.

Stage Direction
Hypothesizer 7 executes this command in the terminal.

@bash Source Code
sudo apt-get install libssl-dev

Hypothesizer 7
What would have to be referred to by your IDE are these.

For C++ programming, as header files paths, the path shown in the result of the 'wx-config --cxxflags' command; as libraries paths, the path shown in the result of the 'wx-config --libs' command; as library names, the names shown in the result of the 'wx-config --libs' command and 'dl', 'ssl', and 'crypto'.


3-9: Installing and Configuring Python + mypy + wxPython


Hypothesizer 7
We will install Python and pip. If you are not going to develop any Python code piece, this will be unnecessary.

We have to install the Python version that corresponds to the LibreOffice or Apache OpenOffice version. . . . In order to know the Python version, we can look into the '%the LibreOffice or Apache OpenOffice base directory%/program/pythonloader.unorc' file. . . . Actually, for the LibreOffice installation way 2 and the Apache OpenOffice installation, Python is included in the '%the LibreOffice or Apache OpenOffice base directory%/program' directory, and for the LibreOffice installation way 1, Python is not included in LibreOffice, but should have been already installed because the LibreOffice package depends on Python.

However, the Python included in LibreOffice for the LibreOffice installation way 2 or in Apache OpenOffice is a some-ingredients-are-stripped-off version and problematic for my intention of adding some packages into it . . .

Objector 5A
"a some-ingredients-are-stripped-off version"?

Hypothesizer 7
As far as I know, pip, venv, and tkinter are not there, and I have not managed to install any of them (especially, the lack of pip is critical).

Objector 5A
I agree that is critical . . .

Hypothesizer 7
So, we will hack to use an external Python of the same version, instead.

Objector 5A
. . . Why can't I use an arbitrary newer version instead?

Hypothesizer 7
That is because the 'pyuno.so' shared library included in LibreOffice or Apache OpenOffice is exclusively for the specified Python version.

Objector 5A
Hmm . . ., that is regrettable.

Hypothesizer 7
Anyway, we will install an external Python for the LibreOffice installation way 2, like this (please change the directory paths as necessary and install the necessary packages (for example, 'build-essential', 'libsqlite3-dev', 'libbz2-dev', 'libffi-dev', and 'libssl-dev')). . . . Note that although the build may succeed even if some packages (for example, 'libffi-dev' and 'libssl-dev') are missing, some troubles may occur afterward; so, we cannot be sure that the necessary packages are present just because the build has succeeded.

Stage Direction
Hypothesizer 7 downloads the "XZ compressed source tarball" file from the Python download page into '~/myData/downloadedFiles', and executes these commands in the terminal.

@bash Source Code
mkdir -p ~/myData/downloadedFiles/python
tar -xvf ~/myData/downloadedFiles/Python-%the version%.tar.xz -C ~/myData/downloadedFiles/python --strip-components=1
cd ~/myData/downloadedFiles/python
./configure --enable-shared --prefix=${HOME}/myApplications/execution/python
make
make install

Hypothesizer 7
Then, the Python shared library directory will be added to 'LD_LIBRARY_PATH', and the Python binary directory will be added to the shell commands paths. In fact, we edit the '~/.bashrc' file to add these at the top most part of the file.

Stage Direction
Hypothesizer 7 opens the '~/.bashrc' file, and add these into the file.

@bash Source Code
export LD_LIBRARY_PATH=~/myApplications/execution/python/lib:${LD_LIBRARY_PATH}
export PATH=~/myApplications/execution/python/bin:${PATH}

Hypothesizer 7
Then, we will make LibreOffice use the external Python according to this article.

Stage Direction
Hypothesizer 7 makes LibreOffice use the external Python.

Objector 5A
Hmm . . ., so, how about Apache OpenOffice?

Hypothesizer 7
It should be able to be done likewise, I guess, but I have not tried it, and honestly, I have no intention to try it.

Objector 5A
Why not?

Hypothesizer 7
Because I do not intend to use Python 2; I hope that Apache OpenOffice will adopt Python 3 soon.

Objector 5A
. . .

Hypothesizer 7
Whatever 'python3' command you use, please make sure that another 'python3' command does not have precedence in the 'PATH' environment variable, because our Gradle script uses the 'python3' command found in the 'PATH' environment variable; or you can modify the Gradle script.

Let us make sure that 'python3' command hereafter points to the appropriate Python command (that is important because otherwise, the things installed hereafter would go to another Python).

If pip is not already installed, we will install it like this: we download 'https://bootstrap.pypa.io/get-pip.py' to '~/myData/downloadedFiles' and execute this command in a terminal (please remove 'sudo -H ' if unnecessary).

Stage Direction
Hypothesizer 7 downloads the 'https://bootstrap.pypa.io/get-pip.py' file to '~/myData/downloadedFiles' and executes this command in the terminal.

@bash Source Code
sudo -H python3 ~/myData/downloadedFiles/get-pip.py

Hypothesizer 7
If an error that 'distutils.util' is not found happens, we will install it like this (the command may be different in another Linux distribution).

Stage Direction
Hypothesizer 7 executes this command in the terminal and executes the above command again.

@bash Source Code
sudo apt-get install python3-distutils

Hypothesizer 7
We will install mypy.

We execute this command in a terminal (please remove 'sudo -H ' if unnecessary).

Stage Direction
Hypothesizer 7 executes these commands in the terminal.

@bash Source Code
sudo -H python3 -m pip install mypy
sudo -H python3 -m pip install python-dateutil
sudo -H python3 -m pip install types-python-dateutil

Hypothesizer 7
We will install wxPython. If you are not going to use wxPython, this will be unnecessary.

If there is an existing appropriate wheel, let us download it from 'https://extras.wxpython.org/wxPython4/extras/linux' into somewhere ("~/myData/downloadedFiles" in this case). In fact, I can use for the way 1 in this case, 'gtk-3' Ubuntu 20.04 'wxPython-4.1.0-cp38-cp38-linux_x86_64.whl'.

Then, we can use the wheel to install wxPython like this (please remove 'sudo -H ' if unnecessary and change the directory path and the file name as necessary).

@bash Source Code
sudo -H python3 -m pip install pathlib2
sudo -H python3 -m pip install ~/myData/downloadedFiles/wxPython-4.1.0-cp38-cp38-linux_x86_64.whl

Hypothesizer 7
If there is not any existing appropriate wheel, we will have to build one from the source files. In fact, how to do so is satisfactorily explained here. Let us do it like this ("sudo apt-get install python3-venv" is only for the LibreOffice installation way 1; please remove 'sudo -H ' if unnecessary and change the directory path and the file name as necessary).

Stage Direction
Hypothesizer 7 executes these commands in the terminal.

@bash Source Code
sudo apt-get install libgtk-3-dev
sudo apt-get install python3-venv
cd ~/myData/downloadedFiles
python3 -m venv wxPythonBuilding
source wxPythonBuilding/bin/activate
python3 -m pip install -U six wheel setuptools
python3 -m pip install -U pathlib2
python3 -m pip download wxPython
python3 -m pip wheel -v wxPython-4.1.0.post1.tar.gz 2>&1 | tee build.log
deactivate
sudo -H python3 -m pip install wxPython-4.1.0-cp38-cp38-linux_x86_64.whl


3-10: Installing wmctrl


Hypothesizer 7
We will install wmctrl (a command used to control windows in EWMH (NetWM)-compatible X Window windows managers). If you are not going to develop any UNO extension, it will be unnecessary, and even if you are, it will not be mandatory (in our Gradle build systems, wmctrl is used to shut down the LibreOffice or Apache OpenOffice processes gracefully (which means to let the user close the opened documents before the LibreOffice or Apache OpenOffice processes are shut down) before any UNO extension is installed into LibreOffice or Apache OpenOffice, but if wmctrl isn't installed, the user can just shut down the LibreOffice or Apache OpenOffice processes manually, as builds just wait until all the LibreOffice or Apache OpenOffice processes are shut down).

I only know how to install it through the packages management system. If your X Window windows manager is not EWMH (NetWM)-compatible or your packages management system does not have it, you can just ignore this (it is not mandatory), or you may be able to find a package somewhere else. In fact, we execute this command in a terminal.

Stage Direction
Hypothesizer 7 executes this command in the terminal.

@bash Source Code
sudo apt-get install wmctrl


3-11: Setting the JRE Used by LibreOffice or Apache OpenOffice


Hypothesizer 7
We will set the JRE used for the JVM inside the LibreOffice or Apache OpenOffice process. If you do not develop any Java code piece that is going to live in such a JVM, this will be unnecessary.

For LibreOffice or Apache OpenOffice, we can set it like this: start up an office process; click 'Tools' on the menu; click 'Options'; click 'Advanced'; check 'Use a Java runtime environment'; select the JRE; click 'OK'.


3-12: Creating Some C++ Header Files from Some UNO Datum Types Merged Files That Are Included in LibreOffice or Apache OpenOffice


Hypothesizer 7
We will create some C++ header files from some UNO datum types merged files that are included in LibreOffice or Apache OpenOffice. If you do not develop any C++ code piece, this will be unnecessary.

We execute this command in a terminal (please change the directory paths as necessary, where '/usr/lib/libreoffice' is the base directory of LibreOffice and '${HOME}/myApplications/headerFiles' is the directory that should be the base for those C++ header files).

Stage Direction
Hypothesizer 7 executes this command in the terminal.

@bash Source Code
cd /usr/lib/libreoffice
sdk/bin/cppumaker -Gc -O${HOME}/myApplications/headerFiles ./program/types.rdb ./program/types/offapi.rdb

What would have to be referred to by your IDE are these.

For C++ programming, as header file paths, the directory created above.


References


  • Wikimedia Foundation, Inc.. (2018-05-22). Lubuntu. Retrieved from https://en.wikipedia.org/wiki/Lubuntu
  • The Document Foundation. (n/a). Download LibreOffice | LibreOffice. Retrieved from https://www.libreoffice.org/download/download/
  • The Apache Software Foundation. (2020). Apache OpenOffice - Downloads. Retrieved from https://openoffice.apache.org/downloads.html
  • Oracle Corporation and/or its affiliates. (2020). JDK 15.0.1 GA Release. Retrieved from https://jdk.java.net/15/
  • Gluon. (2020). JavaFX. Retrieved from https://gluonhq.com/products/javafx/
  • Gradle Inc.. (2020). Gradle | Releases. Retrieved from https://gradle.org/releases/
  • wxWidgets. (2020). Downloads - wxWidgets. Retrieved from https://www.wxwidgets.org/downloads/
  • Python Software Foundation. (2019). Download Python | Python.org. Retrieved from https://www.python.org/downloads/
  • The wxPython Team. (2019). Building wxPython for Linux via Pip | wxPython. Retrieved from https://wxpython.org/blog/2017-08-17-builds-for-linux-with-pip/index.html
  • N/A. (N/A). Index of /wxPython4/extras/linux. Retrieved from https://extras.wxpython.org/wxPython4/extras/linux
  • Wikimedia Foundation, Inc.. (2016/07/21). wmctrl. Retrieved from https://en.wikipedia.org/wiki/Wmctrl
<The previous article in this series | The table of contents of this series | The next article in this series>