RISC-V技术论坛
直播中

李霞

7年用户 1253经验值
私信 关注
[问答]

使用msys2 mingw64编译nuclei openocd源码出错的原因?

git clone https://github.com/riscv-mcu/riscv-openocd.git 源码,msys2安装了相关依赖包,下载了FTDI的驱动包CDM-v2.12.36.4-WHQL-Certified,拷贝目录下Static/amd64/ftd2xx.lib库文件到mingw64/lib目录下,执行以下命令
./bootstrap
./configure --disable-werror --enable-ftd2xx
make
提示错误如下:只列了部分,都是mpsse.c函数里调用ftd2xx驱动函数接口的问题
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(libocdjtagdrivers_la-mpsse.o): in function `open_matching_device':C:msys64homeAdministratorbuildnuclei-riscv-openocdbuild/../src/jtag/drivers/mpsse.c:358:(.text+0xc71): undefined reference to `__imp_FT_CreateDeviceInfoList'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:msys64homeAdministratorbuildnuclei-riscv-openocd/build/../src/jtag/drivers/mpsse.c:488:(.text+0xd7d): undefined reference to `__imp_FT_SetBitMode'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:msys64homeAdministratorbuildnuclei-riscv-openocd/build/../src/jtag/drivers/mpsse.c:489:(.text+0xd87): undefined reference to `__imp_FT_Close'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:msys64homeAdministratorbuildnuclei-riscv-openocd/build/../src/jtag/drivers/mpsse.c:380:(.text+0x10b8): undefined referenc to `__imp_FT_CreateDeviceInfoList'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:msys64homeAdministratorbuildnuclei-riscv-openocd/build/../src/jtag/drivers/mpsse.c:449:(.text+0x1215): undefined reference to `__imp_FT_Open'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:msys64homeAdministratorbuildnuclei-riscv-openocd/build/../src/jtag/drivers/mpsse.c:457:(.text+0x1227): undefined reference to `__imp_FT_ResetDevice'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:msys64homeAdministratorbuildnuclei-riscv-openocd/build/../src/jtag/drivers/mpsse.c:460:(.text+0x123a): undefined reference to `__imp_FT_SetUSBParameters'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:msys64homeAdministratorbuildnuclei-riscv-openocd/build/../src/jtag/drivers/mpsse.c:461:(.text+0x1256): undefined reference to `__imp_FT_SetChars'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:msys64homeAdministratorbuildnuclei-riscv-openocd/build/../src/jtag/drivers/mpsse.c:467:(.text+0x1269): undefined reference to `__imp_FT_SetTimeouts'
请问怎么解决这个错误呢?
   

回帖(1)

尚文清

2024-5-29 16:49:21
根据您提供的信息,您在使用 MSYS2 MinGW64 编译 riscv-openocd 源码时遇到了错误。这些错误主要与 mpsse.c 文件中调用 ftd2xx 驱动函数接口有关。为了解决这个问题,请按照以下步骤操作:

1. 确保您的 MSYS2 和 MinGW-w64 环境已正确安装并更新。运行以下命令以更新 MSYS2 包管理器和安装的软件包:

```
pacman -Syu
```

2. 安装所需的依赖包。根据您的项目需求,您可能需要安装以下软件包:

```
pacman -S mingw-w64-x86_64-toolchain
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-make
pacman -S mingw-w64-x86_64-autoconf
pacman -S mingw-w64-x86_64-automake
pacman -S mingw-w64-x86_64-libtool
```

3. 确保您已正确克隆了 riscv-openocd 源码:

```
git clone https://github.com/riscv-mcu/riscv-openocd.git
```

4. 切换到源码目录并执行 bootstrap 脚本:

```
cd riscv-openocd
./bootstrap
```

5. 配置项目以启用 ftd2xx 支持并禁用 werror:

```
./configure --disable-werror --enable-ftd2xx
```

6. 确保您已将 ftd2xx.lib 文件正确复制到 mingw64/lib 目录下。

7. 执行 make 命令以编译项目:

```
make
```

如果在执行这些步骤后仍然遇到错误,请仔细检查错误信息,以确定问题所在。可能的原因包括:

- 缺少或错误的依赖包
- 错误的环境变量设置
- 源码或配置文件中的错误

根据错误信息,您可以进一步调查并解决问题。如果问题仍然存在,请提供更详细的错误信息,以便我们能够更好地帮助您。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分