Git Product home page Git Product logo

Comments (19)

philip-lamb avatar philip-lamb commented on May 23, 2024 1

I've managed to isolate one possible source of the error. We've got multiple libjpeg versions because we're linking a verion of opencv on ios and macos which is a static framework (yes, such a thing exists) and that framework contains the symbols for whatever version of libjpeg is in opencv.

I will work on a build of opencv which doesn't expose the libjpeg symbols.

from artoolkitx.

philip-lamb avatar philip-lamb commented on May 23, 2024

The last line points to the problem. Somehow an old version of libjpeg is being linked in, possibly even by Unity itself.

Are you able to test against Unity 2018.2?

from artoolkitx.

chuen1118 avatar chuen1118 commented on May 23, 2024

That's Unity causing the problem then? I would like to avoid upgrading the Unity version as best I can since that may cause other problems to the project.
Do you know if there is any way to manually replace the libjpeg?

from artoolkitx.

chuen1118 avatar chuen1118 commented on May 23, 2024

I've tried Unity2018.2.2 and Unity2017.4.8 but the same error.

from artoolkitx.

ThorstenBux avatar ThorstenBux commented on May 23, 2024

Thanks for testing. I was on it today too but for some reason I can't get arunityX plugin to work :(.

@philip-lamb might it be that our libjpeg inside artoolkitX repo is the wrong version? Don't know how to tell the version number. Unity is just pulling in that lib

from artoolkitx.

chuen1118 avatar chuen1118 commented on May 23, 2024

Thanks for your effort.
I tried replacing the libjpeg.a with one from old projects: ARTK 5.3, 5.4, 6, they all looked the same and throws the same error.
Maybe that was some thing else gone wrong.
I didn't mention before, I have rebuilt the libARX.a so that it could skip connecting the calibration server and print out the error message. I am not familiar with this compiling thing and simply do that by running the build.sh. Would the rebuild process affect the linked libraries, like some old version on my machine got dragged into the rebuilt libARX.a?

from artoolkitx.

ThorstenBux avatar ThorstenBux commented on May 23, 2024

from artoolkitx.

chuen1118 avatar chuen1118 commented on May 23, 2024

Tried that, but the same :(
I downloaded the arunityx repo this morning and followed the Quick start guide. (Since I don't have GitHub installed I downloaded a zip file. I can see that some folder was updated but that folder in the downloaded zip is empty, not sure if that's normal.)
Run the build.sh for ios and macos, made a new package with Unity2018.2.2f1, imported it to an empty project, in the Editor it threw many EntryPointNotFoundException so I didn't play it, replaced the libARX.a and export an Xcode project for iOS. It crashed again.
I've also removed the libjpeg.a from the "Linked Frameworks and Libraries" section to see if there would be any different. The app can still be built and run and threw the same error.

from artoolkitx.

ThorstenBux avatar ThorstenBux commented on May 23, 2024

from artoolkitx.

ThorstenBux avatar ThorstenBux commented on May 23, 2024

Hm, after building to Android and macOS I can finally build to iOS. Now lets see if I get your error

from artoolkitx.

ThorstenBux avatar ThorstenBux commented on May 23, 2024

I'm at the same stage now. What did you change in the code to get the jpeg error message you are sharing?

from artoolkitx.

ThorstenBux avatar ThorstenBux commented on May 23, 2024

Adding a breakpoint in XCode the line in question is here:

arMalloc( imageSet->scale[i]->imgBW, ARUint8, imageSet->scale[i]->xsize * imageSet->scale[i]->ysize);

from artoolkitx.

chuen1118 avatar chuen1118 commented on May 23, 2024

it's getting strange.
I wanted to do the whole rebuild from the start again, so I just re-download the artoolkitx repo.

In ARX/AR2/jpeg.c, uncomment line 147: (*cinfo->err->output_message) (cinfo); to print out error message (the lib version mismatch error was print from this)
In ARX/ARVideo/cparamSearch.c, line 625, changed http://www.google.com to https://www.google.com, for some reason with http:// it hold up the app for several minutes.

Then build for ios and macos.
Then I put ARX.bundle to the Unity project. The Unity editor crashed when open SimepleNFTScence, but it was safe to open other scenes. This didn't happen before. If I switch back to the provided bundle, no crash.

There were errors like this when rebuilding the bundle, but build succeed anyway:
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: no LC_RPATH load command with path: /<path_to>/artoolkitx-master20180809/Source/build-macos/ARX/Release found in: /<path_to>/artoolkitx-master20180809/Source/../SDK/bin/artoolkitx_image_database2d (for architecture x86_64), required for specified option "-delete_rpath /<path_to>/artoolkitx-master20180809/Source/build-macos/ARX/Release"

from artoolkitx.

chuen1118 avatar chuen1118 commented on May 23, 2024

It ran into the arMalloc line because it failed here

jpgImage = ar2ReadJpegImage2(fp); // Caller must free result.

and fell back to the old v4.x iset format. Since the iset file is in fact a new one, it failed.

The ar2ReadJpegImage2 call lead to jpeg.c and fail here

jpeg_create_decompress(&cinfo);

which gives
Wrong JPEG library version: library is 62, caller expects 80

from artoolkitx.

ThorstenBux avatar ThorstenBux commented on May 23, 2024

yes, figured that.

I've tried with another libjpeg but no success.

from artoolkitx.

chuen1118 avatar chuen1118 commented on May 23, 2024

After some more googling, I found a temp fix by adding -force_load $(PROJECT_DIR)/Libraries/Plugins/iOS/libjpeg.a in Other Linker Flags. Forcing the code to use the libjpeg.a from ARToolkitX :)

