-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ARM64: flatten/trim operations produce incorrect output from 16-bit RGBA input #1651
Comments
Tested in x86 platform, all tests are getting passed. But 2 tests are getting failed while running in arm64 platform.
libvips is getting installed in arm64 platform, but unable to find any specific solution for above issues. Please guide me on the same. Thanks in advance. |
Thanks for the report, I'll try to reproduce this via a QEMU-based VM. (I've been meaning to add an ARM64 CI job that might have caught this, not that I'm entirely sure what's causing it yet.) |
@lovell We can use drone.io CI to build and run tests in arm64 platform. If you agree on the same, i will raise a PR with drone.io CI support. |
I've been able to reproduce this via ARM64 QEMU emulation. Are you seeing this on real ARM64 hardware? Both the failing tests use 16-bit RGBA input and involve a flatten operation. Here is the state of the image just before and after the call to The first (input) image has max pixel values of 0xFFFF. If this was a signed vs unsigned short problem then I'd expect the max pixel values of the second (output) image to erroneously be 0x7FFF, but instead it is 0x7F7F. This suggests the top bit of each byte is being erroneously cleared, which is unexpected, perhaps even a compiler bug? The prebuild libvips binaries for ARM64 use the The next step is to compile libvips from source inside the same ARM64 QEMU container and debug the internal state of libvips during the flatten operation. |
@lovell Thanks for the report. Yes, I have observed this on my local ARM machine. |
@lovell Followed link https://github.com/libvips/libvips/wiki/Build-for-Ubuntu to build libvips from source and set environment variables and ran tests. But getting same result, as these 2 cases are getting failed. |
Thanks, which compiler (gcc?) version and flags were used? |
@lovell I have not added any extra flags, just executed make in source to build libvips. |
Hi @lovell, I can try if any suggestion or alternate method you have for this issue. Thanks in advance. |
Hi @lovell I have cloned the new release v0.22.1 and tested the package in aarch64 platform using command npm install-test with libvips version v8.8.0. Facing below issues in aarch64 platform:
Do we need to install any extra dependencies? |
Thanks for continuing to investigate this, I've not had the time, nor do I have any ARMv8 hardware to hand (perhaps an excuse here to get the new Pi 4). The latest work-in-progress code in the vision branch has updates to the unit tests so they pass with libvips v8.8.0+. |
Thanks for the reply. |
Hi @lovell , Tested with vision branch in ARM64 platform and it is failing in build stage. Please find below logs for the same:
info sharp Detected globally-installed libvips v8.8.0 Do we need to install any specific dependencies or run any specific command before testing? |
That's interesting. Are you using libvips built from source? Was it compiled from a tarball or git? The |
Yes i have compiled from source. I have used git to install and was facing this issue. I have re-installed libvips from source v8.8.0-rc1 release and tested the sharp package again and now heifsave_buffer issue is resolved. But facing previous issues with vision branch. Please find below issues in ARM64 platform:
|
Thanks for confirming, it's the same two tests failing, both of which use the vips flatten operation on a 16-bit RGBA input. Are you still using gcc version 8.2.0? |
Yes, I am still using the same gcc version (gcc version 8.2.0 (Ubuntu 8.2.0-7ubuntu1)). |
@ossdev07 : can you reproduce this problem with QEMU on x86? |
|
I've made some progress on this. Binaries compiled using gcc v9.2.1, as provided by Debian 11, produce the correct output both with and without the This would fit with the idea that we were seeing the effects of a aarch64 compiler bug, with https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88469 a possible candidate. |
Hi @lovell , I have tried with docker container with debian:bullseye image and gcc 9.2.1 and built libvips from source. I was facing issue libvips/libvips#1426, so configured with flag '--without-orc' and built libvips and installed with version 8.9.0. Facing below issue while running tests: Alpha transparency Installed libheif-dev as well, but still facing the same issue. |
yes, facing the same issue. |
Thanks for confirming, it looks like sharp was compiled against a libvips with libheif but at runtime has found another libvips without libheif. Perhaps you need to run |
@lovell , I have created a docker container with debian:bullseye image in local arm64 machine and installed gcc version 9.2.1. Downloaded the libvips 8.8.3 tar and tried to install, but was facing ORCTargetPowerPCFlags issue. Installed it with flag "--without-orc", but facing issues in executing the tests. Test Output:
HTTP agent Alpha transparency Do we need to install any extra dependencies? |
Are you able to share a Dockerfile with the RUN commands to reproduce this? |
I have not used Dockerfile exactly, but i have pulled the image in local arm64 system. Steps followed:
Please revert if any more information is required. |
You'll need to run |
Thanks for the reply.
|
The I suspect there are multiple, conflicting versions of libvips on the machine where this error is occurring. |
I have freshly downloaded and built libvips version 8.8.3 and did ldconfig after installing libvips. Facing below issue:
|
You'll need to rebuild/reinstall sharp after updating the global version of libvips. |
@lovell , I have created new container and followed the process mentioned in above comments with libvips version 8.8.1 and tests are running now, but the same 16-bit png tests are getting failed. Do we need to install any extra dependencies? |
Are you able to share the exact Dockerfile, commands and/or script you are now using? |
As mentioned in comment #1651 (comment), i have followed same steps with 8.8.1 libvips version and ldconfig after installing libvips. Steps followed: Do I need to run any extra steps or commands before running test? |
If there is more than one version of CC="gcc-9" CXX="g++-9" ./configure ... |
I have tried with this command, but facing the same issues in 16-bit tests. |
I've added an experimental ARM64 build to the Travis CI matrix e.g. https://travis-ci.org/lovell/sharp/jobs/602711582 but there's currently a known problem with https://travis-ci.community/t/no-ruby-for-c-build/5601 |
I've created #1953 to track the addition of ARM64 to the CI matrix. The expected 16-bit image test failures are still present at the moment, but these should hopefully go away after the next release of the prebuilt libvips binaries. |
As hoped/expected, the two test failures under discussion here are now passing with the latest work-in-progress ARM64 build - see https://travis-ci.org/lovell/sharp/jobs/628697268 (There's a different, unrelated test failure around SVG rendering, which is probably a librsvg packaging thing.) |
@lovell , Thanks for the update. I have tested the same and the two test failures are now passing in the arm64 platform. May I know how can we resolve SVG rendering issue? |
@lovell , I have followed the below steps with libvips version 8.9.0-rc1. Steps followed: I am getting below output:
├─ MIT: 45 All tests are passing after installing librsvg2-bin and installing libvips manually. |
The failure of the "Convert SVG with embedded images to PNG, respecting dimensions, autoconvert to PNG" test is due to a meson dependency-discovery problem when cross-compiling all the ARM binaries and will be fixed by lovell/sharp-libvips@5f86843 |
ARM64v8 CI now passing - https://travis-ci.org/lovell/sharp/jobs/630581137 |
Thanks @lovell . When can we expect the release with these updates? |
This issue is currently tagged with the v0.24.0 milestone. |
v0.24.0 now available, plus the docs have been updated to provide more info about of prebuilt libvips binaries. |
uname -a
Linux c5475310be72 4.10.0-38-generic #42~16.04.1-Ubuntu SMP Tue Oct 10 16:33:57 UTC 2017 aarch64 aarch64 aarch64 GNU/Linux
Facing below issues while testing sharp package test cases in arm64 platform.
npm test output:
Alpha transparency
Flatten 16-bit PNG with transparency to orange:
Uncaught Error: Expected maximum absolute distance of 25, actual 92.25032043457031
at Object.assertMaxColourDistance (test/fixtures/index.js:191:13)
at /pruthvi/sharp/test/unit/alpha.js:59:18
Trim borders
16-bit PNG with alpha channel:
Uncaught AssertionError [ERR_ASSERTION]: Input A expected to strictly equal input B:
-4
+ expected - actual
Please guide me on solving these issues.
Thanks in advance.
The text was updated successfully, but these errors were encountered: