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

Does this support arm64 architectures? #44

Open
prcongithub opened this issue Mar 23, 2022 · 4 comments
Open

Does this support arm64 architectures? #44

prcongithub opened this issue Mar 23, 2022 · 4 comments

Comments

@prcongithub
Copy link

We are trying to use this layer for our lambda function which is running on graviton processors with arm64 architecture.
We are getting an error:

2022-03-23T16:18:46.638+05:30CopyI, [2022-03-23T10:48:46.638215 #11]  INFO -- : Command :: PATH=/var/task/imagemagick/bin:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/50c407c68980ebe8c1f70ce5ae44e8db20220323-11-1w87jsa.png[0]' 2>/dev/null | I, [2022-03-23T10:48:46.638215 #11] INFO -- : Command :: PATH=/var/task/imagemagick/bin:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/50c407c68980ebe8c1f70ce5ae44e8db20220323-11-1w87jsa.png[0]' 2>/dev/null
-- | --
  | 2022-03-23T16:18:46.645+05:30CopyI, [2022-03-23T10:48:46.645532 #11]  INFO -- : [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError> | I, [2022-03-23T10:48:46.645532 #11] INFO -- : [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>

Just wanted to confirm if this supports arm64 as of now?

@wz2b
Copy link

wz2b commented Dec 11, 2022

I couldn't find a definitive answer to this. What I did for now was created a t3a.nano instance which was enough to download and build ImageMagick 7 myself. I configured it with ./configure --disable-shared --enable-static which doesn't completely work - there is still a dependency on libgomp.so.1. I made a zip with magick in bin and libgomp.so.1 in lib, and created a layer from that. It worked fine. So I guess my point is if nobody answers this question it's not that bad to build one yourself. Or, I will share my .zip with you and you can create your own layer from it.

@wz2b
Copy link

wz2b commented Dec 11, 2022

one difficulty in the approach I outlined above is that even if you build 'static' you still need to do a few other things.

  • The build environment has to have libjpeg-devel (at least). Otherwise magick will run but not be able to do anything
  • You need to get those libraries e.g. libjpeg.so.62 into your package so they end up in /opt/lib. The AWS runtime will set the library path to find native deps there.

In general, this isn't pretty. I agree that if the public layer works with arm (I still haven't confirmed this up or down) that's easier to use. I really don't know, though, how durable public layers are. I tend to build my own for a few reasons: one is that I want one layer instead of lots, because I think that improves startup time (is that true?) The other is I'm worried that if the public layer's owner decides to delete it does that leave me in a lurch the next time I go to deploy my stack. So depending on public layers is easy but it makes me nervous, probably because I don't know the answers to these questions.

@wz2b
Copy link

wz2b commented Dec 12, 2022

OK. I figured it out, to a point. From the repo page HERE you have to click deploy, which creates a CF stack with one thing in it - the layer. From there, you can

aws lambda get-layer-version-by-arn --arn the_layer_arn_from_your_cf_stack --query Content.Location --output text

That gets you a REALLY long URL that you can fetch with curl to get a .zip file. You can look at that zip, meaning what's actually in the layer. I pasted it at the end here because it's long-ish.

The answer to the question of whether or not it will work on ARM is answered here:

% file bin/magick
bin/magick:            ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=f5f01bcc9ded1523262578d824e5238940f021f9, with debug_info, not stripped

It is definitely built for x86, and doesn't include both. It also does not have any .so files in it. The executable itself is only linked against libraries that are already in the lambda environment:

% ldd bin/magick
        linux-vdso.so.1 (0x00007fffeed91000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f5096fb0000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5096c10000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f50969f0000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f50965f0000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f5097400000)

The image includes a bunch of files that I am not sure about, as in, why do they need to be there, meaning everything in include/ and lib/ - in particular, I'm not sure why you'd need a bunch of static libraries or include files.

./bin
./bin/animate
./bin/compare
./bin/composite
./bin/conjure
./bin/convert
./bin/display
./bin/identify
./bin/import
./bin/magick
./bin/magick-script
./bin/MagickCore-config
./bin/MagickWand-config
./bin/mogrify
./bin/montage
./bin/stream
./etc
./etc/ImageMagick-7
./etc/ImageMagick-7/colors.xml
./etc/ImageMagick-7/delegates.xml
./etc/ImageMagick-7/log.xml
./etc/ImageMagick-7/mime.xml
./etc/ImageMagick-7/policy.xml
./etc/ImageMagick-7/quantization-table.xml
./etc/ImageMagick-7/thresholds.xml
./etc/ImageMagick-7/type-apple.xml
./etc/ImageMagick-7/type-dejavu.xml
./etc/ImageMagick-7/type-ghostscript.xml
./etc/ImageMagick-7/type-urw-base35.xml
./etc/ImageMagick-7/type-windows.xml
./etc/ImageMagick-7/type.xml
./include
./include/ImageMagick-7
./include/ImageMagick-7/MagickCore
./include/ImageMagick-7/MagickCore/animate.h
./include/ImageMagick-7/MagickCore/annotate.h
./include/ImageMagick-7/MagickCore/artifact.h
./include/ImageMagick-7/MagickCore/attribute.h
./include/ImageMagick-7/MagickCore/blob.h
./include/ImageMagick-7/MagickCore/cache-view.h
./include/ImageMagick-7/MagickCore/cache.h
./include/ImageMagick-7/MagickCore/channel.h
./include/ImageMagick-7/MagickCore/cipher.h
./include/ImageMagick-7/MagickCore/client.h
./include/ImageMagick-7/MagickCore/coder.h
./include/ImageMagick-7/MagickCore/color.h
./include/ImageMagick-7/MagickCore/colormap.h
./include/ImageMagick-7/MagickCore/colorspace.h
./include/ImageMagick-7/MagickCore/compare.h
./include/ImageMagick-7/MagickCore/composite.h
./include/ImageMagick-7/MagickCore/compress.h
./include/ImageMagick-7/MagickCore/configure.h
./include/ImageMagick-7/MagickCore/constitute.h
./include/ImageMagick-7/MagickCore/decorate.h
./include/ImageMagick-7/MagickCore/delegate.h
./include/ImageMagick-7/MagickCore/deprecate.h
./include/ImageMagick-7/MagickCore/display.h
./include/ImageMagick-7/MagickCore/distort.h
./include/ImageMagick-7/MagickCore/distribute-cache.h
./include/ImageMagick-7/MagickCore/draw.h
./include/ImageMagick-7/MagickCore/effect.h
./include/ImageMagick-7/MagickCore/enhance.h
./include/ImageMagick-7/MagickCore/exception.h
./include/ImageMagick-7/MagickCore/feature.h
./include/ImageMagick-7/MagickCore/fourier.h
./include/ImageMagick-7/MagickCore/fx.h
./include/ImageMagick-7/MagickCore/gem.h
./include/ImageMagick-7/MagickCore/geometry.h
./include/ImageMagick-7/MagickCore/histogram.h
./include/ImageMagick-7/MagickCore/identify.h
./include/ImageMagick-7/MagickCore/image-view.h
./include/ImageMagick-7/MagickCore/image.h
./include/ImageMagick-7/MagickCore/layer.h
./include/ImageMagick-7/MagickCore/linked-list.h
./include/ImageMagick-7/MagickCore/list.h
./include/ImageMagick-7/MagickCore/locale_.h
./include/ImageMagick-7/MagickCore/log.h
./include/ImageMagick-7/MagickCore/magic.h
./include/ImageMagick-7/MagickCore/magick-baseconfig.h
./include/ImageMagick-7/MagickCore/magick-config.h
./include/ImageMagick-7/MagickCore/magick-type.h
./include/ImageMagick-7/MagickCore/magick.h
./include/ImageMagick-7/MagickCore/MagickCore.h
./include/ImageMagick-7/MagickCore/matrix.h
./include/ImageMagick-7/MagickCore/memory_.h
./include/ImageMagick-7/MagickCore/method-attribute.h
./include/ImageMagick-7/MagickCore/methods.h
./include/ImageMagick-7/MagickCore/mime.h
./include/ImageMagick-7/MagickCore/module.h
./include/ImageMagick-7/MagickCore/monitor.h
./include/ImageMagick-7/MagickCore/montage.h
./include/ImageMagick-7/MagickCore/morphology.h
./include/ImageMagick-7/MagickCore/nt-base.h
./include/ImageMagick-7/MagickCore/opencl.h
./include/ImageMagick-7/MagickCore/option.h
./include/ImageMagick-7/MagickCore/paint.h
./include/ImageMagick-7/MagickCore/pixel-accessor.h
./include/ImageMagick-7/MagickCore/pixel.h
./include/ImageMagick-7/MagickCore/policy.h
./include/ImageMagick-7/MagickCore/prepress.h
./include/ImageMagick-7/MagickCore/profile.h
./include/ImageMagick-7/MagickCore/property.h
./include/ImageMagick-7/MagickCore/quantize.h
./include/ImageMagick-7/MagickCore/quantum.h
./include/ImageMagick-7/MagickCore/random_.h
./include/ImageMagick-7/MagickCore/registry.h
./include/ImageMagick-7/MagickCore/resample.h
./include/ImageMagick-7/MagickCore/resize.h
./include/ImageMagick-7/MagickCore/resource_.h
./include/ImageMagick-7/MagickCore/segment.h
./include/ImageMagick-7/MagickCore/semaphore.h
./include/ImageMagick-7/MagickCore/shear.h
./include/ImageMagick-7/MagickCore/signature.h
./include/ImageMagick-7/MagickCore/splay-tree.h
./include/ImageMagick-7/MagickCore/static.h
./include/ImageMagick-7/MagickCore/statistic.h
./include/ImageMagick-7/MagickCore/stream.h
./include/ImageMagick-7/MagickCore/string_.h
./include/ImageMagick-7/MagickCore/studio.h
./include/ImageMagick-7/MagickCore/threshold.h
./include/ImageMagick-7/MagickCore/timer.h
./include/ImageMagick-7/MagickCore/token.h
./include/ImageMagick-7/MagickCore/transform.h
./include/ImageMagick-7/MagickCore/type.h
./include/ImageMagick-7/MagickCore/utility.h
./include/ImageMagick-7/MagickCore/version.h
./include/ImageMagick-7/MagickCore/vision.h
./include/ImageMagick-7/MagickCore/widget.h
./include/ImageMagick-7/MagickCore/xml-tree.h
./include/ImageMagick-7/MagickCore/xwindow.h
./include/ImageMagick-7/MagickWand
./include/ImageMagick-7/MagickWand/animate.h
./include/ImageMagick-7/MagickWand/compare.h
./include/ImageMagick-7/MagickWand/composite.h
./include/ImageMagick-7/MagickWand/conjure.h
./include/ImageMagick-7/MagickWand/convert.h
./include/ImageMagick-7/MagickWand/deprecate.h
./include/ImageMagick-7/MagickWand/display.h
./include/ImageMagick-7/MagickWand/drawing-wand.h
./include/ImageMagick-7/MagickWand/identify.h
./include/ImageMagick-7/MagickWand/import.h
./include/ImageMagick-7/MagickWand/magick-cli.h
./include/ImageMagick-7/MagickWand/magick-image.h
./include/ImageMagick-7/MagickWand/magick-property.h
./include/ImageMagick-7/MagickWand/MagickWand.h
./include/ImageMagick-7/MagickWand/method-attribute.h
./include/ImageMagick-7/MagickWand/mogrify.h
./include/ImageMagick-7/MagickWand/montage.h
./include/ImageMagick-7/MagickWand/operation.h
./include/ImageMagick-7/MagickWand/pixel-iterator.h
./include/ImageMagick-7/MagickWand/pixel-wand.h
./include/ImageMagick-7/MagickWand/stream.h
./include/ImageMagick-7/MagickWand/wand-view.h
./include/ImageMagick-7/MagickWand/wandcli.h
./lib
./lib/ImageMagick-7.0.8
./lib/ImageMagick-7.0.8/config-Q16HDRI
./lib/ImageMagick-7.0.8/config-Q16HDRI/configure.xml
./lib/libMagickCore-7.Q16HDRI.a
./lib/libMagickCore-7.Q16HDRI.la
./lib/libMagickWand-7.Q16HDRI.a
./lib/libMagickWand-7.Q16HDRI.la
./lib/pkgconfig
./lib/pkgconfig/ImageMagick-7.Q16HDRI.pc
./lib/pkgconfig/ImageMagick.pc
./lib/pkgconfig/MagickCore-7.Q16HDRI.pc
./lib/pkgconfig/MagickCore.pc
./lib/pkgconfig/MagickWand-7.Q16HDRI.pc
./lib/pkgconfig/MagickWand.pc
./share
./share/ImageMagick-7
./share/ImageMagick-7/english.xml
./share/ImageMagick-7/francais.xml
./share/ImageMagick-7/locale.xml

@ersel
Copy link

ersel commented Nov 22, 2023

I have recently compiled one for arm architecture, you can find it here

https://github.com/CyprusCodes/imagemagick-aws-lambda-2/tree/master/archive

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

No branches or pull requests

3 participants