Skip to main content

Installing and Configuring Libreoffice SDK on Windows 11.

 

What is Libreoffice SDK? Why do I need it.

https://api.libreoffice.org/examples/examples.html#Cpp_examples


Installing the SDK

The instructions for installing the SDK are given in https://api.libreoffice.org/docs/install.html. 

1) If you have the Libreoffice source code, you can install sdk with  --enable-odk option in autogen.input file . Then make check, make, ./autogen.sh. (https://wiki.documentfoundation.org/Development/lode). Now the SDK path will be c:/cygwin/home/$user/lode/dev/core/instdir/sdk

2. If you don't have the source code or don''t want to go through the build process again, then sdk can be installed from https://www.libreoffice.org/download/download-libreoffice/. In this case the sdk will be installed in C:\Program Files\LibreOffice\sdk. You will have to follow the path  cygwin/cygdrive/c/Program\ Files/Libreoffice/sdk/examples from cygwin shell. 


The steps listed below are for installing the LibreOffice SDK

Configuring the SDK in Libreoffice on windows 11

Once you are in SDK folder as mentioned above:-

 The configure script for windows is ./setsdkenv_windows.bat in the SDK folder. Execute ./setsdkenv_windows.bat. The configure script requests the following information  in order to prepare a working SDK environment.

a) Enter the Office Software Development Kit directory: [C:\cygwin\home\deepika\lode\dev\core\instdir\sdk or C:\Program Files\LibreOffice\sdk]

b) Enter the Office base installation directory [C:\Program Files\LibreOffice].

c) Enter GNU make (3.79.1 or higher) tools directory []: [C:\UnxUtils\usr\local\wbin]

(Cygwin make is installed in Cygwin under C:\cygwin\home\$user\lode\opt\bin). We can install GNU make from http://sourceforge.net/projects/unxutils. Its mentioned on the website that https://api.libreoffice.org/docs/install.html that Cygwin make does not work well with the SDK. Also mingw is also mentioned. (todo:// expore this option)

(Reference: https://wiki.documentfoundation.org/Documentation/DevGuide/Writing_UNO_Components )

The following paths are passed to the configure script based on this installation.

Make = C:\UnxUtils\usr\local\wbin

d)  Enter a zip (2.3 or higher) tools directory = C:\UnxUtils\usr\local\wbin

e) Enter a cat (2.0 or higher) tools directory []=C:\UnxUtils\usr\local\wbin

f) Enter a sed (2.0 or higher) tools directory [] = C:\UnxUtils\usr\local\wbin

g) Enter the directory of the C++ compiler (optional) []:C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64

The processor architecture can be read from This PC/Properties.  It can get confusing, so can be verified from the file c:/cygwin/home/$user/lode/dev/core/config.log, if you have the Libreoffice source code installed. The required executable is c1.exe (todo://). 

h) Enter JAVA SDK (1.6 or higher) installation directory (optional) []: C:\Progra~1\Eclips~1\jdk-17.0.8.101-hotspot

i) location of c# and VB.NET : skipped

Default output directory is the "c:\libreoffice24.2_sdk". You can verify that the folder has been created.

j) Automatic deployment of UNO components (YES/NO) [YES]:yes

Now, There is no need to configure this again for using Libreoffice SDK.  If you want to configure again, the option

./setsdkenv_windows.bat --force-configure can be used. 

 /*********************************************************************/

 * SDK environment is prepared for Windows

 *

 * SDK = c:\progra~1\Libreoffice\sdk

 * Office = c:\progra~1\Libreoffice

 * Make = C:\UnxUtils\usr\local\wbin

 * Zip = C:\UnxUtils\usr\local\wbin

 * cat = C:\UnxUtils\usr\local\wbin

 * sed = C:\UnxUtils\usr\local\wbin

* C++ Compiler = C:\Progra~1\Micros~3\2022\Community\VC\Tools\MSVC\14.37.32822\bin\Hostx64\x64

 * C# and VB.NET compilers =

 * Java = C:\Progra~1\Eclips~1\jdk-17.0.8.101-hotspot

 * Special Output directory = c:\libreoffice7.6_sdk

 * Auto deployment = YES

  /****************************************************************************/

-->only a path without spaces is allowed because of a limitation of gnu make.

-->Now the important point  here is that we have to use "GNU make" rather than "Cygwin make" for SDK examples. ("Cygwin make" does not work well with Libreoffice sdk as mentioned above). In my case the path for GNU make is C:\UnxUtils\usr\local\wbin\make. 

-->Go to sdk/examples/cpp/DocumentLoader/ from windows command (CMD) and issue the command C:\UnxUtils\usr\local\wbin\make

but I get the error, ../../../settings/settings.mk:22: /settings/dk.mk: No such file or directory

make: *** No rule to make target '/settings/dk.mk'.  Stop.

-->The problem is already filed and discussed in Bugzilla as Bug 155956 - LibreOffice SDK setsdkenv_windows.bat assumes wrong position of VCVARS32.bat


It is suggested in the above web link that we need to edit the file sdk/cfgWin.js and go to line 990 as follows:

  "if defined OO_SDK_CPP_HOME call \"%OO_SDK_CPP_HOME%\\VCVARS32.bat\"\n" + 
to
         "if defined OO_SDK_CPP_HOME call \" C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\VCVARS32.bat\"\n" +

cfgWin.js is used by the configure script setsdkenv_windows.bat

/***************************Cannot edit c:\Libreoffice\sdk folder**********************/
I opened cmd.exe (right click, Run as Administrator).
icacls  "c:/Progra~1/LibreOffice/sdk/" /reset /t /c /l  (To change the permissions of the SDK folder, so i have permission to make changes)
Its still not changed. I am not able to save cfgWin.js in c:/Progra~1/LibreOffice/sdk/ due to permission error. I will try in library office binary sdk.

/******************************************************************************/

-->This example does not use the new UNO bootstrap mechanism, it uses still a socket
connection. The example use the defaultBootstrap_InitialComponentContext method and provides the additional office types via the UNO environment variable -env:URE_MORE_TYPES=...
SET URE_BOOTSTRAP = vnd.sun.star.pathname:C:\Progra~1\LibreOffice \program \                                                           fundamental.ini

-->Before you can run this example you have to start your office in listening mode.
from lode/dev/core/instdir/program/soffice "--accept=socket, port=2083,urp;"

or
"c:\ProgramFiles\LibreOffice\program"\soffice --accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager

/****
ge: "UNO URL contains bad parameter key" ArgumentPosition: 0 warn:desktop.offacc:2732:12428:desktop/source/offacc/acceptor.cxx:124: com.sun.star.lang.IllegalArgumentException message: "UNO URL contains bad parameter key" ArgumentPosition: 0 warn:desktop.offacc:2732:12428:desktop/source/offacc/acceptor.cxx:124: com.sun.star.lang.IllegalArgumentException message: "UNO URL contains bad parameter key" ArgumentPosition: 0/

-->Now if i go to sdk/examples/DevelopersGuide/FirstSteps/cxx and execute C:\UnxUtils\usr\local\wbin\make, i get the same error as above.
mkdir c:\libreoffice24.2_sdk\WINexample.out\misc

mkdir: cannot create directory 'c:\\libreoffice24.2_sdk\\WINexample.out\\misc': No such file or directory

make: [../../../../settings/stdtarget.mk:32: c:/libreoffice24.2_sdk/WINexample.out/misc/oosdk_cpp_types.flag] Error 1 (ignored)
del c:\libreoffice24.2_sdk\WINexample.out\misc\oosdk_cpp_types.flag
make: del: No such file or directory

make: [../../../../settings/stdtarget.mk:33: c:/libreoffice24.2_sdk/WINexample.out/misc/oosdk_cpp_types.flag] Error 127 (ignored)

"C:\cygwin\home\deepika\lode\dev\core\instdir\sdk/bin/cppumaker" -Gc -Oc:/libreoffice24.2_sdk/WINexample.out/inc "C:/Program Files/LibreOffice/program/types.rdb" "C:/Program Files/LibreOffice/program/types/offapi.rdb"

echo flagged > c:/libreoffice24.2_sdk/WINexample.out/misc/oosdk_cpp_types.flag
/bin/sh: line 1: c:/libreoffice24.2_sdk/WINexample.out/misc/oosdk_cpp_types.flag: No such file or directory
make: *** [../../../../settings/stdtarget.mk:35: c:/libreoffice24.2_sdk/WINexample.out/misc/oosdk_cpp_types.flag] Error 1
Essentially,
So i will try compiling the sdk with cmake or qmake, rather than GNU make in the next article. 
https://dev.blog.documentfoundation.org/2022/02/10/working-with-libreoffice-sdk-examples/
/**********************
make
mkdir c:\libreoffice24.2_sdk\WINexample.out\obj\Draw
mkdir: cannot create directory 'c:\\libreoffice24.2_sdk\\WINexample.out\\obj\\Draw': No such file or directory
make: [Makefile:48: c:/libreoffice24.2_sdk/WINexample.out/obj/Draw/Draw.obj] Error 1 (ignored)
cl -c -MD -Zm500 -Zc:wchar_t- -wd4251 -wd4275 -wd4290 -wd4675 -wd4786 -wd4800 -GR -EHa  -I. -Ic:/libreoffice24.2_sdk/WINexample.out/inc -Ic:/libreoffice24.2_sdk/WINexample.out/inc/examples -I../../../include -Ic:/libreoffice24.2_sdk/WINexample.out/inc/Draw -DWIN32 -DWNT -D_DLL -DCPPU_ENV=mscx -Foc:\libreoffice24.2_sdk\WINexample.out\obj\Draw\Draw.obj Draw.cxx
Microsoft (R) C/C++ Optimizing Compiler Version 19.37.32822 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

Draw.cxx
Draw.cxx(20): fatal error C1083: Cannot open include file: 'iostream': No such file or directory
make: *** [Makefile:49: c:/libreoffice24.2_sdk/WINexample.out/obj/Draw/Draw.obj] Error 2
/**************************/





 




Comments

Popular posts from this blog

Pinging the Host

Our devices require a GPRS connection to the service provider(SP). Recently, we had a problem in which the connection to SP was lost after a certain period of time. So we had to reset the connection to the SP and resetting the connection takes a a few seconds which can be irritable to the customer. So we had to maintain the connection with the SP. Our CTO suggested that the devices number should be maintained in the APN routing table of the SP. Because the SP clears the table after some time to accomodate more incoming connection requests and clear out the ones which are inactive. So the solution was a "ping" to the SP every few minutes, so that the devices entry is maintained in the routing table of the APN. Now the device can connect to SP even after staying idle for the whole night!!
Intel Core Multi core line of processors introduced around 2006. Replaced the Pentium line of processors. The line up of intel core processors includes low end-i3 (entry level consumer), mid end-i5 (mainstream consumer), high end-i7  and enthusiast-i9. Xeon refers to workstation and server brands. Instead, its better to differentiate generation by technical features. For example, intel core i7 of 12th, 13th and 14th generation differ in base speed, number of performance and efficiency cores,  cache size and micro-architecture technology.  This naming scheme was introduced in 2008 and does not correspond to specific technical features like  number of cores in a processor.  What is multi core processor? A multi core processor is a processor on a single Integrated circuit with two or more execution units called cores. So the processing tasks can be executed in parallel on the separate cores. It might involve data parallelism or task parallelism or hybrid involving both. The software progr