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

Node.js #436

Closed
guillaume86 opened this issue Mar 8, 2013 · 18 comments
Closed

Node.js #436

guillaume86 opened this issue Mar 8, 2013 · 18 comments

Comments

@guillaume86
Copy link

Hi,

It would be nice to have a Node.js package, I've tried to cross compile it myself but I'm not experienced at all with makefiles and I got stuck pretty quickly:

....
/configure  --host=arm-none-linux-gnueabi --build=i686-pc-linux --prefix=/usr/local --dest-cpu=arm --dest-os=linux
Usage: configure [options]

configure: error: no such option: --host

I guess this flag is injected by a mk file but I haven't found it yet, It would probably take me ages to finish the compilation at the speed I figure things out so I'm better off just submitting a request :)

Thx for your work on the syno, your packages are must have...

@guillaume86
Copy link
Author

Ok I got a bit further (stuck at install step), here's my Makefile (the arch is harcoded in config args for the moment):

PKG_NAME = node
PKG_VERS = 0.8.22
PKG_EXT = tar.gz
PKG_DIST_NAME = node-v$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = http://nodejs.org/dist/v$(PKG_VERS)
PKG_DIR = node-v$(PKG_VERS)

HOMEPAGE = http://www.nodejs.org/
COMMENT  = Evented I/O for V8 javascript.
LICENSE  =

# Configure
CONFIGURE_ARGS = --without-snapshot --dest-cpu=arm --dest-os=linux

# Install
#INSTALL_TARGET = myInstall
#POST_INSTALL_TARGET = $(WORK_DIR)/node-cc.mk

include ../../mk/spksrc.cross-cc.mk

and the error:

===>  Building package for arch 88f6281
make[1]: entrant dans le répertoire « /home/guillaume/spksrc/cross/node »
===>  Installing for node
find /home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/ \! -type d -printf '%P\n' | sort > /home/guillaume/spksrc/cross/node/work-88f6281/node.plist.tmp
cd /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22 && env PKG_CONFIG_LIBDIR=/home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/lib/pkgconfig WORK_DIR=/home/guillaume/spksrc/cross/node/work-88f6281 INSTALL_PREFIX=/usr/local TC=syno-88f6281  LD=/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++ CPP=/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-cpp NM=/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-nm CC=/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc AS=/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-as RANLIB=/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ranlib CXX=/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++ AR=/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ar STRIP=/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-strip OBJDUMP=/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-objdump CFLAGS=" -I/home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/include " CPPFLAGS=" -I/home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/include " CXXFLAGS=" -I/home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/include " LDFLAGS=" -L/home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/lib -Wl,--rpath-link,/home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/lib -Wl,--rpath,/usr/local/lib " make install prefix=/home/guillaume/spksrc/cross/node/work-88f6281/install/usr/local
make[2]: entrant dans le répertoire « /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22 »
make -C out BUILDTYPE=Release V=1
make[3]: entrant dans le répertoire « /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out »
  /home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld -pthread -rdynamic -pthread  -L/home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/lib -Wl,--rpath-link,/home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/lib -Wl,--rpath,/usr/local/lib  -o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/node -Wl,--start-group /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/fs_event_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/cares_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/handle_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_buffer.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_constants.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_extensions.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_file.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_http_parser.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_javascript.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_main.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_os.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_script.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_stat_watcher.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_string.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_zlib.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/pipe_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/stream_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/slab_allocator.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/tcp_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/timer_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/tty_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/process_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/v8_typed_array.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/udp_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_crypto.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_signal_watcher.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_io_watcher.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/http_parser/libhttp_parser.a /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/uv/libuv.a /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/openssl/libopenssl.a /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/zlib/libchrome_zlib.a /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/v8/tools/gyp/libv8_nosnapshot.a -Wl,--end-group -lm -ldl -lrt
