我一直在尝试为 arm 设备编译 powertop。我看到这里经常讨论 powertop,我正在使用 Ubuntu 进行交叉编译armv7l
。
配置经过检查并产生:
checking for uint32_t... yes
checking for uint64_t... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... no
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... no
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... no
checking for working strtod... no
checking for pow... yes
它到达 devlist.cpp 并由于不存在 malloc 而终止。
...
CXX cpu/powertop-intel_cpus.o
CXX powertop-devlist.o
devlist.cpp: In function ‘void collect_open_devices()’:
devlist.cpp:147: error: ‘rpl_malloc’ was not declared in this scope
devlist.cpp: In function ‘void register_devpower(const char*, double, device*)’:
devlist.cpp:249: error: ‘rpl_malloc’ was not declared in this scope
make[3]: *** [powertop-devlist.o] Error 1
make[3]: Leaving directory `/home/lucid/powertop-2.4/src'
make[2]: *** [all] Error 2
...
如果我让它跳过 devlist.cpp,那么我会遇到与上述类似的其他内存功能问题。
我想我的问题是,我该如何更改配置或使 malloc 正确使用?我需要构建另一个库吗?我的工具链应该有我需要的一切。
我像这样调用 configure 和 make:
./configure --prefix=/home/lucid/timesys/i_MX53start/toolchain --sysconfdir=/home/lucid/timesys/i_MX53start/toolchain/etc --disable-static --target=armv7l-timesys-linux --host=i686 --build=armv7l-timesys-linux && make
答案1
您可能需要设置一些环境变量才能从工具链运行。下面是我使用的示例,适用于安装在本地目录中的工具链,就像您的一样:
MY_ARM_BASE=${HOME}/dev/toolchain/arm-2008q3
C_INCLUDE_PATH=${MY_ARM_BASE}/lib/gcc/arm-none-linux-gnueabi/4.3.2/include:${MY_ARM_BASE}/lib/gcc/arm-none-linux-gnueabi/4.3.2/include-fixed
LIBRARY_PATH=${MY_ARM_BASE}/arm-none-linux-gnueabi/libc/lib:${MY_ARM_BASE}/arm-none-linux-gnueabi/libc/usr/lib
CPLUS_INCLUDE_PATH=${MY_ARM_BASE}/arm-none-linux-gnueabi/include/c++/4.3.2
#OBJC_INCLUDE_PATH
COMPILER_PATH=${MY_ARM_BASE}/bin
#LD_RUN_PATH
#GPROF_PATH
#######
CC=${COMPILER_PATH}/gcc
CXX=${COMPILER_PATH}/g++
RANLIB=${COMPILER_PATH}/ranlib
STRIP=${COMPILER_PATH}/strip
export C_INCLUDE_PATH LIBRARY_PATH CPLUS_INCLUDE_PATH COMPILER_PATH
export CC CXX RANLIB STRIP