Bug 155959 - LibreOffice C++ SDK make does not work neither in Cygwin shell nor in CMD without GNU make
Summary: LibreOffice C++ SDK make does not work neither in Cygwin shell nor in CMD wit...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectRequest
Depends on:
Blocks:
 
Reported: 2023-06-21 11:17 UTC by Hossein
Modified: 2023-11-28 09:45 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Cppumaker.exe assertion failure (73.42 KB, image/png)
2023-06-21 11:19 UTC, Hossein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hossein 2023-06-21 11:17:30 UTC
Description:
LibreOffice SDK setsdkenv_windows.bat has issues with using vcvars64.bat, filed as tdf#55956. But even when using a workaround for that by manually setting the script path and name, the C++ SDK make does not work neither in Cygwin shell nor in CMD.

Steps to Reproduce:
I assume that Visual Studio 2022 with x64 Cygwin installed in c:\cygwin64 are used.

1. Build LibreOffice from sources with SDK on Windows x64 using Cygwin with --enable-odk
2. Edit C:\cygwin64\home\user\lode\dev\core\instdir\sdk\cfgWin.js.

Temporarily change line 990 from

        "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\\VCVARS64.bat\"\n" +

3. Invoke these commands in Cygwin shell or cmd (omit ./ in CMD):
    $ cd instdir
    $ cd sdk
    $ ./setsdkenv_windows.bat
4. Enter details of the system configuration
5. Go to examples/cpp/DocumentLoader in either Cygwin shell or CMD
6. Invoke make

Actual Results:
In Cygwin shell:

user@windows ~/lode/dev/core/instdir/sdk/examples/cpp/DocumentLoader
$ make
../../../settings/settings.mk:22: /settings/dk.mk: No such file or directory
make: *** No rule to make target '/settings/dk.mk'.  Stop.

In CMD, an assertion failure for cppumaker.exe is shown in addition to this error:

c:\cygwin64\home\user\lode\dev\core\instdir\sdk\examples\cpp\DocumentLoader>make
mkdir c:\libreoffice24.2_sdk\WINexample.out\misc
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:\cygwin64\home\user\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"
make: *** [../../../settings/stdtarget.mk:34: c:/libreoffice24.2_sdk/WINexample.out/misc/oosdk_cpp_types.flag] Error 3

Expected Results:
Compilation should be done without error in Cygwin shell and CMD.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: e7f486f10fd21bee78dea0d2eda241dd094d783d
CPU threads: 20; OS: Windows 10.0 Build 22621; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_DE); UI: en-US
Calc: CL threaded
Comment 1 Hossein 2023-06-21 11:19:02 UTC
Created attachment 188039 [details]
Cppumaker.exe assertion failure
Comment 2 Hossein 2023-06-21 12:26:22 UTC
As discussed in tdf#155956, it seems that the office dir is mixed with the binary installation. So, I tried to do the steps again. In this test, cppumaker is not problematic, but I still get the error:

c:\cygwin64\home\user\lode\dev\core\instdir\sdk\examples\cpp\DocumentLoader>make
mkdir c:\libreoffice24.2_sdk\WINexample.out\misc
mkdir: cannot create directory 'c:\\libreoffice24.2_sdk\\WINexample.out\\misc': File exists
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:\cygwin64\home\user\lode\dev\core\instdir\sdk/bin/cppumaker" -Gc -Oc:/libreoffice24.2_sdk/WINexample.out/inc "C:/cygwin64/home/user/lode/dev/core/instdir/program/types.rdb" "C:/cygwin64/home/user/lode/dev/core/instdir/program/types/offapi.rdb"
echo flagged > c:/libreoffice24.2_sdk/WINexample.out/misc/oosdk_cpp_types.flag
mkdir c:\libreoffice24.2_sdk\WINexample.out\obj\DocumentLoader
mkdir: cannot create directory 'c:\\libreoffice24.2_sdk\\WINexample.out\\obj\\DocumentLoader': No such file or directory
make: [Makefile:64: c:/libreoffice24.2_sdk/WINexample.out/obj/DocumentLoader/DocumentLoader.obj] Error 1 (ignored)
cl -c -MDd -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/DocumentLoader -DWIN32 -DWNT -D_DLL -DCPPU_ENV=mscx -Foc:\libreoffice24.2_sdk\WINexample.out\obj\DocumentLoader\DocumentLoader.obj DocumentLoader.cxx
Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32534 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

DocumentLoader.cxx
c:\cygwin64\home\user\lode\dev\core\instdir\sdk\examples\cpp\DocumentLoader\DocumentLoader.cxx : fatal error C1083: Cannot open compiler generated file: 'c:\libreoffice24.2_sdk\WINexample.out\obj\DocumentLoader\DocumentLoader.obj': No such file or directory
make: *** [Makefile:65: c:/libreoffice24.2_sdk/WINexample.out/obj/DocumentLoader/DocumentLoader.obj] Error 1


By creating the obj directory in C:\libreoffice24.2_sdk\WINexample.out manually, the build passes. I think some commands in cygwin and cmd are mixed, although I did all the configuration in cmd here.

The new output is:

c:\cygwin64\home\user\lode\dev\core\instdir\sdk\examples\cpp\DocumentLoader>make
mkdir c:\libreoffice24.2_sdk\WINexample.out\obj\DocumentLoader
cl -c -MDd -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/DocumentLoader -DWIN32 -DWNT -D_DLL -DCPPU_ENV=mscx -Foc:\libreoffice24.2_sdk\WINexample.out\obj\DocumentLoader\DocumentLoader.obj DocumentLoader.cxx
Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32534 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

DocumentLoader.cxx
mkdir c:\libreoffice24.2_sdk\WINexample.out\bin
mkdir c:\libreoffice24.2_sdk\WINexample.out\misc\DocumentLoader
link /MAP /OPT:NOREF /SUBSYSTEM:CONSOLE /BASE:0x1100000 /OUT:c:/libreoffice24.2_sdk/WINexample.out/bin/DocumentLoader.exe /MAP:c:/libreoffice24.2_sdk/WINexample.out/misc/DocumentLoader/DocumentLoader.map \
  c:/libreoffice24.2_sdk/WINexample.out/obj/DocumentLoader/DocumentLoader.obj icppuhelper.lib icppu.lib isalhelper.lib isal.lib
Microsoft (R) Incremental Linker Version 14.36.32534.0
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating library c:\libreoffice24.2_sdk\WINexample.out\bin\DocumentLoader.lib and object c:\libreoffice24.2_sdk\WINexample.out\bin\DocumentLoader.exp
LINK : warning LNK4281: undesirable base address 0x1100000 for x64 image; set base address above 4GB for best ASLR optimization
--------------------------------------------------------------------------------
The example loads the test.odt document in the DocumentLoader example directory.
If you want to load your own document, please use:
DocumentLoader -env:URE_MORE_TYPES=<fileurl_office_types_rdb> filename [connection_url]
-
Use the following command to execute the example!
-
make DocumentLoader.run
-
NOTE: 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=...
Before you can run this example you have to start your office in listening mode.
-
soffice --accept=socket,host=localhost,port=2083;urp;StarOffice.ServiceManager
--------------------------------------------------------------------------------
Comment 3 Hossein 2023-06-21 12:27:51 UTC
This is the output from make make DocumentLoader.run:

c:\cygwin64\home\user\lode\dev\core\instdir\sdk\examples\cpp\DocumentLoader>make DocumentLoader.run

cd c:\libreoffice24.2_sdk\WINexample.out\bin && DocumentLoader -env:URE_MORE_TYPES=file:///"C:/cygwin64/home/user/lode/dev/core/instdir/program/types/offapi.rdb" "C:\cygwin64\home\user\lode\dev\core\instdir\sdk\examples\cpp\DocumentLoader\test.odt"
/bin/sh: line 1: cd: c:libreoffice24.2_sdkWINexample.outbin: No such file or directory
make: *** [Makefile:100: DocumentLoader.run] Error 1

It seems that directory separators are lost:
/bin/sh: line 1: cd: c:libreoffice24.2_sdkWINexample.outbin: No such file or directory
Comment 4 Stephan Bergmann 2023-10-12 08:54:20 UTC
For me, your recipe from comment 0 works fine if I use GNU make (as required at <https://api.libreoffice.org/docs/install.html>) in CMD.

(I'm not aware that using Cygwin shell for the SDK would be supported now.  At least traditionally, you had to use CMD.)