当前位置: 首页 > 工具软件 > libftdi > 使用案例 >

交叉编译 FT4232 eeprom 开源工具 libftdi 记录

郑乐池
2023-12-01

libftdi下载地址
Libftdi 依赖 libusb libconfuse gettext-0.19
首先安装依赖文件
sudo apt-get install libboost-all-dev

一、 交叉编译 libusb

1. git clone https://github.com/libusb/libusb.

2. autogen.sh

报错 configure: error: udev support requested but libudev header not installed 报错 error: Libtool library used but ‘LIBTOOL’ is undefined libusb/Makefile.am:5: The usual way to define ‘LIBTOOL’ is to add ‘LT_INIT’ libusb/Makefile.am:5: to ‘configure.ac’ and run ‘aclocal’ and ‘autoconf’ again. libusb/Makefile.am:5: If ‘LT_INIT’ is in ‘configure.ac’, make sure libusb/Makefile.am:5: its definition is in acloc

3. 安装 sudo apt-get install libtool

4. 再次执行 autogen.sh

rm: invalid option – ‘l’
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm ./-libtoolT’ to remove the file ‘-libtoolT’.
Try ‘rm –help’ for more information.config.status: WARNING: Unable to substitute extended shell functions in -libtool
mv: invalid option – ‘l’
Try ‘mv –help’ for more information.
rm: invalid option – ‘l’
Try ‘rm –help’ for more information.
chmod: invalid option – ‘l’
Try ‘chmod –help’ for more information.

5. 加上 sudo 再次执行 sudo autogen.sh

6. sudo chown picohood:picohood libusb/ -R

7. 安装 sudo apt-get install libudev-dev

8. 在配置的时候加上–disable-udev,如下

./configure –build=i686-linux –host=arm-linux-gnueabihf –target=arm-linux-gnueabihf
–prefix=/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++ –disable-udev

9. Make

10. make install

–build=i686-linux 表示该软件在 x86 平台被编译
–host=arm-linux 表示该软件编译完成后在 arm 平台上运行
–prefix 后面为软件安装目录。
CC=,CXX 等于指定了交叉编译使用的 C, C++交叉编译器

二、 交叉编译 libconfuse

1. Git clone https://github.com/martinh/libconfuse.git

2. autogen.sh

3. 在配置的时候加上–disable-udev,如下

./configure –build=i686-linux –host=arm-linux-gnueabihf –target=arm-linux-gnueabihf
–prefix=/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++ –disable-udev
报错/home/picohood/gitrepo/tisdk/tools/libconfuse/support/missing: line 81: flex: command not foundWARNING: ‘flex’ is missing on your system.
You should only need it if you modified a ‘.l’ file.
You may want to install the Fast Lexical Analyzer package:
http://flex.sourceforge.net/

4. sudo apt-get install flex.

5. 再次 configure 成功

6. Make

7. Make install

–build=i686-linux 表示该软件在 x86 平台被编译
–host=arm-linux 表示该软件编译完成后在 arm 平台上运行
–prefix 后面为软件安装目录。
CC=,CXX 等于指定了交叉编译使用的 C, C++交叉编译器

三、 交叉编译 gettext-0.19

1. 下载地址 http://ftp.gnu.org/pub/gnu/gettext/

(1) sudo tar zxvf gettext-0.19.tar.gz

(2) sudo chown picohood:picohood gettext-0.19 -R

2. 在配置的时候加上–disable-udev,如下

./configure –build=i686-linux –host=arm-linux-gnueabihf –target=arm-linux-gnueabihf
–prefix=/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++ –disable-udev

3. Make

4. Make install

–build=i686-linux 表示该软件在 x86 平台被编译
–host=arm-linux 表示该软件编译完成后在 arm 平台上运行
–prefix 后面为软件安装目录。
CC=,CXX 等于指定了交叉编译使用的 C, C++交叉编译器

四、 交叉编译 libftdi

1. 安装 cmake 工具

Sudo apt-get install cmake

2. 进入 libftdi/cmake

3. cp Toolchain-mingw32.cmake Toolchain-am3358.cmake

4. 编辑里面为如下代码


下面的配置经过解决编译各种问题的最终配置, 为了节省时间可以直接写入该
配置

the name of the target operating system

SET(CMAKE_SYSTEM_NAME Linux)

which compilers to use for C and C++

SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
SET(LIBUSB_LIBRARIES
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/lib/libusb-1.0.so.0
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/usr/lib/librt.so)
SET(LIBUSB_INCLUDE_DIR
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/include/libusb-1.0)
SET(CMAKE_C_FLAGS -g -O2 -fPIC)
SET(CMAKE_CXX_FLAGS -g -O2 -fPIC)
SET(CMAKE_INSTALL_PREFIX
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi)
SET(CONFUSE_LIBRARY
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/lib/libconfuse.so.2)
SET(CONFUSE_INCLUDE_DIR/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/include/)
SET(LIBINTL_INCLUDE_DIR
/home/picohood/projects/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/lib)

adjust the default behaviour of the FIND_XXX() commands:

search headers and libraries in the target environment, search

programs in the host environment

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

5. 进入 libftdi 目录

6. 创建 bulid 目录 mkdir build

7. 进入 build 目录 并执行编译命令如下

cmake -DCMAKE_TOOLCHAIN_FILE=/home/picohood/gitrepo/tisdk/tools/libftdi/cmake/Toolchain-am3358.cmake ../

8. make

9. 成功, 拷贝动态库和执行文件到开发板即可

 类似资料: