-
Notifications
You must be signed in to change notification settings - Fork 385
Doesn't run on linux (Kubuntu 18.10), but compiles without any issues #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's the same problem I had in #47 or? If so, I haven't figured out what the problem was/is. Maybe dlopen can't load a dependency? |
Does it successfully import libdl.so? ReClass.NET/ReClass.NET/Native/NativeMethods.Unix.cs Lines 13 to 14 in a41ad33
|
I think so. dlopen just returns IntPtr.Zero. Are you able to compile ReClass.NET? You could add a dlerror call to see if the error message tells something usefull. The new code could look like this: public IntPtr LoadLibrary(string fileName)
{
var handle = dlopen(fileName, RTLD_NOW);
if (handle.IsNull())
{
throw new ...Exception(dlerror());
}
return handle;
} With the equivalent for Windows and GetLastError (or better use DllImportAttribute.SetLastError). After that ReClass.NET/ReClass.NET/Core/InternalCoreFunctions.cs Lines 52 to 56 in b22d79b
and ReClass.NET/ReClass.NET/Plugins/PluginManager.cs Lines 136 to 140 in b22d79b
should be changed to use the exception. |
Yes, as I stated in the title, I am able to compile. The code you have provided does not compile due to the fact that IntPtr doesn't contain the IsNull definition.
Edit: I have fixed the code and the exception returned the following message: |
Here is ReClass.NET/ReClass.NET/Extensions/IntPtrExtensions.cs Lines 9 to 14 in 805d618
So now it is clear why the library can't be loaded. But why does this message occur? Shouldn't the linker detect this error at compile time? |
Running the program with "sudo MONO_LOG_LEVEL="debug" MONO_LOG_MASK="dll" mono ReClass.NET.exe" printed some more interesting information: https://gist.github.com/FilipeSilvens/f373e89453ecc084cf65af08e15d29ae |
The logged exception is just the exception you have created or not? |
It is. I replaced the LoadLibrary code with this: public IntPtr LoadLibrary(string fileName)
{
dlerror(); // clears any previous errors
var handle = dlopen(fileName, RTLD_NOW | RTLD_GLOBAL);
var errorPtr = dlerror();
if (errorPtr != IntPtr.Zero)
{
throw new Exception("dlopen exception: " + Marshal.PtrToStringAnsi(errorPtr));
}
return handle;
} and imported dlerror, of course. |
I never got past failing to open NativeCore.so it's always not found for me, so yea it's related to #47 . I'm also on Ubuntu 17.10 though which is not officially supported by mono it seems, im running the packages for 16.04 which yea is probably not good so don't rely on me.
|
@stevemk14ebr can you replace the LoadLibrary function in NativeMethods.Unix.cs with the one I posted above to see if the error is the same on different ubuntu versions? Also don't forget to import dlerror above [DllImport("libdl.so")]
private static extern IntPtr dlerror(); |
yup it is:
|
the offending symbol is: std::__codecvt_utf8_utf16_base<char16_t>::do_out(__mbstate_t&, char16_t const*, char16_t const*, char16_t const*&, char*, char*, char*&) const but there's alot of undefined symbols, something is wrong in linking i think:
|
#84 will catch these at link time, still don't know why there's so many undefined though. |
I have managed to fix the undefined symbols, but now I get an out of range exception when I start the program. The original issue which is also present in #47 can be fixed by linking |
Yup, all works good now. Thank you for helping :D |
Thank you @stevemk14ebr for your help! |
Welcome 🎉 |
Unhandled Exception: System.IO.FileNotFoundException: Failed to load native core functions! Couldnt find at location /home/shiruba/ReClass.NET/ReClass.NET/bin/Debug/x64/NativeCore.so
Compiled and then moved the NativeCore shared object to the directory of the executable and ran it with mono (tried with root as well).
Distro: Kubuntu 18.10
Mono version: 5.18.0.225
The text was updated successfully, but these errors were encountered: