Puzzling JNI error message

R

Roedy Green

Exception in thread "main" java.lang.UnsatisfiedLinkError:
C:\sys\nativepentium.dll: The application has failed to start because
its side-by-side configuration is incorrect. Please see the
application event log for more detail

"Activation context generation failed for "C:\sys\nativepentium.dll".
Dependent Assembly
Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
could not be found. Please use sxstrace.exe for detailed diagnosis. "

This is a little bit of JNI in a DLL. The program works fine on MY
machine, but not on others.

Microsoft dropped support for Visual C++ studio 6. I had to reinstall
it and now it won't work. So I switched over to the their Visual C++
express.

Perhaps there is some weird thing in it to stop you from writing code
for other machines with it.

Perhaps it uses some library part of C++ not included with the DLL.

The C++ code does no I/O.
 
R

Roland de Ruiter

Exception in thread "main" java.lang.UnsatisfiedLinkError:
C:\sys\nativepentium.dll: The application has failed to start because
its side-by-side configuration is incorrect. Please see the
application event log for more detail
[...]

Google for "The application has failed to start because its side-by-side
configuration is incorrect".
 
T

Tom Anderson

Exception in thread "main" java.lang.UnsatisfiedLinkError:
C:\sys\nativepentium.dll: The application has failed to start because
its side-by-side configuration is incorrect. Please see the
application event log for more detail [...]

Google for "The application has failed to start because its side-by-side
configuration is incorrect".

Which is, incidentally, a brilliantly nonsensical-sounding error message!

tom
 
R

Roedy Green

/MD causes your dll to link against the VC runtime
/MT is for "static" linking. It will make your DLL bigger, but it won't
have the VC runtime dependancy.

With Visual C++ studio 6 I created standalone DLLs. MS no longer
supports it, so it won't run under Vista without updates.

The free replacement Express C++ 8, does some strange things with
DLLs.

Embedded in the DLLs is fluffy INDENTED XML

This points to a "manifest" file (no relation to MFT files) that look
like this with seems to be a set of digital signatures.

Microsoft.VC90.CRT.manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<noInheritable></noInheritable>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT"
version="9.0.30729.1" processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
<file name="msvcr90.dll" hashalg="SHA1"
hash="9785b1c493deb5b2134dc4aef3719cee207001bc"><asmv2:hash
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform
Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>VF5ECUAHPV7EnUf+/UIXMPizPvs=</dsig:DigestValue></asmv2:hash></file>
<file name="msvcp90.dll" hashalg="SHA1"
hash="0f6bbf7fe4fb3fca2cb5b542eca1a1cad051f01c"><asmv2:hash
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform
Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>3Wg+StVMq2uhx7POnAkl2w4dDmY=</dsig:DigestValue></asmv2:hash></file>
<file name="msvcm90.dll" hashalg="SHA1"
hash="7f3290ab2b7444c2b4a9b1fedfdb16466d7a21bb"><asmv2:hash
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform
Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>/YfRn7UQENzdMeoMHxTgdRMiObA=</dsig:DigestValue></asmv2:hash></file>
</assembly>

I would like it if:

1. I could make an JNI app self contained.

2. failing that, that only a few DLLs need to added to the path.

3. failing that the user has to install the entire DLL run time.

What is most annoying is my C++ code does actually need any support
libraries. It is just a bit of _asm stuff. It does not even use the
console.
 
R

Roedy Green

/MD causes your dll to link against the VC runtime
/MT is for "static" linking. It will make your DLL bigger, but it won't
have the VC runtime dependancy.

I have been looking for the equivalent to those in Express 8. I used
to use static linking with Studio 6.
 
R

Roedy Green

Google for "The application has failed to start because its side-by-side
configuration is incorrect".

I thought I had done that, but when I repeated the experiment at you
urging, I found some hints.

Google is so frustrating that the first ten hits or so are usually
other people clearly expressing the same question I have, but without
any responses.
 
R

Roedy Green

Ooops, I thought that was a linker option, but it looks like it's set as a
code generation option in VC 2008.

It is a code generation option that gets passed through to the linker.
They document all sorts of option such as MT and LD, but when you put
them in the slot, the GUI converts them back to non-static options.

Microsoft sells the full blown C++ compiler for $1560.00. So I guess
they had to do something to hobble the free version to encourage
sales.

For now, I am just including documentation telling people they must
pre install the run time.

I seem to recall that you are supposed to be able to put DLLs inside
jars and have them found, in JDK 1.5+. Was this just JWS? I have not
been able to get that to work.
 
R

Roedy Green

For "Runtime Library", you should be able to set that to "Multi-threaded
(/MT)" for your release configuration.

That should let you get your JNI DLL built without the VC Runtime
dependancies.

You are right. The docs suggested you don't get a DLL with /MT, but
when I tried it, it does generate one, and a fairly fat one suggesting
it is statically linking.
 
A

Arne Vajhøj

Roedy said:
I have been looking for the equivalent to those in Express 8. I used
to use static linking with Studio 6.

Both exist in VS 2008 Express alias MS VC++ 9 alias MS C++ 15.

C:\>cl /LD /MT z.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01
for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

z.c
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

/out:z.dll
/dll
/implib:z.lib
z.obj
Creating library z.lib and object z.exp

C:\>dir z.dll
Volume in drive C is ARNEPC3_C
Volume Serial Number is E850-F261

Directory of C:\

11-10-2008 20:28 40.960 z.dll
1 File(s) 40.960 bytes
0 Dir(s) 59.401.162.752 bytes free

C:\>cl /LD /MD z.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01
for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

z.c
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

/out:z.dll
/dll
/implib:z.lib
z.obj
Creating library z.lib and object z.exp

C:\>dir z.dll
Volume in drive C is ARNEPC3_C
Volume Serial Number is E850-F261

Directory of C:\

11-10-2008 20:28 6.144 z.dll
1 File(s) 6.144 bytes
0 Dir(s) 59.401.195.520 bytes free

Arne
 
A

Arne Vajhøj

Roedy said:
Embedded in the DLLs is fluffy INDENTED XML

This points to a "manifest" file (no relation to MFT files) that look
like this with seems to be a set of digital signatures.

Microsoft.VC90.CRT.manifest:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<noInheritable></noInheritable>
<assemblyIdentity type="win32" name="Microsoft.VC90.CRT"
version="9.0.30729.1" processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
<file name="msvcr90.dll" hashalg="SHA1"
hash="9785b1c493deb5b2134dc4aef3719cee207001bc"><asmv2:hash
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform
Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>VF5ECUAHPV7EnUf+/UIXMPizPvs=</dsig:DigestValue></asmv2:hash></file>
<file name="msvcp90.dll" hashalg="SHA1"
hash="0f6bbf7fe4fb3fca2cb5b542eca1a1cad051f01c"><asmv2:hash
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform
Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>3Wg+StVMq2uhx7POnAkl2w4dDmY=</dsig:DigestValue></asmv2:hash></file>
<file name="msvcm90.dll" hashalg="SHA1"
hash="7f3290ab2b7444c2b4a9b1fedfdb16466d7a21bb"><asmv2:hash
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform
Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>/YfRn7UQENzdMeoMHxTgdRMiObA=</dsig:DigestValue></asmv2:hash></file>
</assembly>

How are you building ?

I do not get stuff like that when building a Win32 DLL.

It looks very much as if some .NET stuff has been included.

I am rather confident that you can avoid that by using the proper
command line switches.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top