nativelibs4java / BridJ

BridJ: blazing fast Java / C / C++ interop
https://code.google.com/archive/p/bridj/
Other
299 stars 77 forks source link

BridJ 0.6 regression compared to 0.6-SNAPSHOT #11

Open ochafik opened 9 years ago

ochafik commented 9 years ago

From @trandi on November 14, 2011 16:49

As per the discussion here: http://groups.google.com/group/nativelibs4java/browse_thread/thread/5baf2df02ad5425f?pli=1

There seem to have been a regression in the way the 0.6 version handles the loading of the library.

Here's the verbose output obtained with BRIDJ_VERY_VERBOSE=1.

As already mentioned, the EXACT same configuration / code works with 0.6-SNAPSHOT (from the 24th of Oct) but if I replace the bridj jar with the 0.6 version (and this is the ONLY change), THEN I get this error :


T E S T S

Running com.markit.quic.dispatchapi.PRDCTest 14-Nov-2011 14:42:20 org.bridj.BridJ log INFO: Embedded paths for library bridj : [org/bridj/lib/win64/ bridj.dll, lib/win64/bridj.dll] 14-Nov-2011 14:42:20 org.bridj.BridJ log INFO: Loading library C:\Users\DAN\AppData\Local\Temp \bridj.dll6524064044671421676.dll 14-Nov-2011 14:42:20 org.bridj.BridJ log INFO: Loaded library C:\Users\DAN\AppData\Local\Temp \bridj.dll6524064044671421676.dll 14-Nov-2011 14:42:20 org.bridj.BridJ log INFO: Runtime for com.markit.quic.dispatchapi.QuicLib : org.bridj.CRuntime 14-Nov-2011 14:42:20 org.bridj.AbstractBridJRuntime log INFO: Registering type com.markit.quic.dispatchapi.QuicLib 14-Nov-2011 14:42:20 org.bridj.BridJ log INFO: Looking for library 'QuicDispatchCpp' in paths [D:/Program Files/ quic/quic/quic-platform/v3.10/bin, null, .,........ D:\Program Files \groovy-1.8.0\bin, D:\Program Files\maven\bin, D:\Program Files\apache- ant-1.8.1\bin, D:\cygwin\bin, D:\Program Files, D:\Program Files \Fortify 360 v2.6.5\bin, D:\Program Files\fortifyclient\bin, C: \progsDan\apache-ant-1.8.1\bin, D:\Program Files\Java\jdk1.6.0_25\jre \bin] 14-Nov-2011 14:42:20 org.bridj.AbstractBridJRuntime log SEVERE: Method public static native org.bridj.Pointer com.markit.quic.dispatchapi.QuicLib.QuicCreateDispatch() cannot be mapped : java.lang.RuntimeException: Library 'QuicDispatchCpp' was not loaded successfully from file 'D:\Program Files\quic\quic\quic-platform \v3.10\bin\QuicDispatchCpp.dll' java.lang.RuntimeException: Library 'QuicDispatchCpp' was not loaded successfully from file 'D:\Program Files\quic\quic\quic-platform \v3.10\bin\QuicDispatchCpp.dll' at org.bridj.BridJ.getNativeLibrary(BridJ.java:854) at org.bridj.BridJ.getNativeLibrary(BridJ.java:833) at org.bridj.BridJ.getNativeLibrary(BridJ.java:451) at org.bridj.CRuntime.register(CRuntime.java:333) at org.bridj.CRuntime.register(CRuntime.java:246) at org.bridj.BridJ.register(BridJ.java:286) at org.bridj.BridJ.register(BridJ.java:155) at com.markit.quic.dispatchapi.QuicLib.(QuicLib.java: 35) at com.markit.quic.dispatchapi.Quic.(Quic.java:25) at com.markit.quic.dispatchapi.PRDCTest.test(PRDCTest.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod $1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable. java: 15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.j ava: 42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.ja va: 20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java: 263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.ja va: 68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.ja va: 47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java: 60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java: 50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java: 222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java: 62) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(A bstractDirectoryTestSuite.java: 140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abstract DirectoryTestSuite.java: 127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Surefire Booter.java: 345) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java: 1009) 14-Nov-2011 14:42:20 org.bridj.AbstractBridJRuntime log

Here is the Java class also :

@Library("QuicDispatchCpp") class QuicLib { private static final Logger log = Logger.getLogger(QuicLib.class);

// Must point to the directory where QuicDispatchCpp.dll lives.
// Alternatively the system will search for the .dll on the path
public static final String QUIC_LIB_PATH_PROP = "quic.library.path";

private static QuicLib instance;

static {
    final String quicLibPath = System.getProperty(QUIC_LIB_PATH_PROP);
    if(quicLibPath != null && !"".equals(quicLibPath)) {
        BridJ.addLibraryPath(quicLibPath);
    }else{
        log.warn("Property " + QuicLib.QUIC_LIB_PATH_PROP + " has NOT been set. \n" +
                "It's likely we won't find the required QuicDispatchCpp.dll, unless it's on the class path ! \n" +
                "If you see a UnsatisfiedLinkError, you'll know why ! :)");
    }

    BridJ.register();
}

native public static Pointer<IQuicDispatch> QuicCreateDispatch();
native void QuicReleaseDispatch(Pointer<IQuicDispatch> piDispatch);

native Pointer<IDispatchVariant> QuicCreateDispatchVariant();
native void QuicReleaseDispatchVariant(Pointer<IDispatchVariant> piVariant);
native void QuicLiberateDispatchVariant(Pointer<IDispatchVariant> piVariant);

/**
 * Singleton factory method
 * @return The only and staticly unique instance of the library.
 */
public static QuicLib instance(){
    if(instance == null){
        instance = new QuicLib();
    }

    return instance;
}

}

I get the error when doing QuicLib.QuicCreateDispatch();

Thanks, dan

Copied from original issue: ochafik/nativelibs4java#201

ochafik commented 9 years ago

Hi Dan,

I've uploaded a new 0.7-SNAPSHOT that should add some extra logging, which might help understand what's going on (the log might appear at the very end of the process output). Please let me know if it says something new...

Cheers

ochafik commented 9 years ago

From @trandi on November 15, 2011 16:55

Hi Oliver,

Thank you for your quick reply !

Here's the log with the new 0.7-SNAPSHOT lib, I personally don't see any difference... lol... :)


T E S T S

Running com.markit.quic.dispatchapi.PRDCTest 15-Nov-2011 16:52:55 org.bridj.BridJ log INFO: Embedded paths for library bridj : [org/bridj/lib/win64/bridj.dll, lib/win64/bridj.dll] 15-Nov-2011 16:52:55 org.bridj.BridJ log INFO: Loading library C:\Users\DAN~1.OPR\AppData\Local\Temp\bridj.dll311145883198374554.dll 15-Nov-2011 16:52:55 org.bridj.BridJ log INFO: Loaded library C:\Users\DAN~1.OPR\AppData\Local\Temp\bridj.dll311145883198374554.dll 15-Nov-2011 16:52:55 org.bridj.BridJ log INFO: Runtime for com.markit.quic.dispatchapi.QuicLib : org.bridj.CRuntime 15-Nov-2011 16:52:55 org.bridj.AbstractBridJRuntime log INFO: Registering type com.markit.quic.dispatchapi.QuicLib 15-Nov-2011 16:52:55 org.bridj.BridJ log INFO: Looking for library 'QuicDispatchCpp' in paths [D:/Program Files/quic/quic/quic-platform/v3.10/bin, null, ., C:\cygwin\bin, C:\cygwin\bin, C:\cygwin\usr\sbin, D:\Program Files\Fortify 360 v2.6.5\PTA, D:\Program Files\Fortify 360 v2.6.5\bin, D:\Program Files (x86)\Java\jre6\bin\client, D:\Program Files\Java\jdk1.6.0_25\bin, C:\oracle\product\10.2.0\client_1\bin, C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0, D:\Program Files (x86)\WinSCP, D:\Program Files\TortoiseSVN\bin, D:\Program Files\TortoiseHg, C:\Program Files\Curl, D:\Program Files\gradle\bin, D:\Program Files\svn, D:\Program Files\groovy-1.8.0\bin, D:\Program Files\maven\bin, D:\Program Files\apache-ant-1.8.1\bin, D:\cygwin\bin, D:\Program Files, D:\Program Files\Fortify 360 v2.6.5\bin, D:\Program Files\fortifyclient\bin, C:\progsDan\apache-ant-1.8.1\bin, D:\Program Files\Java\jdk1.6.0_25\jre\bin, ., C:\Windows\Sun\Java\bin, C:\Windows\system32, C:\Windows, C:\cygwin\bin, C:\cygwin\bin, C:\cygwin\usr\sbin, D:\Program Files\Fortify 360 v2.6.5\PTA, D:\Program Files\Fortify 360 v2.6.5\bin, D:\Program Files (x86)\Java\jre6\bin\client, D:\Program Files\Java\jdk1.6.0_25\bin, C:\oracle\product\10.2.0\client_1\bin, C:\Windows\system32, C:\Windows, C:\Windows\System32\Wbem, C:\Windows\System32\WindowsPowerShell\v1.0, D:\Program Files (x86)\WinSCP, D:\Program Files\TortoiseSVN\bin, D:\Program Files\TortoiseHg, C:\Program Files\Curl, D:\Program Files\gradle\bin, D:\Program Files\svn, D:\Program Files\groovy-1.8.0\bin, D:\Program Files\maven\bin, D:\Program Files\apache-ant-1.8.1\bin, D:\cygwin\bin, D:\Program Files, D:\Program Files\Fortify 360 v2.6.5\bin, D:\Program Files\fortifyclient\bin, C:\progsDan\apache-ant-1.8.1\bin, D:\Program Files\Java\jdk1.6.0_25\jre\bin] 15-Nov-2011 16:52:55 org.bridj.AbstractBridJRuntime log SEVERE: Method public static native org.bridj.Pointer com.markit.quic.dispatchapi.QuicLib.QuicCreateDispatch() cannot be mapped : java.lang.RuntimeException: Library 'QuicDispatchCpp' was not loaded successfully from file 'D:\Program Files\quic\quic\quic-platform\v3.10\bin\QuicDispatchCpp.dll' java.lang.RuntimeException: Library 'QuicDispatchCpp' was not loaded successfully from file 'D:\Program Files\quic\quic\quic-platform\v3.10\bin\QuicDispatchCpp.dll' at org.bridj.BridJ.getNativeLibrary(BridJ.java:850) at org.bridj.BridJ.getNativeLibrary(BridJ.java:829) at org.bridj.BridJ.getNativeLibrary(BridJ.java:457) at org.bridj.CRuntime.register(CRuntime.java:353) at org.bridj.CRuntime.register(CRuntime.java:266) at org.bridj.BridJ.register(BridJ.java:289) at org.bridj.BridJ.register(BridJ.java:158) at com.markit.quic.dispatchapi.QuicLib.(QuicLib.java:35) at com.markit.quic.dispatchapi.Quic.(Quic.java:25) at com.markit.quic.dispatchapi.PRDCTest.test(PRDCTest.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

...........................

testEnvConfigurationHome(com.markit.quic.dispatchapi.QuicLibTest) testEnvConfigurationHome(com.markit.quic.dispatchapi.QuicLibTest) testModule(com.markit.quic.dispatchapi.QuicLibTest) testModule(com.markit.quic.dispatchapi.QuicLibTest) testVariantLowLevel(com.markit.quic.dispatchapi.QuicLibTest) testVariantLowLevel(com.markit.quic.dispatchapi.QuicLibTest) testVariantLowLevelDates(com.markit.quic.dispatchapi.QuicLibTest) testVariantLowLevelDates(com.markit.quic.dispatchapi.QuicLibTest) testVariantHighLevel(com.markit.quic.dispatchapi.QuicLibTest) testVariantHighLevel(com.markit.quic.dispatchapi.QuicLibTest) testMultiThreadingSameFunc(com.markit.quic.dispatchapi.QuicLibTest) testMultiThreadingSameFunc(com.markit.quic.dispatchapi.QuicLibTest) testMultiThreadingDiffFunc(com.markit.quic.dispatchapi.QuicLibTest) testMultiThreadingDiffFunc(com.markit.quic.dispatchapi.QuicLibTest) test(com.markit.quic.dispatchapi.QuicTest) test(com.markit.quic.dispatchapi.QuicTest) testCallback(com.markit.quic.dispatchapi.QuicTest) testCallback(com.markit.quic.dispatchapi.QuicTest)

Tests run: 21, Failures: 0, Errors: 21, Skipped: 0

BridJ: LoadLibrary error : The specified module could not be found.

BridJ: LoadLibrary error : The specified module could not be found.

BridJ: LoadLibrary error : The specified module could not be found.

BridJ: LoadLibrary error : The specified module could not be found.

BridJ: LoadLibrary error : The specified module could not be found.

BridJ: LoadLibrary error : The specified module could not be found.

Let me know if you need anything else from me ? Dan