Bug Hunting Session
Bug 91966 - LibreOffice 5 (64-bit) cannot load a UNO component on Windows OS
Summary: LibreOffice 5 (64-bit) cannot load a UNO component on Windows OS
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
5.0.0.0.beta1
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Stephan Bergmann
URL:
Whiteboard: target:5.3.0 target:5.1.6 target:5.2....
Keywords: implementationError
Depends on:
Blocks:
 
Reported: 2015-06-09 13:28 UTC by testdruide
Modified: 2016-09-17 09:15 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
the error message (6.49 KB, image/png)
2015-06-09 13:29 UTC, testdruide
Details
the error message (9.24 KB, image/png)
2015-06-12 12:17 UTC, testdruide
Details

Note You need to log in before you can comment on or make changes to this bug.
Description testdruide 2015-06-09 13:28:20 UTC
The 64-bit version of LibreOffice 5 cannot load a  UNO component on Windows OS. LibreOffice 5 display the following message «cannot get environments». The problem doesn’t appear on the 32 bits version of LibrerOffice 5. My code uses «CPPU_STRINGIFY( msci )» to set the name of the environment.
Comment 1 testdruide 2015-06-09 13:29:58 UTC
Created attachment 116419 [details]
the error message
Comment 2 Buovjaga 2015-06-11 15:11:10 UTC
How about beta3, does it still have the problem http://dev-builds.libreoffice.org/pre-releases/win/x86_64/
It's about half way through the list, http://dev-builds.libreoffice.org/pre-releases/win/x86_64/LibreOfficeDev_5.0.0.0.beta3_Win_x64.msi
Comment 3 testdruide 2015-06-12 12:16:49 UTC
Yes, it occurs with beta 3.
Comment 4 testdruide 2015-06-12 12:17:54 UTC
Created attachment 116483 [details]
the error message
Comment 5 testdruide 2015-07-31 15:49:59 UTC
The problem still there with LibreOffice 5.0.0.4.

Is it possible to install an extension with a UNO componant generated with C ++ code in LibreOffice 5 (64-bit)?

The problem seems to be that LibreOffice does not recognize the "MSCI" environment.
Reference: export function component_getImplementationEnvironment

Here tested conguration
 - Windows 7 (64 bits)
 - Visual Studio 2013
 - LibreOffice 5.0.0.4 (64 bits)
Comment 6 Victor Laskurain 2016-09-08 21:32:32 UTC
The problem is still there with LibreOffice 5.2.1.2.

testdruide's diagnostic is not quite right though. The problem is not that LibreOffice does not recognize msci, rather that msci is not the right value. The right value for windows_x86_64 happens to be mscx. The CPPU_CURRENT_LANGUAGE_BINDING_NAME should the correct value at any time but in the 64 bit sdk for Windows its value is msci instead of the correct mscx.

For the time being I have been able to fix my extensions changing the component_getImplementationEnvironment function from this:

SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
    const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
{
    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}

to this:

SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
    const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
{
#if _WIN64
    *ppEnvTypeName = "mscx";
#else
    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
#endif
}
Comment 7 Buovjaga 2016-09-12 13:46:27 UTC
NEW per comment 6.
Comment 8 Tor Lillqvist 2016-09-12 14:08:27 UTC
My guess is that simply changing the -DCPPU_ENV=msci to -DCPPU_ENV=$(CPPU_ENV) in odk/settings/settings.mk might help
Comment 9 Commit Notification 2016-09-12 14:11:46 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3aaa820446f1ad3d3b0ddc557238b6fb3496dd54

tdf#91966: In SDK, set CPPU_ENV=mscx for 64-bit Windows

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Stephan Bergmann 2016-09-12 14:16:15 UTC
(In reply to Commit Notification from comment #9)
> Stephan Bergmann committed a patch related to this issue.
> It has been pushed to "master":
> 
> http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=3aaa820446f1ad3d3b0ddc557238b6fb3496dd54
> 
> tdf#91966: In SDK, set CPPU_ENV=mscx for 64-bit Windows

If someone confirms that that (blind) fix to the SDK's settings/settings.mk actually helps, it can be backported to 5.1.6/5.2.2.
Comment 11 Victor Laskurain 2016-09-12 14:35:10 UTC
I would be glad to give it a try but I failed to find any build for Windows x64 at http://dev-builds.libreoffice.org/daily/master/. Is that the right place to find daily builds for this platform?
Comment 12 Stephan Bergmann 2016-09-12 14:46:17 UTC
(I have no idea where such master test builds are supposed to show up exactly; hopefully somebody else can give that information.  Lacking that, what you could do to check the usefulness of the fix is to manually apply the few-lines change of <https://cgit.freedesktop.org/libreoffice/core/commit/?id=3aaa820446f1ad3d3b0ddc557238b6fb3496dd54> to a settings/settings.mk of an older LO/SDK installation.)
Comment 13 Victor Laskurain 2016-09-13 15:25:09 UTC
After applying the changes manually as suggested by Stephan CPPU_CURRENT_LANGUAGE_BINDING_NAME has the correct value.
Comment 14 Commit Notification 2016-09-13 17:29:49 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f09fd93be5d3c73d94bf67818f067a70b1594c35&h=libreoffice-5-1

tdf#91966: In SDK, set CPPU_ENV=mscx for 64-bit Windows

It will be available in 5.1.6.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2016-09-13 17:32:37 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=15cc69ef3b20458889901c0c0ac02c5211a21f48&h=libreoffice-5-2

tdf#91966: In SDK, set CPPU_ENV=mscx for 64-bit Windows

It will be available in 5.2.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Commit Notification 2016-09-17 09:15:00 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-5-2-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9e2f22dfab467b41d552fdaeabf9445c5ad34a47&h=libreoffice-5-2-2

tdf#91966: In SDK, set CPPU_ENV=mscx for 64-bit Windows

It will be available in 5.2.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.