core icon indicating copy to clipboard operation
core copied to clipboard

Symbol lookup error while loading .so file in .Net Core application

Open ms0713 opened this issue 6 years ago • 5 comments

Symbol lookup error

I am loading a.so file in my .Net Core 3.1 console application using DllImport. My a.so file depends on b.so, c.so and d.so. Also b.so depends on e.so.

While running my application on Linux machine (Red Hat 7.0), it gives me error like following:
dotnet : symbol lookup error /root/Path of My Application/a.so : undefined symbol : my_symbol_name

Note: my_symbol_name is defined in b.so which is called from a.so.

I am using Visual Studio 2019 version16.7.1 for development. OS : Windows Server 2012 R2 Application running platform : Linux (Red Hat 7.0) .Net Core Version 3.1.401

ms0713 avatar Aug 17 '20 09:08 ms0713

As a random bystander, I am curious as to what is causing this. What does ldd /root/Path of My Application/a.so say? Can it see and resolve the dependencies on b.so, c.so and d.so?

omajid avatar Aug 17 '20 13:08 omajid

@mikem8361 @janvorli is this something you can help with?

carlossanlop avatar Nov 06 '20 19:11 carlossanlop

This isn't exactly my area, but it looks like you are doing a pinvoke (DllImport) I assume. Is the function you are pinvoking to "my_symbol_name". Is that symbol an "extern C" public symbol?

mikem8361 avatar Nov 06 '20 20:11 mikem8361

Issue is resolved. Thanks to everyone for putting your valuable efforts.

Issue was resolved by bundling all .so files in single package(linking them together). I think it was not on .Net Core side.

ms0713 avatar Nov 09 '20 03:11 ms0713

Thanks for letting us know. Closing the issue.

mairaw avatar Nov 09 '20 04:11 mairaw