永远也记不住的linux环境变量,库文件,头文件,交叉编译...
一、环境变量
1、node-v4.9.1-linux-armv7l
1)安装
cp node-v4.9.1-linux-armv7l.tar.gz /usr/local/
cd /usr/local/
tar xvf node-v4.9.1-linux-armv7l.tar.gz
2)添加环境变量
export PATH=$PATH:/usr/local/node-v4.9.1-linux-armv7l/bin
export LD_LIBRARY_PATH=/usr/local/node-v4.9.1-linux-armv7l/lib:$LD_LIBRARY_PATH
添加到/etc/profile文件或者~/.bashrc文件
vi /etc/profie
export PATH=$PATH:/usr/local/node-v4.9.1-linux-armv7l/bin
export LD_LIBRARY_PATH=/usr/local/node-v4.9.1-linux-armv7l/lib:$LD_LIBRARY_PATH
source /etc/profile
vi ~/.bashrc
export PATH=$PATH:/usr/local/node-v4.9.1-linux-armv7l/bin
source ~/.bashrc
或者直接echo "export PATH=$PATH:/usr/local/node-v4.9.1-linux-armv7l/bin " >> ~/.bashrc
二、交叉编译,库文件,头文件
1、redis服务端
1)redis编译
wget http://download.redis.io/releases/redis-4.0.11.tar.gz
tar xvf redis-4.0.11.tar.gz
cd redis-4.0.11
#make MALLOC=libc
make MALLOC=Jemalloc
make install PREFIX=/usr/local/redis
sudo mkdir -p /usr/local/redis/etc
sudo cp redis.conf /usr/local/redis/etc
vi /etc/profile
export PATH=$PATH:/usr/local/redis/bin
source /etc/profile
/usr/local/redis/redis-server /usr/local/redis/etc/redis.conf
2)redis交叉编译
tar xvf redis-4.0.11.tar.gz
cd redis-4.0.11
export CC=arm-linux-gnueabihf-gcc
export CXX=arm-linux-gnueabihf-g++
export LD=arm-linux-gnueabihf-ld
export RAINLIB=arm-linux-gnueabihf-rainlib
export AR=arm-linux-gnueabihf-ar
export LINK=arm-linux-gnueabihf-g++
#make MALLOC=libc
make MALLOC=Jemalloc
make install PREFIX=_install
mkdir _install/etc
sudo cp redis.conf _install/etc
vi /etc/profile
export PATH=$PATH:/usr/local/xxx/bin
source /etc/profile
./redis-server /usr/local/xxx/redis/etc/redis.conf
2、redis c语言客户端
1)hiredis编译
make
make install PREFIX=_install
gcc -o example example.c -I ./_install/include/hiredis -L ./_install/lib -lhiredis
export LD_LIBRARY_PATH=/usr/local/hiredis/lib:$LD_LIBRARY_PATH
./example
2)hiredis交叉编译
export CC=arm-linux-gnueabihf-gcc
export CXX=arm-linux-gnueabihf-g++
export LD=arm-linux-gnueabihf-ld
export RAINLIB=arm-linux-gnueabihf-rainlib
export AR=arm-linux-gnueabihf-ar
export LINK=arm-linux-gnueabihf-g++
make
make install PREFIX=_install
arm-linux-gnueabihf-gcc -o example example.c -I ./_install/include/hiredis -L ./_install/lib -lhiredis
export LD_LIBRARY_PATH=/usr/local/hiredis/lib:$LD_LIBRARY_PATH
./example
-------------------------------------------------------------------------------------------------------------------------------
3、pjsip移植
1)alsa交叉编译
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf
tar xjvf alsa-lib-1.1.7.tar.bz2
cd alsa-lib-1.1.7/
./configure --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc --prefix=/home/dong/alsa-lib-1.1.7/_install
make
make install
2)pjsip交叉编译
./configure --prefix=/home/dong/pjproject-2.8/_install --host=arm-linux-gnueabihf CC=/usr/local/gcc-linaro-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc --disable-libwebrtc CFLAGS=-I/home/dong/alsa-lib-1.1.7/_install/include LDFLAGS=-L/home/dong/alsa-lib-1.1.7/_install/lib
make dep
make
make install
pkg-config
https://blog.csdn.net/newchenxf/article/details/51750239
autogen.sh
#!/bin/sh # Run this to generate all the initial makefiles, etc. set -e srcdir=`dirname $0` test -z "$srcdir" && srcdir=. DIE=0 (test -f $srcdir/configure.ac) || { echo -n "**Error**: Directory $srcdir does not look like the" echo " top-level package directory" exit 1 } (autoconf --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have autoconf installed." echo "Download the appropriate package for your distribution," echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" DIE=1 } (grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { (libtool --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have libtool installed." echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" DIE=1 } } (automake --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: You must have automake installed." echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" DIE=1 NO_AUTOMAKE=yes } # if no automake, don't bother testing for aclocal test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { echo echo "**Error**: Missing aclocal. The version of automake" echo "installed doesn't appear recent enough." echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/" DIE=1 } if test "$DIE" -eq 1; then exit 1 fi if test -z "$*"; then echo "**Warning**: I am going to run configure with no arguments." echo "If you wish to pass any to it, please specify them on the" echo $0 " command line." echo fi case $CC in xlc ) am_opt=--include-deps;; esac aclocalinclude="$ACLOCAL_FLAGS" echo "Running libtoolize..." libtoolize --force --copy echo "Running gtkdocize..." gtkdocize echo "Running aclocal $aclocalinclude ..." aclocal $aclocalinclude echo "Running autoheader..." autoheader echo "Running automake --foreign -Wno-portability $am_opt ..." automake --add-missing --foreign -Wno-portability $am_opt echo "Running autoconf ..." autoconf conf_flags="--enable-maintainer-mode" if test x$NOCONFIGURE = x; then echo "Running $srcdir/configure $conf_flags $@ ..." $srcdir/configure $conf_flags "$@" \ && echo "Now type make to compile." || exit 1 else echo "Skipping configure process." fi
# 2020年 06月 05日 星期五 15:58:19 CST
# HuaWei LiteOS Linux, Cross-Toolchain PATH
export PATH="/opt/hisi-linux/x86-arm/arm-himix100-linux/bin:$PATH"
#