LibreOffice SDK on Windows

Stephan Bergmann sbergman at redhat.com
Fri Apr 19 05:29:14 PDT 2013


For the record, here is my status of using the SDK of a recent (post 
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=5051209534c8a2034dcb0016d4a8fe29dcb2947b> 
"Adapt SDK to usage of msvcrtd for Windows --enable-dbgutil") master 
build (--enable-dbgutil even) on Windows:

I use the SDK on the Windows 7 machine I also do the LO build on (at 
C:\lo\core), so that machine already had Visual Studio and a JDK installed.

As a prerequisite, install 
<http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/mingw-get-inst-20120426/mingw-get-inst-20120426.exe/download> 
and, in Command Prompt do:

> > cd C:\MinGW
> > mingw-get update
> > mingw-get install msys-zip

For testing ure/source/uretest/Makefile, additionally do:

> > mingw-get install msys-coreutils
> > mingw-get install msys-sed

Then, in Command Prompt do:

> > cd C:\lo\core\solver\wntmsci12\installation\opt\sdk
> > setsdkenv_windows.bat

and do the first-time configuration as necessary.  The results for me are:

>  ******************************************************************
>  *
>  * SDK environment is prepared for Windows
>  *
>  * SDK = C:\lo\core\solver\wntmsci12\installation\opt\sdk
>  * Office = C:\lo\core\solver\wntmsci12\installation\opt
>  * URE = C:\lo\core\solver\wntmsci12\installation\opt\URE
>  * Make = C:\MinGW\bin
>  * Zip = C:\MinGW\msys\1.0\bin
>  * C++ Compiler = C:\Program Files\Microsoft Visual Studio 9.0\VC\bin
>  * C# and VB.NET compilers = C:\Windows\Microsoft.NET\Framework\v2.0.50727
>  * Java = C:\Program Files\Java\jdk1.7.0_11
>  * Special Output directory = c:\libreoffice4.1.0.0.alpha0+_sdk
>  * Auto deployment = YES
>  *
>  ******************************************************************

Then, to see things are working at least minimally, continue with

> > cd examples\cpp\counter
> > mingw32-make
> > mingw32-make countermain.run

At least with my current build, the ure/source/uretest/Makefile test:

> > cd C:\lo\core\ure\source\uretest
> > mingw32-make

still fails the test-javanative with:

> set URE_MORE_TYPES=file:///C:/lo/core/ure/source/uretest/out.sdk/types.rdb && set URE_MORE_SERVICES=file:///C:/lo/core/ure/source/uretest/out.sdk/services.rdb &&  "C:\Program Files\Java\jdk1.7.0_11/bin/java"  -jar out.sdk/runner.jar \
>             file:///C:/lo/core/solver/wntmsci12/installation/opt/URE/java/ file:///C:/lo/core/ure/source/uretest/out.sdk/javanative.jar
> warn:cppuhelper:2968:3492:cppuhelper/source/shlib.cxx:501: loading component library failed: file:///C:/lo/core/ure/source/uretest/out.sdk/cpptest.uno.dll
> Exception in thread "main" java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at com.sun.star.lib.unoloader.UnoClassLoader.execute(UnoClassLoader.java:160)
>         at com.sun.star.lib.unoloader.UnoLoader.execute(UnoLoader.java:81)
>         at test.java.runner.Runner.main(Runner.java:28)
> Caused by: com.sun.star.uno.DeploymentException: component context fails to supply service test.types.CppTest of type test.types.XTest: com.sun.star.loader.CannotActivateFactoryException: loading component library failed: file:///C:/lo/core/ure/source/uretest/out.sdk/cpptest.uno.dll
> java stack trace:
>         at com.sun.star.bridges.jni_uno.JNI_proxy.dispatch_call(Native Method)
>         at com.sun.star.bridges.jni_uno.JNI_proxy.invoke(JNI_proxy.java:183)
>         at $Proxy2.createInstanceWithContext(Unknown Source)
>         at test.types.CppTest.create(Unknown Source)
>         at test.java.tester.Tester.test(Tester.java:29)
>         at test.java.javanative.JavaNative.main(JavaNative.java:26)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at com.sun.star.lib.unoloader.UnoClassLoader.execute(UnoClassLoader.java:160)
>         at com.sun.star.lib.unoloader.UnoLoader.execute(UnoLoader.java:81)
>         at test.java.runner.Runner.main(Runner.java:28)
>
>         at test.types.CppTest.create(Unknown Source)
>         at test.java.tester.Tester.test(Tester.java:29)
>         at test.java.javanative.JavaNative.main(JavaNative.java:26)
>         ... 7 more
> Makefile:82: recipe for target 'test-javanative' failed
> mingw32-make: *** [test-javanative] Error 1

but test-cpptest, test-javateset, and
the (manual) test-clientserver all work.  No idea yet what is broken there.

If anybody has insight into my two questions at 
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=5051209534c8a2034dcb0016d4a8fe29dcb2947b> 
"Adapt SDK to usage of msvcrtd for Windows --enable-dbgutil," that would 
be appreciated:

> * The old settings.mk was apparently confused with using /MT ("link with
>   LIBCMT.LIB") on cl command line and /MD ("link with MSVCRT.LIB") on link
>   command line (where it was ignored), and you apparently can't pass both
>   together to cl, so I settled on /MD (resp. /MDd) now and dropped /MT (resp.
>   /MTd).  No idea if that is exactly right, however.
>
> * Introduced client-facing LIBO_SDK_LDFLAGS_STDLIBS that covers kernel32.lib and
>   msvcrt.lib vs. msvcrtd.lib on Windows.  Adapted examples Makefiles and
>   /ure/source/uretest/Makefile accordingly.  Some examples Makefiles
>   additionally use msvcprt.lib, no idea whether that still needs to be
>   addressed.

Stephan


More information about the LibreOffice mailing list