Cross Compiling Node.js

88 views
Skip to first unread message

Fabrício Lélis

unread,
May 11, 2015, 9:56:49 PM5/11/15
to nod...@googlegroups.com
I' ve tried to make cross compiling node.js but I get this error:
./node: /lib/arm-linux-gnueabihf/libc.so.6: version `GLIBC_2.15' not found (required by ./node)

This is my script:

#!/bin/sh -e                                                                                                                                
  2                                                                                                                                             
  3 #Define our target device                                                                                                                   
  4 export TARGET_ARCH="-armhf"                                                                                                                 
  5 export TARGET_TUNE="-mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb"                                            
  6                                                                                                                                             
  7 #Define the cross compilators on your system                                                                                                
  8 export AR="arm-linux-gnueabihf-ar"                                                                                                          
  9 export CC="arm-linux-gnueabihf-gcc-4.7"                                                                                                     
 10 export CXX="arm-linux-gnueabihf-g++-4.7"                                                                                                    
 11 export LINK="arm-linux-gnueabihf-g++-4.7"                                                                                                   
 12 export CPP="arm-linux-gnueabihf-gcc-4.7 -E"                                                                                                 
 13 export LD="arm-linux-gnueabihf-ld"                                                                                                          
 14 export AS="arm-linux-gnueabihf-as"                                                                                                          
 15 export CCLD="arm-linux-gnueabihf-gcc-4.7 ${TARGET_ARCH} ${TARGET_TUNE}"                                                                     
 16 export NM="arm-linux-gnueabihf-nm"                                                                                                          
 17 export STRIP="arm-linux-gnueabihf-strip"                                                                                                    
 18 export OBJCOPY="arm-linux-gnueabihf-objcopy"                                                                                                
 19 export RANLIB="arm-linux-gnueabihf-ranlib"                                                                                                  
 20 export F77="arm-linux-gnueabihf-g77 ${TARGET_ARCH} ${TARGET_TUNE}"                                                                          
 21 unset LIBC                                                                                                                                  
 22                                                                                                                                             
 23 #Define flags                                                                                                                               
 24 export CXXFLAGS="-march=armv7-a"                                                                                                            
 25 export LDFLAGS="-L${CSTOOLS_LIB} -Wl,-rpath-link,${CSTOOLS_LIB} -Wl,-O1 -Wl,--hash-style=gnu"                                               
 26 export CFLAGS="-isystem${CSTOOLS_INC} -fexpensive-optimizations -frename-registers -fomit-frame-pointer -O2 -ggdb3"                         
 27 export CPPFLAGS="-isystem${CSTOOLS_INC}"                                                                                                    
 28 export CCFLAGS="-march=armv7-a"                                                                                                             
 29                                                                                                                                             
 30 #Tools                                                                                                                                      
 31 export CSTOOLS=/usr/arm-linux-gnueabihf                                                                                                     
 32 export CSTOOLS_INC=${CSTOOLS}/include                                                                                                       
 33 export CSTOOLS_LIB=${CSTOOLS}/lib/hf                                                                                                        
 34 export ARM_TARGET_LIB=$CSTOOLS_LIB                                                                                                          
 35 export GYP_DEFINES="armv7=1"                                                                                                                
 36                                                                                                                                             
 37 #Define other things, those are not 'must' to have defined but we added                                                                     
 38 export SHELL="/bin/bash"                                                                                                                    
 39 export TERM="screen"                                                                                                                        
 40 export LANG="en_US.UTF-8"                                                                                                                   
 41 export MAKE="make"                                                                                                                          
 42                                                                                                                                             
 43 #Export the path for your system                                                                                                            
 44 export HOME="/home/fabricio" #Change this one with the name of your user directory                                                          
 45 export PATH="${CSTOOLS}/bin:/usr/arm-linux-gnueabihf/bin/:${HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
 46                                                                                                                                             
 47 ./configure --without-snapshot --dest-cpu=arm --dest-os=linux --with-arm-float-abi=softfp                                                   
 48                                                                                                                                             
 49 bash --norc                     

Thanks!

Ben Noordhuis

unread,
May 12, 2015, 8:53:15 AM5/12/15
to nod...@googlegroups.com
The toolchain on the host system compiled the binary against a newer
version of glibc than what is installed on the target system.

You can try pinning library functions with .symver directives[0] but
ideally you should make the toolchain match the target.

[0] http://stackoverflow.com/a/5977518
Reply all
Reply to author
Forward
0 new messages