/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: bad -rpath option
make[3]: *** [/home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/node] Erreur 1
make[3]: quittant le répertoire « /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out »
make[2]: *** [node] Erreur 2
make[2]: quittant le répertoire « /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22 »
make[1]: *** [install_target] Erreur 2
make[1]: quittant le répertoire « /home/guillaume/spksrc/cross/node »
make: [arch-88f6281] Erreur 2 (ignorée)

@guillaume86
Copy link
Author

I guess the problem is related to:

http://n8.io/cross-compiling-nodejs-v0.8/

$ export LINK=arm-unknown-linux-gnueabi-g++

Note that the LINK variable points to your g++ program rather than your ld program, since the Makefile uses some flags that ld does not recognize.

but I can't find where to change this in spksrc

@Diaoul
Copy link
Member

Diaoul commented Mar 8, 2013

In your Makefile, try this:

ENV += LINK=$(TC_PREFIX)g++

@guillaume86
Copy link
Author

Hi,

It didn't work unfortunatly (the command still uses ld).

I found a patch to skip the bad --rpath option problem (http://patches.openembedded.org/patch/38821/), but there's another problem immediatly after that (same problem than before I think):

===>  Building package for arch 88f6281
make[1]: entrant dans le répertoire « /home/guillaume/spksrc/cross/node »
===>  Compiling for node
make[2]: entrant dans le répertoire « /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22 »
python tools/gyp_node -f make
make -C out BUILDTYPE=Release V=1
make[3]: entrant dans le répertoire « /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out »
  /home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld -pthread -pthread  -L/home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/lib -Wl,--rpath-link,/home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/lib -Wl,--rpath,/usr/local/lib  -o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/node -Wl,--start-group /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/fs_event_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/cares_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/handle_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_buffer.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_constants.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_extensions.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_file.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_http_parser.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_javascript.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_main.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_os.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_script.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_stat_watcher.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_string.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_zlib.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/pipe_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/stream_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/slab_allocator.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/tcp_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/timer_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/tty_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/process_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/v8_typed_array.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/udp_wrap.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_crypto.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_signal_watcher.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/node/src/node_io_watcher.o /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/http_parser/libhttp_parser.a /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/uv/libuv.a /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/openssl/libopenssl.a /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/zlib/libchrome_zlib.a /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/obj.target/deps/v8/tools/gyp/libv8_nosnapshot.a -Wl,--end-group -lm -ldl -lrt
/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: unrecognized option '-Wl,--rpath-link,/home/guillaume/spksrc/cross/node/work-88f6281/install//usr/local/lib'
/home/guillaume/spksrc/toolchains/syno-88f6281/work/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld: use the --help option for usage information
make[3]: *** [/home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out/Release/node] Erreur 1
make[3]: quittant le répertoire « /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22/out »
make[2]: *** [node] Erreur 2
make[2]: quittant le répertoire « /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22 »
make[1]: *** [compile_target] Erreur 2
make[1]: quittant le répertoire « /home/guillaume/spksrc/cross/node »
make: [arch-88f6281] Erreur 2 (ignorée)

@guillaume86
Copy link
Author

I'll take a look at http://www.nodejs-news.com/nodejs-tech/ruby-to-build-nodejs-raspberrypi/ if I've still got the courage this weekend

@Diaoul
Copy link
Member

Diaoul commented Mar 8, 2013

IMO you just need to redefine LD. Use a custom compile target which runs $(RUN) $(MAKE) LD=$(TC_PATH)$(TC_PREFIX)g++ so you override LD defined by the environment.

@guillaume86
Copy link
Author

Ok with your suggestion + the patch, I can get further,
this time it looks easier: trying to install in a system path and have not the rights, I have to customize the install step to install locally I guess:

...
make install prefix=/home/guillaume/spksrc/cross/node/work-88f6281/install/usr/local
Traceback (most recent call last):
  File "tools/install.py", line 234, in <module>
    run(sys.argv[:])
  File "tools/install.py", line 229, in run
    if cmd == 'install': return files(install)
  File "tools/install.py", line 191, in files
    'include/node/')
  File "tools/install.py", line 79, in install
    def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
  File "tools/install.py", line 79, in <lambda>
    def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
  File "tools/install.py", line 69, in try_copy
    try_mkdir_r(os.path.dirname(target_path))
  File "tools/install.py", line 44, in try_mkdir_r
    os.makedirs(path)
  File "/usr/lib/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/include/node'
make[2]: *** [install] Erreur 1
make[2]: quittant le répertoire « /home/guillaume/spksrc/cross/node/work-88f6281/node-v0.8.22 »
make[1]: *** [install_target] Erreur 2
make[1]: quittant le répertoire « /home/guillaume/spksrc/cross/node »
make: [arch-88f6281] Erreur 2 (ignorée)

@Diaoul
Copy link
Member

Diaoul commented Mar 8, 2013

Override the install target this time with $(RUN) $(MAKE) install DESTDIR=$(INSTALL_DIR).
This is a common way to install in a destination directory so it might work.

@guillaume86
Copy link
Author

Thanks I almost found this one alone before you replied ^^

It works now, but it stops without errors after that step, perhaps I have to write the PLIST file now?

@Diaoul
Copy link
Member

Diaoul commented Mar 8, 2013

PLISTS are auto-generated in the work directory. Just pick nodejs.plist in there and copy it to PLIST. Remove the junk in it and give the correct prefixes.

@guillaume86
Copy link
Author

I finally got a package out and it's working! Thx a lot

The build process is not clean, if I apply the patch automatically I have the ld issue, I got to launch make a first time, waiting for the first ld error, applying the patch manually then relaunch make and the compile/install finishes.

Then I had to copy paste the PLIST and the work-ARCH folder to the /spk/node, set the arch in the makefile and make from there - no idea why it's not working automatically.

@Diaoul
Copy link
Member

Diaoul commented Mar 9, 2013

You don't need to set the ARCH in the Makefile, just run make ARCH=qoriq for example.
Could you link me the patch? If it does patch a .in file make sure to run autoconf in the pre-configure target.

@guillaume86
Copy link
Author

Ok I'll try that, here's the patch:

*** common.gypi.orig    2013-03-08 20:58:10.000000000 +0100
--- common.gypi 2013-03-08 20:58:47.000000000 +0100
***************
*** 164,170 ****
        [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
          'cflags': [ '-Wall', '-pthread', ],
          'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
!         'ldflags': [ '-pthread', '-rdynamic' ],
          'conditions': [
            [ 'target_arch=="ia32"', {
              'cflags': [ '-m32' ],
--- 164,170 ----
        [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
          'cflags': [ '-Wall', '-pthread', ],
          'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
!         'ldflags': [ '-pthread' ],
          'conditions': [
            [ 'target_arch=="ia32"', {
              'cflags': [ '-m32' ],

@guillaume86
Copy link
Author

So the preConfigure don't work because it's not a .in file (my bad), I setup a fork if you want to take a look https://github.com/guillaume86/spksrc

@guillaume86
Copy link
Author

The solution is probably to patch a node makefile to switch ld to g++ at the right time

@Rapiere
Copy link
Contributor

Rapiere commented Apr 23, 2013

if it could help you, I issued a pull request with latest Node.js which compiled for arm architecture however I couldn't test it (only tested cedarview on my ds412+).

@Diaoul
Copy link
Member

Diaoul commented Apr 23, 2013

I'll merge this once tested

@guillaume86
Copy link
Author

Nice! I'll use that package if it's working :)

2013/4/23 Antoine Bertin notifications@github.com

I'll merge this once tested


Reply to this email directly or view it on GitHubhttps://github.com//issues/436#issuecomment-16851888
.

@Diaoul Diaoul closed this as completed Jun 2, 2013
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