Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150627131837.2f689ca4@r2lynx>
Date: Sat, 27 Jun 2015 13:18:37 +0700
From: Рысь <lynx@...server.ru>
To: musl@...ts.openwall.com
Subject: Re: Link problems with static node-canvas

On Sat, 27 Jun 2015 01:06:04 +0200
"piranna@...il.com" <piranna@...il.com> wrote:

> I have been trying in the last days to craft a statically linked
> version of node-canvas (https://github.com/Automattic/node-canvas) to
> use it in NodeOS (a musl-based Linux OS with no global libraries).
> 
> In my fork I managed to convert it from needing cairo, libjpeg,
> freetype and giflib as dynamica libraries to create it as a statically
> linked shared object that contains all of them inside, making it
> autonomous (that's the way ideally Node.js addons are build, as .so
> files -with the extension changed to .node- with all their
> dependencies statically linked and not needing any dynamic library.
> This .node files later are loaded with dlopen() when someone requires
> them by calling the require() function from inside Node.js).
> 
> When compiling it in Ubuntu using glibc it works correctly, but when
> compiling it for NodeOS using musl, I got an error about "Error
> relocating: jinit_arith_decode symbol not found"
> (https://github.com/Automattic/node-canvas/issues/551#issuecomment-114253760).
> That function is from libjpeg, and both the jpeg.a and the canvas.node
> files have references to it. I've trying to use the musl-compiled
> canvas.node file by using LD_LIBRARY_PATH and it shows the "Error
> relocating" string, but doesn't clarify where's the error. At first I
> though it would be a libjpeg-turbo problem, but after removing the
> support for JPEG in node-canvas, the same "Error relocating" problem
> showed, only that now regarding to a FreeType function, so since it
> works correctly with glibc that's why I thought it could be a linking
> problem related to musl. This is strange since other compiled modules
> works correctly under NodeOS, but it's true they don't link with other
> libraries (both startic or dynamic) beyond the C lib or the Linux
> kernel SysCalls... :-/
> 
> Any idea or suggestiong about what could be the culprit or where to
> continue investigating?
> 

If canvas.node is a shared object then linker will not warn you about
any missing symbols when making it. So, your libjpeg.a was not included
during build or somehow broken. Do a `readelf -Wa canvas.node` and make
sure you still have no shared dependencies on libraries you link
statically (you have no NEEDED libraries in Dynamic section).
Alternatively gzip the output and attach with your next message.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.