Skip to content

Adding XR Hands #3

@GlebThePolar

Description

@GlebThePolar

What I did to add XR Hands

Added package XR Hands (com.unity.xr.hands). Versions:
com.unity.xr.hands 1.8.0 (com.unity.xr.openxr 1.16.1)

Also I have PICO Integrations since I target both Quest 3 pro and Pico 4 ultra
com.unity.xr.picoxr 3.4.0 (Git)

Updated meta data for Packages/com.unity.xr.hands/Runtime/android/x64/libUnityOpenXRHands.so

Include Platforms -- enabled Editor and Standalone (but probably only Editor is needed)
Platform settings -- Editor -- OS = Linux, CPU x64
Standalone -- Linux x64

If you do it in Editor then don't forget to apply with button

On this stage I had "DLL not found" critical error. I found same problems as with OpenXR x86_64 native binary: the LIBC/GLIBC tags conflict

To fix I patched NativeFix/compat_libc.c -- added missing things (used ChatGPT for this)
In includes added this:
#include <strings.h>

In section "String functions":

char *compat_strstr(const char *haystack, const char *needle) {
    return strstr(haystack, needle);
}
__asm__(".symver compat_strstr, strstr@LIBC");

char *compat_strchr(const char *s, int c) {
    return strchr(s, c);
}
__asm__(".symver compat_strchr, strchr@LIBC");

char *compat_strrchr(const char *s, int c) {
    return strrchr(s, c);
}
__asm__(".symver compat_strrchr, strrchr@LIBC");

size_t compat_strcspn(const char *s, const char *reject) {
    return strcspn(s, reject);
}
__asm__(".symver compat_strcspn, strcspn@LIBC");

size_t compat_strspn(const char *s, const char *accept) {
    return strspn(s, accept);
}
__asm__(".symver compat_strspn, strspn@LIBC");

char *compat_strdup(const char *s) {
    return strdup(s);
}
__asm__(".symver compat_strdup, strdup@LIBC");

In section "stdlib":

void *compat_calloc(size_t nmemb, size_t size) {
    return calloc(nmemb, size);
}
__asm__(".symver compat_calloc, calloc@LIBC");

char *compat_getenv(const char *name) {
    return getenv(name);
}
__asm__(".symver compat_getenv, getenv@LIBC");

int compat_putenv(char *string) {
    return putenv(string);
}
__asm__(".symver compat_putenv, putenv@LIBC");

int compat_setenv(const char *name, const char *value, int overwrite) {
    return setenv(name, value, overwrite);
}
__asm__(".symver compat_setenv, setenv@LIBC");

int compat_unsetenv(const char *name) {
    return unsetenv(name);
}
__asm__(".symver compat_unsetenv, unsetenv@LIBC");

int compat_pthread_create(
    pthread_t *thread,
    const pthread_attr_t *attr,
    void *(*start_routine)(void *),
    void *arg)
{
    return pthread_create(thread, attr, start_routine, arg);
}
__asm__(".symver compat_pthread_create, pthread_create@LIBC");

void compat_pthread_exit(void *retval) {
    pthread_exit(retval);
}
__asm__(".symver compat_pthread_exit, pthread_exit@LIBC");

In section "ctype (locale-aware)":

int compat_islower(int c) { return islower(c); }
__asm__(".symver compat_islower, islower@LIBC");

int compat_isxdigit(int c) { return isxdigit(c); }
__asm__(".symver compat_isxdigit, isxdigit@LIBC");

Then rebuild libs with ./NativeFix/build_compat.sh
After that demo hand scene (Assets/Samples/XR Interaction Toolkit/3.3.1/Hands Interaction Demo/HandsDemoScene.unity) is loading and pocking is working (but I still have problems with grabbing though). Tested both on Quest 3 Pro and Pico 4 ultra via AllVR.

As described in the main project, the problem is realy only with launching things in Editor, building works even without fixes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions