Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UWP (Universal Windows Platform) support #3

Open
FilippoCinotti opened this issue Apr 7, 2021 · 27 comments
Open

UWP (Universal Windows Platform) support #3

FilippoCinotti opened this issue Apr 7, 2021 · 27 comments
Assignees
Labels
enhancement New feature or request

Comments

@FilippoCinotti
Copy link

I'd like to pass to UWP to run this project on windows HoloLens 2, but I can't figure out how to solve these errors:
error CS0246: The type or namespace name 'Span<>' could not be found (are you missing a using directive or an assembly reference?)

Can you help me?

@keijiro keijiro self-assigned this Apr 7, 2021
@keijiro keijiro added the question Further information is requested label Apr 7, 2021
@keijiro
Copy link
Owner

keijiro commented Apr 7, 2021

I don't have any experience/knowledge on UWP/HoloLens, so I have no idea about the issue.

I keep this issue open for future reference, but please don't expect me to fix it in the near future.

@FilippoCinotti

This comment has been minimized.

@keijiro
Copy link
Owner

keijiro commented Apr 13, 2021

That depends on how you define the world coordinate. I think it's a kind of application-specific problem.

@keijiro keijiro changed the title How to pass to UWP UWP (Universal Windows Platform) support Apr 13, 2021
@keijiro
Copy link
Owner

keijiro commented Apr 13, 2021

By the way, please don't reuse the thread for other issues. I'll only discuss the topic (UWP support) in this issue page.

@keijiro keijiro added enhancement New feature or request and removed question Further information is requested labels Apr 13, 2021
@Yafilo
Copy link

Yafilo commented Apr 21, 2021

