raise "Unable to load shared library 'kernel32.dll' or one of its dependencies" on ubuntu
See original GitHub issuePrerequisites
The issue tracker is used to report bugs and request new features, NOT to ask questions.
Questions should be posted to the users mailing list which can be accessed at https://ironpython.groups.io/g/users.
- Are you running the latest version?
- Are you reporting to the correct repository?
- Did you perform a cursory search?
Description
I build the ironPython with asp.net core and run with Kestrel. I need run python script in ubuntu to call darknet(yolo) which is a AI lib. When the script call get_metadata in libdarknet.so and return a c pointer ironPython throw exception message “Unable to load shared library ‘kernel32.dll’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libkernel32.dll: cannot open shared object file: No such file or directory”.
Stack Trace list blow
System.DllNotFoundException: Unable to load shared library ‘kernel32.dll’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libkernel32.dll: cannot open shared object file: No such file or directory
at IronPython.Modules.NativeFunctions.CopyMemory(IntPtr destination, IntPtr source, IntPtr Length)
at IronPython.Modules.ModuleOps.CreateCData(IntPtr dataAddress, PythonType type)
at InteropInvoker(IntPtr , Object , Object[] )
at CallSite.Target(Closure , CallSite , Object , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at Microsoft.Scripting.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at Microsoft.Scripting.Interpreter.FuncCallInstruction6.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
at PythonApplication.PythonApp.Execute(IContainerContext context, CancellationToken cancellationToken) in J:\工作区\TFSService\Eos\SjtuAi\PythonContainer\PythonApp.cs:line 28
fail: Microsoft.AspNetCore.Server.Kestrel[13]
=> ConnectionId:0HLJT8HECDLTL => RequestId:0HLJT8HECDLTL:00000001 RequestPath:/darknet/darknet.py
Connection id “0HLJT8HECDLTL”, Request id “0HLJT8HECDLTL:00000001”: An unhandled exception was thrown by the application.
Steps to Reproduce
- [First Step]
- [Second Step]
- [and so on…]
Expected behavior: [What you expected to happen]
Actual behavior: [What actually happened]
Versions
You can get this information from executing ipy -V.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)

Top Related StackOverflow Question
In theory https://github.com/IronLanguages/ironpython2/pull/579 should resolve this issue, however I haven’t tried with your specific example.
Glad it’s working. Please let us know if you run into other issues.