Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | piertho |
Hi there ! I have some trouble using gdnative on android.
I first compiled Godot bindings as a static library for android using scons.
Then I compiled crypto++ as static for android (using scons again). (I use crypto++ to perform a scrypt hash.
I successfully compiled my GDNative as shared library that uses godot bindings and crypto++.
But when running on my android device, it says :
**ERROR**: Can't resolve symbol godot_gdnative_init. Error: undefined symbol: godot_gdnative_init 01-17 17:43:43.594 17484 17519 E godot : At: drivers/unix/os_unix.cpp:401:get_dynamic_library_symbol_handle() - Method/Function Failed, returning: ERR_CANT_RESOLVE 01-17 17:43:43.595 17484 17519 E godot :
**ERROR**: Failed to obtain godot_gdnative_init symbol 01-17 17:43:43.595 17484 17519 E godot : At: modules/gdnative/gdnative.cpp:177:initialize() - Failed to obtain godot_gdnative_init symbol 01-17 17:43:43.595 17484 17519 E godot :
**ERROR**: No valid library handle, can't get symbol from GDNative object 01-17 17:43:43.595 17484 17519 E godot : At: modules/gdnative/gdnative.cpp:317:get_symbol() - No valid library handle, can't get symbol from GDNative object 01-17 17:43:43.595 17484 17519 E godot :
**ERROR**: No nativescript_init in "res://lib/android/libpasswordEncoder.android.so" found 01-17 17:43:43.595 17484 17519 E godot : At: modules/gdnative/nativescript/nativescript.cpp:1054:init_library() - No nativescript_init in "res://lib/android/libpasswordEncoder.android.so" found 01-17 17:43:43.595 17484 17519 E godot :
**SCRIPT ERROR**: Attempt to call function 'new' in base 'NativeScript' on a null instance. 01-17 17:43:43.595 17484 17519 E godot : At: res://main/backend/PasswordEncoder.gdc:8:_ready() - Attempt to call function 'new' in base 'NativeScript' on a null instance.
It cannot find godot_gdnative_init, which is in my gdnative as extern “C” method
(it also wants libc++_shared.so as dependency in godot, but I don’t really know why, as I am a newbie in C++)
In the output of the nm -gC of the generated library, I have the godot_gdnative_init symbol listed. So I don’t understand why godot cannot find it.
It works on windows, osx, ios, I have not tested linux yet. But I really do not understand what happens with android.
Here are my scons script I use.
For godot bindings :
For crypto++ (by the way I use scons only for android and ios for crypto++ at the moment) :
For my GDNative hasher :
I really hope someone here would be able to explain me what I am doing wrong.
Thank you for reading !