The problem with the build for android
Sokolargm opened this issue · 2 comments
Sokolargm commented
So, I'm trying to build .so of this via Android Studio NDK, but when i run this
LOCAL_PATH:= $(call my-dir)
HIDAPI_ROOT_REL:= ../..
HIDAPI_ROOT_ABS:= $(LOCAL_PATH)/../..
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(HIDAPI_ROOT_REL)/libusb/hid.c
LOCAL_C_INCLUDES += \
$(HIDAPI_ROOT_ABS)/hidapi \
$(HIDAPI_ROOT_ABS)/android
LOCAL_SHARED_LIBRARIES := libusb1.0
LOCAL_MODULE := libhidapi
include $(BUILD_SHARED_LIBRARY)`
I am getting this error
D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c>ndk-build.cmd
Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-19.
D:/HidBuild/android-ndk-r25c-windows/android-ndk-r25c/build/../build/core/build-binary.mk:586: Android NDK: Module hidapi depends on undefined modules: usb1.0
D:/HidBuild/android-ndk-r25c-windows/android-ndk-r25c/build/../build/core/build-binary.mk:599: *** Android NDK: Note that old versions of ndk-build silently ignored this error case. If your project worked on those versions, the missing libraries were not needed and you can remove those dependencies from the module to fix your build. Alternatively, set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies. . Stop.
how can I add a usb 1.0 module there?
Sokolargm commented
Ok I added APP_ALLOW_MISSING_DEPS=true
and now I get
D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c>ndk-build.cmd
Android NDK: APP_PLATFORM not set. Defaulting to minimum supported version android-19.
D:/HidBuild/android-ndk-r25c-windows/android-ndk-r25c/build/../build/core/build-binary.mk:586: Android NDK: Module hidapi depends on undefined modules: usb1.0
D:/HidBuild/android-ndk-r25c-windows/android-ndk-r25c/build/../build/core/build-binary.mk:586: Android NDK: Module hidapi depends on undefined modules: usb1.0
D:/HidBuild/android-ndk-r25c-windows/android-ndk-r25c/build/../build/core/build-binary.mk:586: Android NDK: Module hidapi depends on undefined modules: usb1.0
D:/HidBuild/android-ndk-r25c-windows/android-ndk-r25c/build/../build/core/build-binary.mk:586: Android NDK: Module hidapi depends on undefined modules: usb1.0
[arm64-v8a] Compile : hidapi <= hid.c
[arm64-v8a] SharedLibrary : libhidapi.so
ld: error: undefined symbol: libusb_init
>>> referenced by hid.c:489 (jni/../../libusb/hid.c:489)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_init)
>>> referenced by hid.c:489 (jni/../../libusb/hid.c:489)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_enumerate)
>>> referenced by hid.c:489 (jni/../../libusb/hid.c:489)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_open_path)
>>> referenced 1 more times
ld: error: undefined symbol: libusb_exit
>>> referenced by hid.c:504 (jni/../../libusb/hid.c:504)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_exit)
ld: error: undefined symbol: libusb_get_device_list
>>> referenced by hid.c:801 (jni/../../libusb/hid.c:801)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_enumerate)
>>> referenced by hid.c:1275 (jni/../../libusb/hid.c:1275)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_open_path)
ld: error: undefined symbol: libusb_free_config_descriptor
>>> referenced by hid.c:891 (jni/../../libusb/hid.c:891)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_enumerate)
>>> referenced by hid.c:1314 (jni/../../libusb/hid.c:1314)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_open_path)
>>> referenced by hid.c:1392 (jni/../../libusb/hid.c:1392)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_libusb_wrap_sys_device)
ld: error: undefined symbol: libusb_get_device_descriptor
>>> referenced by hid.c:809 (jni/../../libusb/hid.c:809)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_enumerate)
>>> referenced by hid.c:844 (jni/../../libusb/hid.c:844)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_enumerate)
>>> referenced by hid.c:1281 (jni/../../libusb/hid.c:1281)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_open_path)
>>> referenced 2 more times
ld: error: undefined symbol: libusb_get_active_config_descriptor
>>> referenced by hid.c:821 (jni/../../libusb/hid.c:821)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_enumerate)
>>> referenced by hid.c:1285 (jni/../../libusb/hid.c:1285)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_open_path)
>>> referenced by hid.c:1352 (jni/../../libusb/hid.c:1352)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_libusb_wrap_sys_device)
ld: error: undefined symbol: libusb_get_config_descriptor
>>> referenced by hid.c:823 (jni/../../libusb/hid.c:823)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_enumerate)
>>> referenced by hid.c:1287 (jni/../../libusb/hid.c:1287)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_open_path)
>>> referenced by hid.c:1354 (jni/../../libusb/hid.c:1354)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_libusb_wrap_sys_device)
ld: error: undefined symbol: libusb_close
>>> referenced by hid.c:885 (jni/../../libusb/hid.c:885)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_enumerate)
>>> referenced by hid.c:1309 (jni/../../libusb/hid.c:1309)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_open_path)
>>> referenced by hid.c:1394 (jni/../../libusb/hid.c:1394)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_libusb_wrap_sys_device)
>>> referenced 1 more times
ld: error: undefined symbol: libusb_open
>>> referenced by hid.c:833 (jni/../../libusb/hid.c:833)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_enumerate)
>>> referenced by hid.c:1302 (jni/../../libusb/hid.c:1302)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_open_path)
ld: error: undefined symbol: libusb_free_device_list
>>> referenced by hid.c:895 (jni/../../libusb/hid.c:895)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_enumerate)
>>> referenced by hid.c:1317 (jni/../../libusb/hid.c:1317)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_open_path)
>>> referenced by hid.c:1317 (jni/../../libusb/hid.c:1317)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_open_path)
ld: error: undefined symbol: libusb_get_port_numbers
>>> referenced by hid.c:446 (jni/../../libusb/hid.c:446)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(get_path)
ld: error: undefined symbol: libusb_get_bus_number
>>> referenced by hid.c:449 (jni/../../libusb/hid.c:449)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(get_path)
ld: error: undefined symbol: libusb_get_device
>>> referenced by hid.c:1163 (jni/../../libusb/hid.c:1163)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hidapi_initialize_device)
>>> referenced by hid.c:1352 (jni/../../libusb/hid.c:1352)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_libusb_wrap_sys_device)
>>> referenced by hid.c:1354 (jni/../../libusb/hid.c:1354)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_libusb_wrap_sys_device)
>>> referenced 1 more times
ld: error: undefined symbol: libusb_kernel_driver_active
>>> referenced by hid.c:1169 (jni/../../libusb/hid.c:1169)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hidapi_initialize_device)
ld: error: undefined symbol: libusb_detach_kernel_driver
>>> referenced by hid.c:1170 (jni/../../libusb/hid.c:1170)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hidapi_initialize_device)
ld: error: undefined symbol: libusb_claim_interface
>>> referenced by hid.c:1181 (jni/../../libusb/hid.c:1181)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hidapi_initialize_device)
>>> referenced by hid.c:1138 (jni/../../libusb/hid.c:1138)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hidapi_initialize_device)
ld: error: undefined symbol: libusb_control_transfer
>>> referenced by hid.c:1107 (jni/../../libusb/hid.c:1107)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hidapi_initialize_device)
>>> referenced by hid.c:1426 (jni/../../libusb/hid.c:1426)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_write)
>>> referenced by hid.c:1592 (jni/../../libusb/hid.c:1592)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_send_feature_report)
>>> referenced 7 more times
ld: error: undefined symbol: libusb_attach_kernel_driver
>>> referenced by hid.c:1187 (jni/../../libusb/hid.c:1187)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hidapi_initialize_device)
>>> referenced by hid.c:1693 (jni/../../libusb/hid.c:1693)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_close)
ld: error: undefined symbol: libusb_set_interface_alt_setting
>>> referenced by hid.c:1146 (jni/../../libusb/hid.c:1146)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hidapi_initialize_device)
ld: error: undefined symbol: libusb_release_interface
>>> referenced by hid.c:1151 (jni/../../libusb/hid.c:1151)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hidapi_initialize_device)
>>> referenced by hid.c:1688 (jni/../../libusb/hid.c:1688)
>>> D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/objs/hidapi/__/__/libusb/hid.o:(hid_close)
ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [D:/HidBuild/android-ndk-r25c-windows/android-ndk-r25c/build/../build/core/build-binary.mk:657: D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c/obj/local/arm64-v8a/libhidapi.so] Error 1
D:\HidBuild\android-ndk-r25c-windows\android-ndk-r25c>
criminact commented
@Sokolargm What solved the issue?