jerel/membrane

[example] `membrane_cancel_membrane_task` and `membrane_free_membrane_vec` not in libexample.so

jwinarske opened this issue · 3 comments

Running the dart_example test requires debug build of libexample.so, or Dart FFI complains about not being able to lookup the symbol.

More info

$ dart run
Building package executable... 
Built dart_example:dart_example.
[INFO] example: Starting dart_example application
[FINE] membrane.accounts: Calling Rust `contact` via C `membrane_accounts_contact`
[INFO] membrane: Opening native library libexample.so
[INFO] membrane: Initializing FFI bindings
[FINE] membrane: Initializing Dart_PostCObject
async ThreadId(1)
[FINE] membrane.accounts: Freed arguments to `membrane_accounts_contact`
[FINE] membrane.accounts: Deserializing data from contact
Unhandled exception:
Invalid argument(s): Failed to lookup symbol 'membrane_cancel_membrane_task': /home/joel/development/membrane/dart_example/../example/target/release/libexample.so: undefined symbol: membrane_cancel_membrane_task
#0      DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:34:70)
#1      NativeLibrary._membrane_cancel_membrane_taskPtr (package:dart_example/src/ffi_bindings.dart:874:77)
#2      NativeLibrary._membrane_cancel_membrane_taskPtr (package:dart_example/src/ffi_bindings.dart)
#3      NativeLibrary._membrane_cancel_membrane_task (package:dart_example/src/ffi_bindings.dart:876:47)
#4      NativeLibrary._membrane_cancel_membrane_task (package:dart_example/src/ffi_bindings.dart)
#5      NativeLibrary.membrane_cancel_membrane_task (package:dart_example/src/ffi_bindings.dart:868:12)
#6      AccountsApi.contact (package:dart_example/accounts.dart:2628:21)
<asynchronous suspension>
#7      main (file:///home/joel/development/membrane/dart_example/bin/dart_example.dart:14:13)
<asynchronous suspension>
$ readelf --dyn-syms -W ../example/target/release/libexample.so

Symbol table '.dynsym' contains 159 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_Backtrace@GCC_3.3 (2)
     2: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_GetIPInfo@GCC_4.2.0 (3)
     3: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __errno_location@GLIBC_2.2.5 (4)
     4: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND syscall@GLIBC_2.2.5 (5)
     5: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND ceil@GLIBC_2.2.5 (6)
     6: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND dl_iterate_phdr@GLIBC_2.2.5 (5)
     7: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND nanosleep@GLIBC_2.2.5 (5)
     8: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND getrandom@GLIBC_2.25 (7)
     9: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_RaiseException@GCC_3.0 (8)
    10: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND recv@GLIBC_2.2.5 (4)
    11: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND realpath@GLIBC_2.3 (9)
    12: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND write@GLIBC_2.2.5 (4)
    13: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND __cxa_finalize@GLIBC_2.2.5 (5)
    14: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND strlen@GLIBC_2.2.5 (5)
    15: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_mutexattr_destroy@GLIBC_2.2.5 (4)
    16: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __xpg_strerror_r@GLIBC_2.3.4 (10)
    17: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND epoll_wait@GLIBC_2.3.2 (11)
    18: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_join@GLIBC_2.2.5 (4)
    19: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND posix_memalign@GLIBC_2.2.5 (5)
    20: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getcwd@GLIBC_2.2.5 (5)
    21: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND writev@GLIBC_2.2.5 (5)
    22: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_attr_getguardsize@GLIBC_2.2.5 (4)
    23: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND memset@GLIBC_2.2.5 (5)
    24: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND abort@GLIBC_2.2.5 (5)
    25: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND munmap@GLIBC_2.2.5 (5)
    26: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_create@GLIBC_2.2.5 (4)
    27: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND fcntl@GLIBC_2.2.5 (5)
    28: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_key_create@GLIBC_2.2.5 (4)
    29: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND __cxa_thread_atexit_impl@GLIBC_2.18 (12)
    30: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_SetGR@GCC_3.0 (8)
    31: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND sysconf@GLIBC_2.2.5 (5)
    32: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_attr_setstacksize@GLIBC_2.2.5 (4)
    33: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND calloc@GLIBC_2.2.5 (5)
    34: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_attr_getstack@GLIBC_2.2.5 (4)
    35: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_mutex_unlock@GLIBC_2.2.5 (4)
    36: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND waitpid@GLIBC_2.2.5 (5)
    37: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_GetDataRelBase@GCC_3.0 (8)
    38: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND memcpy@GLIBC_2.14 (13)
    39: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND lseek64@GLIBC_2.2.5 (4)
    40: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND socketpair@GLIBC_2.2.5 (5)
    41: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_self@GLIBC_2.2.5 (5)
    42: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND clock_gettime@GLIBC_2.17 (14)
    43: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND bcmp@GLIBC_2.2.5 (5)
    44: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_detach@GLIBC_2.2.5 (4)
    45: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND readlink@GLIBC_2.2.5 (5)
    46: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND memchr@GLIBC_2.2.5 (5)
    47: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_FindEnclosingFunction@GCC_3.3 (2)
    48: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_mutex_destroy@GLIBC_2.2.5 (4)
    49: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND free@GLIBC_2.2.5 (5)
    50: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_GetIP@GCC_3.0 (8)
    51: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_attr_init@GLIBC_2.2.5 (5)
    52: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND getenv@GLIBC_2.2.5 (5)
    53: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND eventfd@GLIBC_2.7 (15)
    54: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND sigaction@GLIBC_2.2.5 (4)
    55: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __fxstat64@GLIBC_2.2.5 (5)
    56: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND prctl@GLIBC_2.2.5 (5)
    57: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_getattr_np@GLIBC_2.2.5 (4)
    58: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND epoll_create1@GLIBC_2.9 (16)
    59: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_rwlock_rdlock@GLIBC_2.2.5 (4)
    60: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND malloc@GLIBC_2.2.5 (5)
    61: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND statx@GLIBC_2.28 (17)
    62: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_key_delete@GLIBC_2.2.5 (4)
    63: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND epoll_ctl@GLIBC_2.3.2 (11)
    64: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_mutexattr_init@GLIBC_2.2.5 (4)
    65: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_getspecific@GLIBC_2.2.5 (4)
    66: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __xstat64@GLIBC_2.2.5 (5)
    67: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND read@GLIBC_2.2.5 (4)
    68: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND sched_yield@GLIBC_2.2.5 (5)
    69: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_mutex_lock@GLIBC_2.2.5 (4)
    70: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_GetLanguageSpecificData@GCC_3.0 (8)
    71: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_mutex_init@GLIBC_2.2.5 (4)
    72: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND sched_getaffinity@GLIBC_2.3.4 (10)
    73: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __libc_current_sigrtmax@GLIBC_2.2.5 (4)
    74: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_GetTextRelBase@GCC_3.0 (8)
    75: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_DeleteException@GCC_3.0 (8)
    76: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND mprotect@GLIBC_2.2.5 (5)
    77: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND memrchr@GLIBC_2.2.5 (5)
    78: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND memmove@GLIBC_2.2.5 (5)
    79: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_rwlock_unlock@GLIBC_2.2.5 (4)
    80: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND realloc@GLIBC_2.2.5 (5)
    81: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_attr_destroy@GLIBC_2.2.5 (5)
    82: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_GetRegionStart@GCC_3.0 (8)
    83: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __tls_get_addr@GLIBC_2.3 (18)
    84: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND open64@GLIBC_2.2.5 (4)
    85: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_deregisterTMCloneTable
    86: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_Resume@GCC_3.0 (8)
    87: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND mmap@GLIBC_2.2.5 (5)
    88: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_SetIP@GCC_3.0 (8)
    89: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_mutexattr_settype@GLIBC_2.2.5 (4)
    90: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND pthread_setspecific@GLIBC_2.2.5 (4)
    91: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND _Unwind_GetCFA@GCC_3.3 (2)
    92: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND dlsym@GLIBC_2.2.5 (19)
    93: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND sigaltstack@GLIBC_2.2.5 (5)
    94: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
    95: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_registerTMCloneTable
    96: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND close@GLIBC_2.2.5 (4)
    97: 0000000000064220   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_u8
    98: 0000000000098d60    35 FUNC    GLOBAL DEFAULT   12 free_zero_copy_buffer_u32
    99: 0000000000063960   802 FUNC    GLOBAL DEFAULT   12 membrane_accounts_options_demo
   100: 0000000000095ea0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_delete_contact
   101: 000000000006a4a0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_slow_stream
   102: 0000000000098d90    35 FUNC    GLOBAL DEFAULT   12 free_zero_copy_buffer_i64
   103: 0000000000067210   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_int
   104: 0000000000095610   703 FUNC    GLOBAL DEFAULT   12 membrane_accounts_contacts
   105: 0000000000064d60   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_u32
   106: 00000000000e3940   697 FUNC    GLOBAL DEFAULT   12 rust_eh_personality
   107: 0000000000098d60    35 FUNC    GLOBAL DEFAULT   12 free_zero_copy_buffer_i32
   108: 0000000000066bc0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_string
   109: 0000000000098ee0    11 FUNC    GLOBAL DEFAULT   12 store_dart_post_cobject
   110: 00000000000696a0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_optional_enum_arg
   111: 0000000000066f40   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_bool
   112: 0000000000067d50   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_option_struct
   113: 0000000000068b60   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_optional_vec_arg
   114: 0000000000065b70   733 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_bool
   115: 0000000000062ce0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_contact_os_thread
   116: 0000000000065030   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_i64
   117: 0000000000098d10    26 FUNC    GLOBAL DEFAULT   12 free_zero_copy_buffer_u8
   118: 0000000000064a90   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_i32
   119: 00000000000693d0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_enum_arg
   120: 0000000000063f50   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_i8
   121: 0000000000098d90    35 FUNC    GLOBAL DEFAULT   12 free_zero_copy_buffer_f64
   122: 0000000000098d40    31 FUNC    GLOBAL DEFAULT   12 free_zero_copy_buffer_u16
   123: 0000000000098d60    35 FUNC    GLOBAL DEFAULT   12 free_zero_copy_buffer_f32
   124: 00000000000958d0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_contact
   125: 0000000000062010   703 FUNC    GLOBAL DEFAULT   12 membrane_accounts_contact_panic
   126: 0000000000068890   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_option_float
   127: 000000000006a770   719 FUNC    GLOBAL DEFAULT   12 membrane_locations_get_location
   128: 0000000000069100   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_filter_arg
   129: 0000000000068e30   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_optional_float_arg
   130: 0000000000069970   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_enum_return
   131: 00000000000655d0   720 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_f64
   132: 0000000000069f00   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_slow_function
   133: 00000000000647c0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_u16
   134: 0000000000063260   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_contact_async_emitter
   135: 0000000000098d40    31 FUNC    GLOBAL DEFAULT   12 free_zero_copy_buffer_i16
   136: 0000000000068020   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_option_string
   137: 00000000000685c0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_option_int
   138: 0000000000065e50   703 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_error
   139: 0000000000065300   720 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_f32
   140: 0000000000067a80   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_vec_option
   141: 0000000000098d10    26 FUNC    GLOBAL DEFAULT   12 free_zero_copy_buffer_i8
   142: 0000000000095ba0   760 FUNC    GLOBAL DEFAULT   12 membrane_accounts_update_contact
   143: 00000000000622d0   703 FUNC    GLOBAL DEFAULT   12 membrane_accounts_contact_stream_panic
   144: 00000000000682f0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_option_bool
   145: 00000000000674e0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_float
   146: 0000000000069c40   703 FUNC    GLOBAL DEFAULT   12 membrane_accounts_enum_data
   147: 00000000000663e0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_more_types
   148: 00000000000658a0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_string
   149: 00000000000644f0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_i16
   150: 0000000000066110   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec
   151: 00000000000666b0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_struct
   152: 0000000000062a20   703 FUNC    GLOBAL DEFAULT   12 membrane_accounts_contact_sync
   153: 0000000000098d90    35 FUNC    GLOBAL DEFAULT   12 free_zero_copy_buffer_u64
   154: 0000000000063690   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_contact_async_stream_emitter
   155: 0000000000063c90   703 FUNC    GLOBAL DEFAULT   12 membrane_accounts_scalar_empty
   156: 000000000006a1d0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_slow_function_two
   157: 0000000000062590   687 FUNC    GLOBAL DEFAULT   12 membrane_accounts_contact_sync_panic
   158: 00000000000677b0   719 FUNC    GLOBAL DEFAULT   12 membrane_accounts_vec_vec

Looks like the linker is removing them.