-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Can TurboJPEG be build for UWP? #203
Comments
I don’t really know anything about UWP, but based on the nature of the error message, try passing |
Thanks! I added that. I also removed /ZW option for all c files inside turbojpeg project, because I was getting error messages that c files cannot be compiled with /ZW I'm not sure if it's correct to remove /ZW option for c files. It says so here https://stackoverflow.com/questions/9304862/d8048-cannot-compile-c-file-openssl-applink-c-with-zw-option, but I don't have any experience with C & C++ so I'm kind of flying blind here. Now I get the following error: "MSVCRTD.lib(utility_app.obj) : error LNK2019: unresolved external symbol __imp_RoInitialize referenced in function __scrt_initialize_winrt" PS: I only need decoder functionality |
I added runtimeobject.lib to turbojpeg project and now it builds :) https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/86bb1b44-aa7c-4873-8e08-74ecca47cd8a/roinitializewrapper-gives-me-errors?forum=vclanguage Will try to test WACK certification again :) |
WACK outputs these two errors:
|
I have managed to pass WACK certification :) I had to add -DNO_GETENV command line option to turbojpeg, jpeg & jpeg-static projects. Also, I had to comment out the following code inside jsimd_x86_64.c
and inside turbojpeg.c, comment out all instances of:
And now turbojpeg.dll is Windows Store compatible :) |
Regarding Regarding I am leaving this issue open until I have a chance to experiment with a Windows Store build and see if I can develop a set of easy instructions for making libjpeg-turbo pass WACK certification. Ideally, this should just involve setting a couple of CMake variables. |
I don't know if it's /ZW option or conversion of project to UWP project that is changing the compilation, but here is the WACK report for original turbojpeg.dll: Binary analyzer
Supported APIs
|
Some of those C library functions are critical to the operation of libjpeg-turbo, so I’m not sure how you were able to make it work at all if functions like |
I posted that for reference as it seems there are more changes under the hood than just removal of turbojpeg.dll works. I've tested it on Windows and on Xbox One. Most of those errors went away when I enabled /ZW switch and converted project to UWP project (I haven't tested which one of these two is the key one that got rid of the errors). I guess Microsoft has created their own version that supports only subset of features. When compiling with /ZW and/or when project is set to UWP, it seems like it substitutes it with their own version that contains supported To convert
Let me know, if I you need any more details. |
I will test this in the coming weeks and make sure that turbojpeg.dll can be straightforwardly built for the Windows Store without modifying the source. I'll check jpeg62.dll as well, but it may not be possible with that library, since it accesses the CRT across the DLL boundary. |
@Jure-BB To target UWP from you can call cmake with "-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0". It'll generate apropriate visual studio solution. |
@Tryum Thanks! Does it pass Windows App Certification Kit? I cannot test this on my project at the moment, because of some other UWP issues. |
I'm also working on passing WACK... but have several other libraries to fix
before trying again ;)
|
@Tryum your suggestion above doesn't work at all. The libjpeg-turbo build uses |
I'm building libjpeg-turbo with the help of https://github.com/Microsoft/vcpkg I checked the build options : The problem is that cmake is unable to handle two platforms at the same time (host and xcompile target)... even if we are building UWP targetting x86/x64 generated binaries won't be runnable directly. |
If you're turning off SIMD acceleration, then you're missing the entire point. This is libjpeg-turbo. Doesn't make sense to build it without the code that makes it turbo. |
Also, if you are building with neither static nor shared libraries, then what's left?! |
My bad, I built with |
@Tryum Did you try to build it the way I described? It passed WACK and I didn't had to disable SIMD. |
Unfortunatly, I need libjpeg-turbo to be built in an automated way, so disabling SIMD as provided in the port file of vcpkg is fine for me. I was just troubled by the getenv() call. |
I'm about to push a fix for that. Stand by. This is all rather esoteric to sort out. |
Here's what I did:
NOTE: Not only isn't It would be nice to automate this at some point and officially adopt a procedure for it, but at the moment, it all seems too fragile and undocumented for me to trust. I can at least create a wiki page for it on libjpeg-turbo.org (although it would be nice to figure out the OSMinVersion error first.) |
What about a two step process ? |
The process I describe above has full SIMD acceleration. The only reason you disabled it was to get rid of the getenv() calls, but I just pushed a commit that does that the proper way. |
Fixed in vcpkg master :) Thanks @dcommander! |
I am new to building things with
The bottom line is the following:
What am I doing wrong? |
Please contact the vcpkg developers for support when building libjpeg-turbo using that system. I know nothing about vcpkg, and it is completely external to the libjpeg-turbo code base. |
May I know if libjpeg-turbo supports arm64-uwp for Hololens 2?
Thus, before digging further on compiler, hope you could give me some advice and let me know if this is supported on arm64-uwp. thanks. |
I repeat: Please contact the vcpkg developers for support when building libjpeg-turbo using that system. I know nothing about vcpkg, and it is completely external to the libjpeg-turbo code base. I have no idea, specifically, why SIMD was disabled by default or why enabling it didn't improve performance. That is certainly not the case with the official libjpeg-turbo code base, in which NEON SIMD does produce a very significant speedup. |
sorry about this, and I am actually referring to this old post. I noticed that Windows/ARM is labeled as "won't integrate" in 2017. Thus, is official libjpeg-turbo technically possible with Windows/ARM? |
At the moment, the NEON SIMD code is specific to the GNU Assembler (GAS) and likely doesn't support the correct calling conventions for Windows/ARM. So it should be possible to build libjpeg-turbo for arm64-uwp, but it will not be fully accelerated. Sorry for my confusion on that. libjpeg-turbo 2.1 will contain a rewrite of the NEON SIMD extensions using intrinsics, and it may be possible to support Windows/ARM with SIMD acceleration after that feature is integrated. However, the problem with Windows/ARM is and always has been lack of funding to support that platform. I don't personally need that platform, so I'm not going to spend any of my time supporting it unless someone is paying for that time. |
libjpeg-turbo 2.1 now fully supports Windows/Arm builds with Visual C++, Visual Studio + Clang, or MinGW. |
I just checked out the main branch about 2.1.3. The mentioned way to build uwp arm64 didn't work. build error sounds like the asm objs generated were not right to the target platform: |
I'm trying to build TurboJPEG for use in Windows Store app. Unfortunately Windows App Certification Kit fails when using default windows turbojpeg.dll.
So I created Visual Studio solution with cmake command as it is described in building.md. Then I converted turbojpeg.vcxproj to UWP project and enabled /ZW compile switch like described here:
https://docs.microsoft.com/en-us/cpp/porting/how-to-use-existing-cpp-code-in-a-universal-windows-platform-app
I also changed CharSet to Unicode.
Unfortunately I'm getting the following error: "LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'"
Now I am wondering if it is even possible to build TurboJPEG for UWP with /ZW compile option?
The text was updated successfully, but these errors were encountered: