zhangyuanwei / node-images

Cross-platform image decoder(png/jpeg/gif) and encoder(png/jpeg) for Nodejs
https://npmjs.org/package/images
MIT License
1.55k stars 204 forks source link

AWS Lambda Node10.x issue #197

Closed dcarrion87 closed 4 years ago

dcarrion87 commented 4 years ago

Just wanted to see if you're looking to fix the Node10.x binding so it works on AWS Lambda? AWS are deprecating 8.10 and your Node10.x bindings do not work on Amazon Linux.

At the moment there's a GLIBC incompatibility:

Error: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /home/ec2-user/test/node_modules/images/vendor/linux-x64-64/binding.node)

Versions on Lambda:

[ec2-user@amzn2 linux-x64-64]$ yum info glibc | grep Version
Version     : 2.26
Version     : 2.26

Also if you could provide instructions for how you call node-gyp as I'm getting segmentation faults no matter how I compile with 10.x

dcarrion87 commented 4 years ago

Inside test folder

[ec2-user@amzn2 test]$ pwd
/home/ec2-user/node-images/test

Compiled binding.node

[ec2-user@amzn2 test]$ ldd ../vendor/linux-x64-64/binding.node
    linux-vdso.so.1 (0x00007fff68f63000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f1e29de1000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f1e29aa1000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f1e2988b000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1e2966d000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f1e292c2000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f1e2a42c000)

Trying to run tests

[ec2-user@amzn2 test]$ node index.js
Segmentation fault (core dumped)

from GDB

[ec2-user@amzn2 test]$ gdb node /tmp/core-node.12695.amzn2.1575330553
GNU gdb (GDB) Red Hat Enterprise Linux 8.0.1-30.amzn2.0.3
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from node...done.
[New LWP 12695]
[New LWP 12696]
[New LWP 12697]
[New LWP 12698]
[New LWP 12699]
[New LWP 12700]
[New LWP 12701]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `node index.js'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00000000008e8602 in (anonymous namespace)::v8impl::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) ()
[Current thread is 1 (Thread 0x7f054e660740 (LWP 12695))]
(gdb)
dcarrion87 commented 4 years ago

Oddly if I compile in Debug mode I don't get the segmentation fault!?!?

node-gyp --debug configure rebuild

dcarrion87 commented 4 years ago

OK I managed to get around this by adding the following to the binding.gyp to disable compiler optimizations.

'cflags!': [ '-O3']

This is not ideal due to performance impact. What compiler is the maintainer using to build the public releases? Could we get a snapshot of compiler params to see how they compare?

This is a tricky one to debug!

oxUnd commented 4 years ago

209

fixed