OK335xS canutils deal with compile error
/************************************************************************************** * OK335xS canutils deal with compile error * 声明: * 本文主要是记录解决编译can测试工具(canutils)时遇到的一些编译错误。 * * 2015-9-4 晴 深圳 南山平山村 曾剑锋 *************************************************************************************/ \\\\\\\\\\\\\\\\\\\\\-*- 目录 -*-//////////////////// | 一、参考文章: | 二、编译后简略的3层文件结构(tree -L 3): | 三、libsocketcan make install 问题: | 四、canutils 找不到 libsocketcan 问题: | 五、canutils 安装权限不足: \\\\\\\\\\\\\\\\\\\\\\\\\\\////////////////////////// 一、参考文章: 1. 有谁编译过canutils-4.0.6的吗? http://bbs.csdn.net/topics/390465516 2. AM335X DCAN Driver Guide http://processors.wiki.ti.com/index.php/AM335X_DCAN_Driver_Guide#CAN_Utilities 3. AM335x DCAN driver compile issues https://e2e.ti.com/support/embedded/linux/f/354/t/270303 二、最后编译出来简略的3层文件结构(tree -L 3): . ├── canutils-4.0.6 │ ├── aclocal.m4 │ ├── AUTHORS │ ├── autogen.sh │ ├── ChangeLog │ ├── config │ ├── config.log │ ├── config.status │ ├── configure │ ├── configure.ac │ ├── COPYING │ ├── GNUmakefile │ ├── GNUmakefile.am │ ├── GNUmakefile.in │ ├── include │ ├── install │ │ ├── bin │ │ ├── lib │ │ ├── sbin │ │ └── share │ ├── libtool │ ├── man │ ├── remake.sh │ └── src ├── canutils-4.0.6.tar.bz2 ├── libsocketcan-0.0.8 │ ├── aclocal.m4 │ ├── autogen.sh │ ├── config │ ├── config.log │ ├── config.status │ ├── configure │ ├── configure.ac │ ├── GNUmakefile │ ├── GNUmakefile.am │ ├── GNUmakefile.in │ ├── include │ ├── install │ │ ├── include │ │ ├── lib │ │ └── share │ ├── INSTALL │ ├── libtool │ ├── README │ ├── remake.sh │ ├── src │ └── tests └── libsocketcan-0.0.8.tar.bz2 三、libsocketcan make install 问题: 1. 出错现象: Qt@zengjf:~/practice/c/canTest/libsocketcan-0.0.8$ make install Making install in include make[1]: Entering directory `/home/Qt/practice/c/canTest/libsocketcan-0.0.8/include' make[2]: Entering directory `/home/Qt/practice/c/canTest/libsocketcan-0.0.8/include' make[2]: Nothing to be done for `install-exec-am'. test -z "/home/Qt/practice/c/canTest/libsocketcan-0.0.8/include" || /bin/mkdir -p "/home/Qt/practice/c/canTest/libsocketcan-0.0.8/include" /usr/bin/install -c -m 644 libsocketcan.h can_netlink.h '/home/Qt/practice/c/canTest/libsocketcan-0.0.8/include/.' /usr/bin/install: `libsocketcan.h' and `/home/Qt/practice/c/canTest/libsocketcan-0.0.8/include/./libsocketcan.h' are the same file /usr/bin/install: `can_netlink.h' and `/home/Qt/practice/c/canTest/libsocketcan-0.0.8/include/./can_netlink.h' are the same file make[2]: *** [install-nobase_includeHEADERS] Error 1 make[2]: Leaving directory `/home/Qt/practice/c/canTest/libsocketcan-0.0.8/include' make[1]: *** [install-am] Error 2 make[1]: Leaving directory `/home/Qt/practice/c/canTest/libsocketcan-0.0.8/include' make: *** [install-recursive] Error 1 2. 解决方法: export GNUEABI=arm-linux-gnueabihf export CC=$GNUEABI-gcc export LD=$GNUEABI-ld export NM=$GNUEABI-nm export AR=$GNUEABI-ar export RANLIB=$GNUEABI-ranlib export CXX=$GNUEABI-c++filt export INSTALL_PATH=$PWD export PREFIX=$INSTALL_PATH/ export CROSS_COMPILE_PREFIX=$PREFIX export PATH=$TOOL_CHAIN_PATH/bin:$PATH #./configure --host=arm-linux --prefix=$PREFIX --enable-debug # 官网给出的安装目录出错导致的,给出合适的安装路径 ./configure --host=arm-arago-linux --prefix=$PREFIX/install --enable-debug 四、canutils 找不到 libsocketcan 问题: 1. 错误现象: checking for pkg-config... /home/Qt/ti-processor-sdk-linux-am335x-evm-01.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking for libsocketcan... no configure: error: *** libsocketcan version above 0.0.8 not found on your system 2. 解决方法: export GNUEABI=arm-linux-gnueabihf export CC=$GNUEABI-gcc export LD=$GNUEABI-ld export NM=$GNUEABI-nm export AR=$GNUEABI-ar export RANLIB=$GNUEABI-ranlib export CXX=$GNUEABI-c++ export PREFIX=$FILESYS_PATH/usr export CROSS_COMPILE_PREFIX=$PREFIX export PATH=$TOOL_CHAIN_PATH/bin:$PATH export LIBSOCKETCAN_INSTALL_DIR=$LIBSOCKETCAN_PATH/install export PKG_CONFIG_PATH=$LIBSOCKETCAN_PATH/config export LD_LIBRARY_PATH=${LIBDIR}:${LD_LIBRARY_PATH} export LD_RAN_PATH=${LIBDIR}:${LD_RAN_PATH}:/home/Qt/practice/c/canTest/libsocketcan-0.0.8/src/.libs export LDFLAGS="-Wl,--rpath -Wl,$LIBSOCKETCAN_INSTALL_DIR/lib" export INCLUDES="-I$LIBSOCKETCAN_INSTALL_DIR/include" #./configure --host=arm-arago-linux --prefix=$PREFIX --enable-debug # 加上libsocketcan库的位置 ./configure --host=arm-linux --prefix=$PREFIX/install --enable-debug libsocketcan_LIBS=-lsocketcan LDFLAGS="-L$PWD/../libsocketcan-0.0.8/install/lib" libsocketcan_CFLAGS=-I$PWD/../libsocketcan-0.0.8/install/include 五、canutils 安装权限不足: 1. 错误现象: Qt@zengjf:~/practice/c/canTest/canutils-4.0.6$ make install Making install in include make[1]: Entering directory `/home/Qt/practice/c/canTest/canutils-4.0.6/include' make[2]: Entering directory `/home/Qt/practice/c/canTest/canutils-4.0.6/include' make[2]: Nothing to be done for `install-exec-am'. make[2]: Nothing to be done for `install-data-am'. make[2]: Leaving directory `/home/Qt/practice/c/canTest/canutils-4.0.6/include' make[1]: Leaving directory `/home/Qt/practice/c/canTest/canutils-4.0.6/include' Making install in config make[1]: Entering directory `/home/Qt/practice/c/canTest/canutils-4.0.6/config' make[2]: Entering directory `/home/Qt/practice/c/canTest/canutils-4.0.6/config' make[2]: Nothing to be done for `install-exec-am'. test -z "/usr/install/lib/pkgconfig" || /bin/mkdir -p "/usr/install/lib/pkgconfig" /bin/mkdir: cannot create directory `/usr/install': Permission denied make[2]: *** [install-pkgconfigDATA] Error 1 make[2]: Leaving directory `/home/Qt/practice/c/canTest/canutils-4.0.6/config' make[1]: *** [install-am] Error 2 make[1]: Leaving directory `/home/Qt/practice/c/canTest/canutils-4.0.6/config' make: *** [install-recursive] Error 1 2. 解决方法: export GNUEABI=arm-linux-gnueabihf export CC=$GNUEABI-gcc export LD=$GNUEABI-ld export NM=$GNUEABI-nm export AR=$GNUEABI-ar export RANLIB=$GNUEABI-ranlib export CXX=$GNUEABI-c++ #export PREFIX=$FILESYS_PATH/usr # 换一个有权限的路径 export PREFIX=$PWD export CROSS_COMPILE_PREFIX=$PREFIX export PATH=$TOOL_CHAIN_PATH/bin:$PATH export LIBSOCKETCAN_INSTALL_DIR=$LIBSOCKETCAN_PATH/install export PKG_CONFIG_PATH=$LIBSOCKETCAN_PATH/config export LD_LIBRARY_PATH=${LIBDIR}:${LD_LIBRARY_PATH} export LD_RAN_PATH=${LIBDIR}:${LD_RAN_PATH}:/home/Qt/practice/c/canTest/libsocketcan-0.0.8/src/.libs export LDFLAGS="-Wl,--rpath -Wl,$LIBSOCKETCAN_INSTALL_DIR/lib" export INCLUDES="-I$LIBSOCKETCAN_INSTALL_DIR/include" #./configure --host=arm-arago-linux --prefix=$PREFIX --enable-debug ./configure --host=arm-linux --prefix=$PREFIX/install --enable-debug libsocketcan_LIBS=-lsocketcan LDFLAGS="-L$PWD/../libsocketcan-0.0.8/install/lib" libsocketcan_CFLAGS=-I$PWD/../libsocketcan-0.0.8/install/include