On Thu, Feb 7, 2013 at 10:03 PM, Kevin Baker <[email protected]> wrote:
> Hello all,
>
> I am working on Node.JS's OpenEmbedded support for a project here, test
> platform is Yocto "danny"/armv7a-vfp-neon-poky-linux-gnueabi/OMAP3730.
>
> So far I have updated the recipe to v0.8.15 and it builds, compiles, and
> runs node correctly, with support for npm and pure js libraries. I plan to
> post this back to OE-core once I clean up the recipe, but I am trying to get
> native builds working to build at least node-sqlite3 for our application. I
> would really like to build the libraries in the OpenEmbedded cross-compile
> environment and not on the target device itself, like what was posted here
> http://fastr.github.com/articles/Node.js-on-OpenEmbedded.html .
>
> I have made lots of progress on this, up to the point where it cross-builds
> the library for ARM with node-gyp. This required a bit of hacking on
> node-gyp, using native gyp instead of the one included with node, and some
> differences in the way node-gyp handles paths, since they are being run out
> of the cross-compile environment directory instead of relative to / .
>
> Unfortunately the library that is getting built doesn't work in the target
> environment:
>
> root@device:/usr/lib/node_modules/npm/node_modules/sqlite3# node
>> var sqlite3 = require('./node-sqlite3.node').verbose();
> Error: /usr/lib/node_modules/npm/node_modules/sqlite3/node-sqlite3.node:
> undefined symbol: init
>     at Object.Module._extensions..node (module.js:485:11)
>     at Module.load (module.js:356:32)
>     at Function.Module._load (module.js:312:12)
>     at Module.require (module.js:362:17)
>     at require (module.js:378:17)
>     at repl:1:15
>     at REPLServer.self.eval (repl.js:109:21)
>     at rli.on.self.bufferedCmd (repl.js:258:20)
>     at REPLServer.self.eval (repl.js:116:5)
>     at Interface.<anonymous> (repl.js:248:12)
>>
>
> My question is, what are the steps from here? I'm not really familiar with
> the internals of node libraries or node-gyp to know what is not working. I
> can provide the built object or an armv7a node if it would help...
>
> Looking at an objdump of the module, it doesn't look like there is an
> init...
>
> venture@embedded-dev:/home/yocto-danny/poky/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/node-sqlite3-git-r5/git/build/Release$
> $OBJDUMP -t node_sqlite3.node | grep -i init
> 00009f50 l    d  .init     00000000              .init
> 000a9370 l    d  .init_array       00000000              .init_array
> 000a9370 l     O .init_array       00000000
> __frame_dummy_init_array_entry
> 0001cf24 l     F .text  00000008              sqlite3MemInit
> 0001d018 l     F .text  00000008              noopMutexInit
> 0001d044 l     F .text  00000008              pthreadMutexInit
> 00020f90 l     F .text  000000a8              sqlite3VdbeIntegerAffinity
> 000219a8 l     F .text  00000084              applyNumericAffinity
> 00021ea4 l     F .text  000000b4
> sqlite3ExprNeedsNoAffinityChange
> 0002225c l     F .text  00000150              sqlite3AffinityType
> 000223ac l     F .text  00000080              sqlite3ExprAffinity
> 0002242c l     F .text  00000044              sqlite3CompareAffinity
> 00022470 l     F .text  00000058              comparisonAffinity
> 000224c8 l     F .text  00000044              sqlite3IndexAffinityOk
> 0002a084 l     F .text  0000009c              sqlite3TableAffinityStr
> 0002ce4c l     F .text  000000b4
> sqlite3IndexAffinityStr.clone.111
> 00033ad4 l     F .text  000000e4              codeApplyAffinity
> 000373ac l     F .text  00000074              nodeReaderInit
> 0003e670 l     F .text  00000218              btreeInitPage
> 0003e888 l     F .text  0000002c              pageReinit
> 00046cc0 l     F .text  00000060              applyAffinity
> 0004bee4 l     F .text  000001c8              sqlite3Fts3InitTokenizer
> 0004d144 l     F .text  00000074              pcache1Init
> 00051134 l     F .text  00000054              getAndInitPage
> 000718b4 l     F .text  000001b0              sqlite3InitCallback
> 00085a88 l     F .text  000000ac              fts3ExprTermOffsetInit
> 00077858 l     F .text  000004dc              rtreeInit
> 00077e74 l     F .text  000004b0              sqlite3InitOne
> 00078324 l     F .text  00000100              sqlite3Init
> 00081d8c l     F .text  00001254              fts3InitVtab
> 0001bf04  w    F .text  000000f4
> _ZNSt11_Deque_baseIPN12node_sqlite39Statement4CallESaIS3_EE17_M_initialize_mapEj
> 0004d284 g     F .text  00000044              sqlite3_os_init
> 0005e464 g     F .text  00000150              sqlite3_backup_init
> 00000000         *UND*  00000000              uv_async_init
> 00000000         *UND*  00000000              pthread_mutexattr_init
> 000116d8 g     F .text  000001bc
> _ZN12node_sqlite39Statement4InitEN2v86HandleINS1_6ObjectEEE
> 00000000       F *UND*  00000000              pthread_mutex_init@@GLIBC_2.4
> 0000b8e0 g     F .text  000001ec
> _ZN12node_sqlite38Database4InitEN2v86HandleINS1_6ObjectEEE
> 00031308 g     F .text  000005dc              sqlite3_initialize
> 0000f374  w    F .text  000000f4
> _ZNSt11_Deque_baseIPN12node_sqlite38Database4CallESaIS3_EE17_M_initialize_mapEj
> 00009f50 g     F .init     00000000              _init
>
> Thanks,
>
> Kevin Baker

The issue is that node.js looks for a symbol called "init" but it
seems your compiler / linker named it "_init".  (Unless it's a
completely unrelated symbol.  The fact that it's in .init instead of
.text is suggestive.)

Some things you can check:

* Is the function declared static?  (It shouldn't be.)
* Does it have C linkage, i.e. extern "C" void init(...)?
* Are you compiling with -fleading-underscore?  (Don't.)

Hope that helps.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to