Message ID | 1344827150-25067-3-git-send-email-net147@gmail.com |
---|---|
State | Superseded |
Headers | show |
Hello Jonathan, Le Mon, 13 Aug 2012 13:05:50 +1000, Jonathan Liu <net147@gmail.com> a écrit : > Signed-off-by: Jonathan Liu <net147@gmail.com> > --- > package/Config.in | 1 + > package/nodejs/Config.in | 20 +++++++++++++++ > package/nodejs/nodejs.mk | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 84 insertions(+) > create mode 100644 package/nodejs/Config.in > create mode 100644 package/nodejs/nodejs.mk nodejs includes V8 for executing the JavaScript code, and V8 generates machine code to provide good performances when executing JavaScript. This means that V8 is architecture dependent: apparently, in deps/v8/, only IA32, x86-64, ARM and MIPS are supported. However, I don't understand how you select the target architecture or how it is detected. Some comments in the configure script also seem to imply that on ARM, only ARMv7 is supported by V8. Have you checked this, or did you try only a x86->x86 build? Thanks! Thomas
Le Sat, 25 Aug 2012 19:15:38 +0200, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a écrit : > nodejs includes V8 for executing the JavaScript code, and V8 generates > machine code to provide good performances when executing JavaScript. > This means that V8 is architecture dependent: apparently, in deps/v8/, > only IA32, x86-64, ARM and MIPS are supported. > > However, I don't understand how you select the target architecture or > how it is detected. Some comments in the configure script also seem to > imply that on ARM, only ARMv7 is supported by V8. > > Have you checked this, or did you try only a x86->x86 build? And also, it doesn't work here (Linaro 2012.02 toolchain, ARM) : >>> nodejs 0.8.6 Configuring (cd /home/thomas/projets/buildroot/output/build/nodejs-0.8.6; PATH="/home/thomas/projets/buildroot/output/host/bin:/home/thomas/projets/buildroot/output/host/usr/bin:/home/thomas/projets/buildroot/output/host/usr/sbin/:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/thomas/sys/bin" AR="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-ar" AS="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-as" LD="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-ld" NM="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-nm" CC="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-gcc" GCC="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-gcc" CPP="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-cpp" CXX="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-g++" FC="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-gfortran" RANLIB="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-ranlib" STRIP="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-strip" OBJCOPY="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-objcopy" OBJDUMP="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="/usr/bin/gcc" GCC_FOR_BUILD="/usr/bin/gcc" CXX_FOR_BUILD="/usr/bin/g++" FC_FOR_BUILD="/usr/bin/ld" LD_FOR_BUILD="/usr/bin/ld" CFLAGS_FOR_BUILD="-O2 -I/home/thomas/projets/buildroot/output/host/include -I/home/thomas/projets/buildroot/output/host/usr/include" CXXFLAGS_FOR_BUILD="-I/home/thomas/projets/buildroot/output/host/include -I/home/thomas/projets/buildroot/output/host/usr/include" LDFLAGS_FOR_BUILD="-L/home/thomas/projets/buildroot/output/host/lib -L/home/thomas/projets/buildroot/output/host/usr/lib -Wl,-rpath,/home/thomas/projets/buildroot/output/host/usr/lib" FCFLAGS_FOR_BUILD="" DEFAULT_ASSEMBLER="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-as" DEFAULT_LINKER="/home/thomas/projets/buildroot/output/host/usr/bin/arm-linux-gnueabi-ld" CFLAGS=" -pipe -Os -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" CXXFLAGS=" -pipe -Os -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" LDFLAGS="" FCFLAGS="" PKG_CONFIG="/home/thomas/projets/buildroot/output/host/usr/bin/pkg-config" PERLLIB="/home/thomas/projets/buildroot/output/host/usr/lib/perl" STAGING_DIR="/home/thomas/projets/buildroot/output/host/usr/arm-unknown-linux-gnueabi/sysroot" PATH="/home/thomas/projets/buildroot/output/host/bin:/home/thomas/projets/buildroot/output/host/usr/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/thomas/sys/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/thomas/sys/bin" ./configure --prefix=/usr --without-snapshot --without-ssl --without-dtrace --without-etw ) { 'target_defaults': { 'cflags': [], 'default_configuration': 'Release', 'defines': [], 'include_dirs': [], 'libraries': []}, 'variables': { 'armv7': 1, 'host_arch': 'arm', 'node_install_npm': 'true', 'node_install_waf': 'true', 'node_prefix': '/usr', 'node_shared_openssl': 'false', 'node_shared_v8': 'false', 'node_shared_zlib': 'false', 'node_use_dtrace': 'false', 'node_use_etw': 'false', 'node_use_openssl': 'false', 'target_arch': 'arm', 'v8_no_strict_aliasing': 1, 'v8_use_arm_eabi_hardfloat': 'false', 'v8_use_snapshot': 'false'}} creating ./config.gypi creating ./config.mk Traceback (most recent call last): File "tools/gyp_node", line 58, in <module> run_gyp(gyp_args) File "tools/gyp_node", line 18, in run_gyp rc = gyp.main(args) File "./tools/gyp/pylib/gyp/__init__.py", line 471, in main options.circular_check) File "./tools/gyp/pylib/gyp/__init__.py", line 111, in Load depth, generator_input_info, check, circular_check) File "./tools/gyp/pylib/gyp/input.py", line 2378, in Load depth, check) File "./tools/gyp/pylib/gyp/input.py", line 430, in LoadTargetBuildFile includes, depth, check) File "./tools/gyp/pylib/gyp/input.py", line 384, in LoadTargetBuildFile build_file_data, PHASE_EARLY, variables, build_file_path) File "./tools/gyp/pylib/gyp/input.py", line 1027, in ProcessVariablesAndConditionsInDict ProcessConditionsInDict(the_dict, phase, variables, build_file) File "./tools/gyp/pylib/gyp/input.py", line 904, in ProcessConditionsInDict variables, build_file) File "./tools/gyp/pylib/gyp/input.py", line 1053, in ProcessVariablesAndConditionsInDict build_file) File "./tools/gyp/pylib/gyp/input.py", line 1068, in ProcessVariablesAndConditionsInList ProcessVariablesAndConditionsInDict(item, phase, variables, build_file) File "./tools/gyp/pylib/gyp/input.py", line 1053, in ProcessVariablesAndConditionsInDict build_file) File "./tools/gyp/pylib/gyp/input.py", line 1068, in ProcessVariablesAndConditionsInList ProcessVariablesAndConditionsInDict(item, phase, variables, build_file) File "./tools/gyp/pylib/gyp/input.py", line 1027, in ProcessVariablesAndConditionsInDict ProcessConditionsInDict(the_dict, phase, variables, build_file) File "./tools/gyp/pylib/gyp/input.py", line 904, in ProcessConditionsInDict variables, build_file) File "./tools/gyp/pylib/gyp/input.py", line 1027, in ProcessVariablesAndConditionsInDict ProcessConditionsInDict(the_dict, phase, variables, build_file) File "./tools/gyp/pylib/gyp/input.py", line 904, in ProcessConditionsInDict variables, build_file) File "./tools/gyp/pylib/gyp/input.py", line 1027, in ProcessVariablesAndConditionsInDict ProcessConditionsInDict(the_dict, phase, variables, build_file) File "./tools/gyp/pylib/gyp/input.py", line 885, in ProcessConditionsInDict if eval(ast_code, {'__builtins__': None}, variables): File "<string>", line 1, in <module> NameError: name 'arm_neon' is not defined while evaluating condition 'arm_neon!=1 and arm_fpu!="vfpv3" and arm_fpu!="vfpv3-d16"' in /home/thomas/projets/buildroot/output/build/nodejs-0.8.6/deps/v8/tools/gyp/v8.gyp while loading dependencies of /home/thomas/projets/buildroot/output/build/nodejs-0.8.6/node.gyp while trying to load /home/thomas/projets/buildroot/output/build/nodejs-0.8.6/node.gyp Thomas
Hi Thomas, On 26/08/2012 3:15 AM, Thomas Petazzoni wrote: > nodejs includes V8 for executing the JavaScript code, and V8 generates > machine code to provide good performances when executing JavaScript. > This means that V8 is architecture dependent: apparently, in deps/v8/, > only IA32, x86-64, ARM and MIPS are supported. > > However, I don't understand how you select the target architecture or > how it is detected. Some comments in the configure script also seem to > imply that on ARM, only ARMv7 is supported by V8. > > Have you checked this, or did you try only a x86->x86 build? I have mainly been testing x86-64->x86 builds. I tried doing a x86-64->qemu-arm-versatile build and it seems to boot and run node.js properly (I am using 2012.08-rc2 with CodeSourcery ARM 2011.09 external toolchain). Perhaps it needs a patch to build on an ARM host (https://gist.github.com/1608607 might help). Also, I was not able to get the qemu arm-versatile build to boot using ext2 image and the qemu command in board/qemu/arm-versatile/readme.txt. I get "Cannot open root device or unknown-block(0,0)" when it tries to open /dev/sda. Booting using a cpio initrd image works though. Anything special I need to boot using ext2 image with ARM in qemu? Regards, Jonathan
diff --git a/package/Config.in b/package/Config.in index f308de7..76c589b 100644 --- a/package/Config.in +++ b/package/Config.in @@ -263,6 +263,7 @@ source "package/xavante/Config.in" endmenu endif source "package/microperl/Config.in" +source "package/nodejs/Config.in" source "package/php/Config.in" source "package/python/Config.in" if BR2_PACKAGE_PYTHON diff --git a/package/nodejs/Config.in b/package/nodejs/Config.in new file mode 100644 index 0000000..52fb03d --- /dev/null +++ b/package/nodejs/Config.in @@ -0,0 +1,20 @@ +config BR2_PACKAGE_NODEJS + bool "nodejs" + help + Event-driven I/O server-side JavaScript environment based on V8. + + http://nodejs.org/ + +if BR2_PACKAGE_NODEJS + +config BR2_PACKAGE_NODEJS_NPM + bool "npm" + help + Enable npm (Node Package Manager). + +config BR2_PACKAGE_NODEJS_WAF + bool "waf" + help + Enable node-waf for building native modules. + +endif diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk new file mode 100644 index 0000000..442c5f9 --- /dev/null +++ b/package/nodejs/nodejs.mk @@ -0,0 +1,63 @@ +############################################################# +# +# nodejs +# +############################################################# +NODEJS_VERSION = 0.8.6 +NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.gz +NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION) +NODEJS_DEPENDENCIES = host-python +NODEJS_LICENSE = MIT + +# Headers and node-waf binary are needed in staging to build 3rd-party +# native modules +NODEJS_INSTALL_STAGING = YES + +ifeq ($(BR2_PACKAGE_OPENSSL),y) + NODEJS_DEPENDENCIES += openssl +endif + +define NODEJS_CONFIGURE_CMDS + (cd $(@D); \ + $(TARGET_CONFIGURE_OPTS) \ + PATH="$(HOST_PATH):$(PATH)" \ + ./configure \ + --prefix=/usr \ + --without-snapshot \ + $(if $(BR2_PACKAGE_OPENSSL),--shared-openssl,--without-ssl) \ + $(if $(BR2_PACKAGE_NODEJS_NPM),,--without-npm) \ + $(if $(BR2_PACKAGE_NODEJS_WAF),,--without-waf) \ + --without-dtrace \ + --without-etw \ + ) +endef + +define NODEJS_BUILD_CMDS + PATH="$(HOST_PATH):$(PATH)" $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) +endef + +define NODEJS_INSTALL_STAGING_CMDS + PATH="$(HOST_PATH):$(PATH)" $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) DESTDIR=$(STAGING_DIR) install +endef + +define NODEJS_UNINSTALL_STAGING_CMDS + rm -f $(STAGING_DIR)/usr/bin/node + rm -f $(STAGING_DIR)/usr/bin/node-waf + rm -f $(STAGING_DIR)/usr/bin/npm + rm -rf $(STAGING_DIR)/usr/include/node + rm -f $(STAGING_DIR)/usr/lib/dtrace/node.d + rm -rf $(STAGING_DIR)/usr/lib/node + rm -rf $(STAGING_DIR)/usr/lib/node_modules + rm -f $(STAGING_DIR)/usr/share/man/man1/node.1 +endef + +define NODEJS_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 775 $(@D)/out/Release/node $(TARGET_DIR)/usr/bin/node +endef + +define NODEJS_UNINSTALL_TARGET_CMDS + rm -f $(TARGET_DIR)/usr/bin/node +endef + +# node.js configure is a Python script and does not use autotools +$(eval $(generic-package))
Signed-off-by: Jonathan Liu <net147@gmail.com> --- package/Config.in | 1 + package/nodejs/Config.in | 20 +++++++++++++++ package/nodejs/nodejs.mk | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 package/nodejs/Config.in create mode 100644 package/nodejs/nodejs.mk