gustavogenovese / curl-android-ios

Static libcurl to be used in Android and iOS apps. Build scripts included. No Android source required
641 stars 255 forks source link

CURL error 43 on Android arm64-v8a architecture when adding form data to request #38

Closed ThorstenBux closed 6 years ago

ThorstenBux commented 7 years ago

Hi, thanks for your awesome work it really helps us a lot. We have integrated it into ARToolKit and it saved us quite some time 👍 .

Recently I came across a weird error on Android arm64-v8a architecture devices. I hope that you can find the time and try to reproduce it and if possible fix it. You can find my changes to your Android example app on my fork in this branch: https://github.com/ThorstenBux/curl-android-ios/tree/curl_arm64-v8a

Basically, I added form data and forced the build to only produce an arm64-v8a library. I already tried several different things to solve it but none helped. Please let me know if you can help me out with this. I'm more than happy to help where ever I can to reproduce that error for you.

Thank you very much in advance

gustavogenovese commented 7 years ago

So, what is the error? Provide me with the description of it, logs, etc. Is it only happening on arm64? what about x86_64? What version are you using? (curl and openssl) I have just published an update to the lib, please go ahead and run your code in the newest version and let me know if you're still experiencing it. Thanks!

ThorstenBux commented 7 years ago

Hi, thanks for coming back to me. The only error that I get back from Android is:

03-01 13:56:47.346: I/TestActivity(28564): Launching new thread to run the request 03-01 13:56:47.349: I/TestActivity(28564): Requesting URL to download: http://192.168.0.42:8080/app/calib_camera/upload.php 03-01 13:56:47.349: I/TestLibrary(28564): Download URL: http://192.168.0.42:8080/app/calib_camera/upload.php 03-01 13:56:47.365: I/TestLibrary(28564): CURL failed with error code 43 03-01 13:56:47.366: I/TestActivity(28564): Content is null

Above I was running it against a local copy of the webservice. But the webservice URL I shared with you here: https://github.com/ThorstenBux/curl-android-ios/tree/curl_arm64-v8a is the same web service.

I can confirm that it is not happening on armeabi-v7a but I don't have an Android device for x86_64.

I'm using your prebuild libraries from the repository.

I also got the update from you and the new libraries but the error is still the same. If you are interested in the Wireshark record I can provide that too. But I'm not sure of how much use that would be as the call is not going through.

Thanks again for your help.

ThorstenBux commented 7 years ago

In a simulator running x86_64 the error is the same:

03-02 11:20:47.432: I/TestActivity(3122): Launching new thread to run the request 03-02 11:20:47.434: I/TestActivity(3122): Requesting URL to download: https://omega.artoolworks.com/app/calib_camera/upload.php 03-02 11:20:47.435: I/TestLibrary(3122): Download URL: https://omega.artoolworks.com/app/calib_camera/upload.php 03-02 11:20:47.468: W/gralloc_ranchu(3122): Gralloc pipe failed 03-02 11:20:47.469: D/(3122): HostConnection::get() New Host Connection established 0x7ffee9d94280, tid 3122 03-02 11:20:49.121: D/(3122): HostConnection::get() New Host Connection established 0x7ffee9d94160, tid 3141 03-02 11:20:49.136: I/TestLibrary(3122): CURL failed with error code 43 03-02 11:20:49.152: I/TestActivity(3122): Content is null 03-02 11:20:49.172: I/OpenGLRenderer(3122): Initialized EGL, version 1.4 03-02 11:20:49.172: D/OpenGLRenderer(3122): Swap behavior 1

gustavogenovese commented 7 years ago

I'm afraid I can't help you, all I can see is that "error code 43" is an internal cURL error described here https://curl.haxx.se/libcurl/c/libcurl-errors.html (not too helpful though). I'm thinking this might be related to the long size for which I had to manually add a patch to the build script. See line 96 of curl-compile-scripts/build_Android.sh, I may have to revisit that.

As a temporary workaround, until I have time to debug this, you can remove the 64-bit .so file and use the 32-bit .so instead, that means, just remove the arm64-v8a and x86_64 directories from your project and try again. Any 64-bit device should emulate appropriately the 32-bit architecture.

I'll leave this issue open until I have time to fix it. Do not hesitate to add more info here (if you get any) as you find it

ThorstenBux commented 7 years ago

Thanks I'll try that

ThorstenBux commented 7 years ago

Yes, armeabi-v7a works for me for now. Thanks for the hint. Would be great if you could keep me up to date with this one as I would prefer to switch to the correct abi as soon as possible.

ThorstenBux commented 7 years ago

Maybe that helps: https://github.com/artoolkit/artoolkit5/issues/213#issuecomment-293902592

ThorstenBux commented 7 years ago

Any update on that?

ThorstenBux commented 6 years ago

@gcesarmza I've fixed the arm64 issue see here: https://github.com/artoolkitx/artoolkit5/issues/56

Can provide a PR if you are interested?