@FilippoCinotti I also tried to use the project for the Hololens 2 and I bypassed this issue by importing the right packages manually (System.Buffers, System.Memory, ... initially imported by nuget if I'm right) to the project.
However I did not success to compile the dll with aarch64-linux-gnu with make for the Hololens2 requirement (UWP and ARM64) and I am stuck here...

@FilippoCinotti
Copy link
Author

@Yafilo the same happen to me, let me know if you are able to make progresses

@Yafilo
Copy link

Yafilo commented Apr 27, 2021

Hey so I found a repo to get the ARM64 of aprilTag through VCPKG :
https://github.com/ooeygui/vcpkg (fork of the official vcpkg that has an ariltag implementation). Just install vcpkg as normal then install apriltag with :
.\vcpkg\vcpkg install apriltag
It will search another fork of the official APRILTag repo where the threads are managed for windows and build an ARM 64 dll for UWP of april tag here :
.\vcpkg\buildtrees\apriltag\arm64-uwp-rel

Hope it helps

@FilippoCinotti
Copy link
Author

Thanks @Yafilo, let's get in touch!

@FelixWeichselgartner
Copy link

@Yafilo Where do I have to execute the vcpkg? On my local computer in terminal or in Unity? How do I use it in Unity then. Sry but I'm a little confused. TY in advance!

@Yafilo
Copy link

Yafilo commented May 11, 2021

You can download the repo and then launch bootstrap-vcpkg.bat It should install averything you need for vcpkg, Once it is done you can install apriltag package with .\vcpkg\vcpkg install apriltag.

During the installation I got an hash error with a file, you can just modify the expected hash signature with the current haash signature. I don't remember wich file it was but it worked for me.

@FilippoCinotti
Copy link
Author

Do you manage to complete it? I got a building error

image

@FilippoCinotti
Copy link
Author

@Yafilo @FelixWeichselgartner Do you manage to complete it? I got a building error

@FelixWeichselgartner
Copy link

I did not try so far, because I expected that would happen ^^.

@muxavir
Copy link

muxavir commented Jun 2, 2021

image
Facing same error as above mentioned by @FilippoCinotti
If anyone got chance to bypass this error, please share.

@FilippoCinotti
Copy link
Author

@Yafilo I manage to solve the issue by substituting the correct hash code in the folder ./vcpkg/ports/apriltag/portfile (@FelixWeichselgartner @muxavir ). However, I only get x86 version of the library... how do you get this .\vcpkg\buildtrees\apriltag\arm64-uwp-rel ?

image

@Yafilo
Copy link

Yafilo commented Jun 30, 2021

You can add parameters on building, if I remember well, you can set something like :
vcpkg install apriltag:arm64-uwp for ARM64 or
vcpkg install apriltag:arm-uwp for ARM

Hope it could help

@FilippoCinotti
Copy link
Author

@Yafilo could you please upload the library?

yes the command should be vcpkg install apriltag --triplet=arm64-uwp

@FilippoCinotti
Copy link
Author

But it gaves me an error

@muxavir
Copy link

muxavir commented Jul 6, 2021

any luck for arm64 @FilippoCinotti ?

@FilippoCinotti
Copy link
Author

FilippoCinotti commented Jul 6, 2021 via email

@artificial-jamesirei
Copy link

@FilippoCinotti I am right there with you man, I'm trying to do the same thing.

I am able to build out a dll for arm64 by doing vcpkg install apriltag --triplet=arm64-windows but I'm not 100% certain that it's going to work when I build out for Hololens. Can someone give me a quick ELI5 on how generating my own dll's with vcpkg works? I'm kind of new to the whole process, and if I understand more I can try to generate one using the original repo perhaps

@markgrossnickle
Copy link

markgrossnickle commented Jun 2, 2022

I was able to build the vcpkg package using the above methods.

I grabbed the latest vcpkg and merged it with the branch from ooeygui. Updated the hash. Used the triplet code listed above for arm (haven't tried arm64 yet).

But when I run it on the device I get a Access violation reading location.... It is in the assembly-csharp.cpp and muddled with IL2CPP code so its hard to really tell where its occurring other than DetectionArray_get_Item_m is in the method name.

Appears to be this:

    public unsafe ref Detection this[int i]
      => ref Util.AsRef<Detection>((void*)AsPointerArray.AsSpan[i]);

@markgrossnickle
Copy link

Figured out my issue. It at least no longer crashes and it does say it has found 1 detected tag (though I haven't tried drawing it in the spatial scene yet).

In ZArray.cs the el_sz was a ulong and the branch I was working off of has el_sz in the zarray struct in apriltags.c as a size_t or uint. Thus the parsing/conversion was off.

@rubit0
Copy link

rubit0 commented Jun 15, 2022

Figured out my issue. It at least no longer crashes and it does say it has found 1 detected tag (though I haven't tried drawing it in the spatial scene yet).

Hi @markgrossnickle, would you be willing to share your .dll file so that we others don't have to go through entire build ordeal? I would appreciate it a lot!

@markgrossnickle
Copy link

Here is a zip of the Arm build. It also has a debug method which outputs text back to Unity
apriltags.zip

@theloni-monk
Copy link

theloni-monk commented Jul 22, 2022

Has anyone here tried to run this on the HoloLens 1? Its an Intel x86 so I hoped it would run the default DLLs but I am getting the following error:

DllNotFoundException: Unable to load DLL 'AprilTag'. Tried the load the following dynamic libraries: Unable to load dynamic library 'AprilTag' because of 'C:\buildslave\unity\build\External\il2cpp\builds\external\baselib\Source\WinApi\Baselib_DynamicLibrary_WinApi.inl.h(36):Baselib_DynamicLibrary_OpenUtf16: Failed to open the requested dynamic library (0x06000000) - The specified module could not be found.  (WinError:0000007e)
 at AprilTag.Interop.Detector._Create () [0x00000] in <00000000000000000000000000000000>:0 
 at AprilTag.Interop.Detector.Create () [0x00000] in <00000000000000000000000000000000>:0 
 at AprilTag.TagDetector..ctor (System.Int32 width, System.Int32 height, System.Int32 decimation) [0x00000] in <00000000000000000000000000000000>:0 
 at DetectionTest.Start () [0x00000] in <00000000000000000000000000000000>:0 

To be clear, this is a UWP support error, as it should work out of box with something like the HoloLens 1 which is an x86 UWP platform.

@N0RAIR
Copy link

N0RAIR commented Mar 3, 2023

Here is a zip of the Arm build. It also has a debug method which outputs text back to Unity apriltags.zip

Hey @markgrossnickle , is there a possibility you can build and share the arm64 build too? the arm does not work for arm64 builds and i can't build for arm i need arm64 for the Hololens 2

@theloni-monk I get the same issue when I run it on the HoloLens 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

10 participants