This might be irrelevant.
I read somewhere that some old version of opencv framework might include old version of libjpeg. However I can't find any document about the libjpeg version to confirm that saying.
Anyway, I decided to try to build a custom opencv2.framework following https://github.com/artoolkitx/artoolkitx/wiki/Building-artoolkitX-prerequisites.
However the resulting framework did not support architecture arm64.
In additional, I also tried OpenCV 3.4.2 (libjpeg v62 again) and 2.4.13.6 (not support arm64) from https://opencv.org/releases.html.

from artoolkitx.

ThorstenBux avatar ThorstenBux commented on May 23, 2024

So basically the libjpeg from artoolkitX works but from somewhere it calls a wrong one on iOS

from artoolkitx.

chuen1118 avatar chuen1118 commented on May 23, 2024

I'm now convinced that it is opencv2.framework that caused the mismatch.
As ARToolkitX download the newest version from opencv.org, that version build with libjpeg-turbo which based on libjpeg 6b (ver. no. 62). I've tried to build from the opencv github repo and disable the use of libjpeg-turbo, the default built was with libjpeg 9 (ver. no. 90) and I got a new mismatch message accordingly.
Unfortunately I can't build one with libjpeg 8 to match

#define JPEG_LIB_VERSION 80 /* Compatibility version 8.0 */
#define JPEG_LIB_VERSION_MAJOR 8
#define JPEG_LIB_VERSION_MINOR 3

Would you consider sharing your working opencv2.framework instead of downloading the live version?

========================================================================
Furthermore, now I have another problem.
The Unity Editor crash every time I put in my custom ARX.bundle for macos, only the official bundle is working. The "http://www.google.com" long waiting time is really bugging me, I need to wait for more than 5 minutes every time for the camera to run, even I stop the play it would still be blocking the Editor.
Should I open a new thread for this?

from artoolkitx.

ThorstenBux avatar ThorstenBux commented on May 23, 2024

I fear we don't have a working version with iOS and NFT on Unity3D I've run in the same issues. I can see that we have builds for all platforms except iOS. https://github.com/artoolkitx/opencv/releases
So I guess that is one thing we need to fix soonish.

from artoolkitx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.