building node-canvas under AIX

Use this board for starting discussions, asking questions, and giving advice on Web programming for the IBM i platform (and predecessors.)
daniel.khalily
New User
Posts: 2
Joined: Mon Dec 07, 2020 5:14 pm
First Name: Daniel
Last Name: Khalily
Company Name: 3LINC
Contact:

building node-canvas under AIX

Post by daniel.khalily »

After a long struggle compiling dependencies, I managed to compile node-canvas under AIX.


However I got a runtime error when I attempted to use it in a test:
node ~/didit.js

internal/modules/cjs/loader.js:1122
return process.dlopen(module, path.toNamespacedPath(filename));
Error: rtld: 0712-001 Symbol _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_ was referenced
from module /home/AZIZHQS/node-canvas-2.6.1/build/Release/canvas.node(), but a runtime definition
of the symbol was not found.
rtld: 0712-002 fatal error: exiting.
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/AZIZHQS/node-canvas-2.6.1/lib/bindings.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)



I tried to figure out where this symbol was coming from.

echo whereis _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_
| dbx /home/AZIZHQS/node-canvas-2.6.1/build/Release/canvas.node

Type 'help' for help.
warning: cannot execute /home/AZIZHQS/node-canvas-2.6.1/build/Release/canvas.node
reading symbolic information ...program is not active

glink64._ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_
BMPParser.std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<c
har>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*)
glink64._ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_

I'm not sure how to read this, but I see BMPParser.std which is an object in this package.
However, I noticed that the Node export file also had this symbol in it:

grep _ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_
/QOpenSys/pkgs/lib/nodejs14/include/node/node.exp

_ZStplIcSt11char_traitsIcESaIcEENSt7__cxx1112basic_stringIT_T0_T1_EERKS8_PKS5_

I see this being used here in the Makefile:
quiet_cmd_regen_makefile = ACTION Regenerating $@
cmd_regen_makefile = cd $(srcdir); /QOpenSys/pkgs/lib/nodejs14/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake
--ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/AZIZHQS/.cache/node-gyp/14.15.1" "-
Dnode_exp_file=/QOpenSys/pkgs/lib/nodejs14/include/node/node.exp" "-Dnode_gyp_dir=/QOpenSys/pkgs/lib/nodejs14/lib/node_modules/np
m/node_modules/node-gyp" "-Dnode_lib_file=/home/AZIZHQS/.cache/node-gyp/14.15.1/<(target_arch)/node.lib" "-Dmodule_root_dir=/home
/AZIZHQS/node-canvas-2.6.1" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/AZIZHQS/node-canva
s-2.6.1/build/config.gypi -I/QOpenSys/pkgs/lib/nodejs14/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/AZIZHQS/.ca
che/node-gyp/14.15.1/include/node/common.gypi "--toplevel-dir=." binding.gyp
Makefile: $(srcdir)/../../../QOpenSys/pkgs/lib/nodejs14/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/../.cache
/node-gyp/14.15.1/include/node/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp
$(call do_cmd,regen_makefile)



I tried recompiling with -Xlinker -bexpfull (and -Xlinker -bexpfull -ffunction-sections).

This caused the linker error:

ld: 0711-302 ERROR: Object Release/obj.target/canvas/src/CanvasPattern.o, csect <_CanvasPattern.ro_>
The csect is part of the .text section, and relocation entries
from the csect have been written to the .loader section.
ld: 0711-302 ERROR: Object Release/obj.target/canvas/src/Image.o, csect <_Image.ro_>
The csect is part of the .text section, and relocation entries
from the csect have been written to the .loader section.
ld: 0711-302 ERROR: Object Release/obj.target/canvas/src/ImageData.o, csect <_ImageData.ro_>
The csect is part of the .text section, and relocation entries
from the csect have been written to the .loader section.
ld: 0711-302 ERROR: Object Release/obj.target/canvas/src/init.o, csect <_init.ro_>
The csect is part of the .text section, and relocation entries
from the csect have been written to the .loader section.
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
collect2: error: ld returned 8 exit status
make: *** [canvas.target.mk:188: Release/obj.target/canvas.node] Error 1
internal/modules/cjs/loader.js:1122
return process.dlopen(module, path.toNamespacedPath(filename));


I also tried to create an export module file but (a) I wasn't able to get this working either, still got the same error and (b) I'm not sure how to determine what symbols I would need.


Thanks in advance for any help whatsoever!
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: building node-canvas under AIX

Post by Scott Klement »

I would think about posting this on Midrange.com's OPENSOURCE mailing list https://lists.midrange.com/mailman/listinfo/opensource or maybe the IBM i section of IBM Community. Try to find a place where people who do this sort of thing hang out (porting applications to PASE, building native add-ons under PASE, etc)

This isn't something we've worked with before, and i'm not familiar with that symbol. (It looks fairly complex) It does mention __cxx11 in the symbol which makes me think it ws linked against libstdc++11, which might be related to the problem? But, this is just a guess?

But, i'm afraid its beyond me to help much with this.
daniel.khalily
New User
Posts: 2
Joined: Mon Dec 07, 2020 5:14 pm
First Name: Daniel
Last Name: Khalily
Company Name: 3LINC
Contact:

Re: building node-canvas under AIX

Post by daniel.khalily »

Thanks for your input, and for providing those resources.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests