agracio / edge-js

Run .NET and Node.js code in-process on Windows, macOS, and Linux
MIT License
659 stars 97 forks source link

undefined symbol: GetModuleFileName' #113

Closed ghost closed 3 years ago

ghost commented 4 years ago

OS: linux 16.04.1-Ubuntu Node: 14.4.0 Mono: 6.10.0.104 edge-js: 14.3.1

Wrote simpliest hello world, it worked with dotnet but not with mono.

Code:

  1 const edge = require('edge-js');
  2 
  3 const  hello  = edge.func(`
  4   #r "System.Console.dll"
  5 
  6   using System;
  7   using System.Threading.Tasks;
  8 
  9   public class Startup {
 10     public async Task<object> Invoke(dynamic input) {
 11       Console.WriteLine("Hello world!");
 12       return "done";
 13     }
 14   }
 15 `);
 16 
 17 hello('Javascript', (err, res) => {
 18   if (err) {
 19     throw err;
 20   }
 21   console.log(res);
 22 });

Error stack:

yukinohito@yukinohito-Linux-Mint-18 Fri Aug 28 23:32:04 ~/myApps/edge-js-test $ npm run start-mono

> edge-js-test@1.0.0 start-mono /home/yukinohito/myApps/edge-js-test
> MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll LD_PRELOAD="libmono-2.0.so" node index.js

Mono: DllImport attempting to load: '/usr/lib/../lib/libmono-native.so'.
Mono: DllImport loaded library '/usr/lib/../lib/libmono-native.so'.
Mono: DllImport searching in: '/usr/lib/../lib/libmono-native.so' ('/usr/lib/../lib/libmono-native.so').
Mono: Searching for 'SystemNative_GetNonCryptographicallySecureRandomBytes'.
Mono: Probing 'SystemNative_GetNonCryptographicallySecureRandomBytes'.
Mono: Found as 'SystemNative_GetNonCryptographicallySecureRandomBytes'.
Mono: DllImport searching in: '/usr/lib/../lib/libmono-native.so' ('/usr/lib/../lib/libmono-native.so').
Mono: Searching for 'SystemNative_LChflagsCanSetHiddenFlag'.
Mono: Probing 'SystemNative_LChflagsCanSetHiddenFlag'.
Mono: Found as 'SystemNative_LChflagsCanSetHiddenFlag'.
Mono: DllImport searching in: '/usr/lib/../lib/libmono-native.so' ('/usr/lib/../lib/libmono-native.so').
Mono: Searching for 'SystemNative_Stat2'.
Mono: Probing 'SystemNative_Stat2'.
Mono: Found as 'SystemNative_Stat2'.
Mono: DllImport searching in: '/usr/lib/../lib/libmono-native.so' ('/usr/lib/../lib/libmono-native.so').
Mono: Searching for 'SystemNative_LStat2'.
Mono: Probing 'SystemNative_LStat2'.
Mono: Found as 'SystemNative_LStat2'.
Mono: DllImport searching in: '/usr/lib/../lib/libmono-native.so' ('/usr/lib/../lib/libmono-native.so').
Mono: Searching for 'SystemNative_ConvertErrorPlatformToPal'.
Mono: Probing 'SystemNative_ConvertErrorPlatformToPal'.
Mono: Found as 'SystemNative_ConvertErrorPlatformToPal'.
Mono: DllImport attempting to load: '__Internal'.
Mono: DllImport loaded library '(null)'.
Mono: DllImport searching in: '__Internal' ('(null)').
Mono: Searching for 'GetModuleFileName'.
Mono: Probing 'GetModuleFileName'.
Mono: Could not find 'GetModuleFileName' due to 'node: undefined symbol: GetModuleFileName'.
Mono: Probing 'GetModuleFileNameA'.
Mono: Could not find 'GetModuleFileNameA' due to 'node: undefined symbol: GetModuleFileNameA'.
Mono: Probing 'GetModuleFileName'.
Mono: Could not find 'GetModuleFileName' due to 'node: undefined symbol: GetModuleFileName'.
Mono: Probing 'GetModuleFileNameA'.
Mono: Could not find 'GetModuleFileNameA' due to 'node: undefined symbol: GetModuleFileNameA'.
Mono: DllImport searching in: '/usr/lib/../lib/libmono-native.so' ('/usr/lib/../lib/libmono-native.so').
Mono: Searching for 'SystemNative_Unlink'.
Mono: Probing 'SystemNative_Unlink'.
Mono: Found as 'SystemNative_Unlink'.

/home/yukinohito/myApps/edge-js-test/node_modules/edge-js/lib/edge.js:183
    return edge.initializeClrFunc(options);
                ^
Error: Unable to compile C# code.
----> Errors when compiling as a CLR library:
error : /bin/sh: symbol lookup error: /usr/lib/libmono-2.0.so: undefined symbol: __cxa_begin_catch
----> Errors when compiling as a CLR async lambda expression:
error : /bin/sh: symbol lookup error: /usr/lib/libmono-2.0.so: undefined symbol: __cxa_begin_catch
    at Object.exports.func (/home/yukinohito/myApps/edge-js-test/node_modules/edge-js/lib/edge.js:183:17)
    at Object.<anonymous> (/home/yukinohito/myApps/edge-js-test/index.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  _message: 'Unable to compile C# code.\n' +
    '----> Errors when compiling as a CLR library:\n' +
    'error : /bin/sh: symbol lookup error: /usr/lib/libmono-2.0.so: undefined symbol: __cxa_begin_catch\n' +
    '----> Errors when compiling as a CLR async lambda expression:\n' +
    'error : /bin/sh: symbol lookup error: /usr/lib/libmono-2.0.so: undefined symbol: __cxa_begin_catch',
  _HResult: -2146233079,
  captured_traces: null,
  Message: 'Unable to compile C# code.\n' +
    '----> Errors when compiling as a CLR library:\n' +
    'error : /bin/sh: symbol lookup error: /usr/lib/libmono-2.0.so: undefined symbol: __cxa_begin_catch\n' +
    '----> Errors when compiling as a CLR async lambda expression:\n' +
    'error : /bin/sh: symbol lookup error: /usr/lib/libmono-2.0.so: undefined symbol: __cxa_begin_catch',
  Data: {},
  InnerException: null,
  TargetSite: {},
  StackTrace: '  at EdgeCompiler.CompileFunc (System.Collections.Generic.IDictionary`2[TKey,TValue] parameters) [0x0029e] in <d306398b84a94ef7b241a9736451f592>:0 \n' +
    '  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)\n' +
    '  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <a17fa1457c5d44f2885ac746c1764ea5>:0 ',
  HelpLink: null,
  Source: 'edge-cs',
  RemoteStackTrace: null,
  HResult: -2146233079,
  name: 'System.InvalidOperationException'
}
agracio commented 3 years ago

Mono is no longer actively supported but works in most cases. I would recommend using pre-compiled dlls.