hexalinq / libxpc

Xilinx Platform Cable USB II (DLC9LP) driver
MIT License
4 stars 2 forks source link

Compiling error on Ubuntu 20.04 #3

Open doonny opened 11 months ago

doonny commented 11 months ago

Hi, I am trying to build this tool on Ubuntu 20.04, I have install libftdi1-dev libusb-1.0-0-dev, and when compiling, the following error shows up:

gcc -oxpc obj/main.o libxpc.a -lusb-1.0 -lftdi1 -fsanitize=address obj/main.o: In function _Init': /home/fpga/Downloads/libxpc/main.c:15: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/main.c:15: undefined reference to strerrorname_np' obj/main.o: In functionmain': /home/fpga/Downloads/libxpc/main.c:22: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/main.c:22: undefined reference tostrerrorname_np' /home/fpga/Downloads/libxpc/main.c:48: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/main.c:48: undefined reference tostrerrorname_np' /home/fpga/Downloads/libxpc/main.c:52: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/main.c:52: undefined reference tostrerrorname_np' /home/fpga/Downloads/libxpc/main.c:87: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/main.c:87: undefined reference tostrerrorname_np' libxpc.a(driver.o): In function XPC_Disable': /home/fpga/Downloads/libxpc/driver.c:17: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:17: undefined reference to strerrorname_np' libxpc.a(driver.o): In functionXPC_Enable': /home/fpga/Downloads/libxpc/driver.c:21: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:21: undefined reference tostrerrorname_np' libxpc.a(driver.o): In function XPC_SetClock': /home/fpga/Downloads/libxpc/driver.c:27: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:27: undefined reference to strerrorname_np' libxpc.a(driver.o): In functionXPC_ReadCPLDVersion': /home/fpga/Downloads/libxpc/driver.c:37: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:37: undefined reference tostrerrorname_np' libxpc.a(driver.o): In function XPC_ReadFirmwareVersion': /home/fpga/Downloads/libxpc/driver.c:41: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:41: undefined reference to strerrorname_np' libxpc.a(driver.o): In functionXPC_JTAGTransfer': /home/fpga/Downloads/libxpc/driver.c:45: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:45: undefined reference tostrerrorname_np' /home/fpga/Downloads/libxpc/driver.c:52: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:52: undefined reference tostrerrorname_np' /home/fpga/Downloads/libxpc/driver.c:60: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:60: undefined reference tostrerrorname_np' libxpc.a(driver.o): In function XPC_Connect': /home/fpga/Downloads/libxpc/driver.c:91: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:91: undefined reference to strerrorname_np' libxpc.a(driver.o): In functionXPC_Initialize': /home/fpga/Downloads/libxpc/driver.c:102: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:102: undefined reference tostrerrorname_np' /home/fpga/Downloads/libxpc/driver.c:106: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:106: undefined reference tostrerrorname_np' libxpc.a(driver.o): In function XPC_InitializeFTDI': /home/fpga/Downloads/libxpc/driver.c:123: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:123: undefined reference to strerrorname_np' libxpc.a(driver.o): In functionJTAG_Flush': /home/fpga/Downloads/libxpc/driver.c:192: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:192: undefined reference tostrerrorname_np' /home/fpga/Downloads/libxpc/driver.c:195: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:195: undefined reference tostrerrorname_np' libxpc.a(driver.o): In function JTAG_Enqueue': /home/fpga/Downloads/libxpc/driver.c:228: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:228: undefined reference to strerrorname_np' /home/fpga/Downloads/libxpc/driver.c:234: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:234: undefined reference to strerrorname_np' libxpc.a(driver.o): In functionJTAG_WriteInstructionRegisterBits': /home/fpga/Downloads/libxpc/driver.c:270: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:270: undefined reference tostrerrorname_np' libxpc.a(driver.o): In function JTAG_ReadWriteDataRegisterBitsFTDI': /home/fpga/Downloads/libxpc/driver.c:294: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:294: undefined reference to strerrorname_np' /home/fpga/Downloads/libxpc/driver.c:300: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:300: undefined reference to strerrorname_np' /home/fpga/Downloads/libxpc/driver.c:302: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:302: undefined reference to strerrorname_np' libxpc.a(driver.o): In functionJTAG_ReadWriteDataRegisterFTDI': /home/fpga/Downloads/libxpc/driver.c:309: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:309: undefined reference tostrerrorname_np' /home/fpga/Downloads/libxpc/driver.c:312: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:312: undefined reference tostrerrorname_np' /home/fpga/Downloads/libxpc/driver.c:324: undefined reference to strerrordesc_np' /home/fpga/Downloads/libxpc/driver.c:324: undefined reference tostrerrorname_np' libxpc.a(dlc9lp.o): In function XPC_CypressFX2WriteRAM': /home/fpga/Downloads/libxpc/dlc9lp.c:7: undefined reference tostrerrordesc_np' /home/fpga/Downloads/libxpc/dlc9lp.c:7: undefined reference to `strerrorname_np' collect2: error: ld returned 1 exit status Makefile:6: recipe for target 'xpc' failed make: *** [xpc] Error 1

Can you help ? Thx

fuger222 commented 11 months ago

Hi, can you try compiling the latest version?

doonny commented 11 months ago

@fuger222 Thx for the update , I could comiple the driver now. But when trying to initialize the driver, the following error shows up :

main.c:87:main | errno: 11 | Platform cable not found or already initialized pc@pc:~/Download/libxpc$ sudo ./xpc identify main.c:15:_Init | errno: 11 | Platform cable initialization failure

I have checked the usb cable was recognized by the OS:

[ 346.502040] usb 1-1.1: new high-speed USB device number 5 using xhci_hcd [ 346.613192] usb 1-1.1: New USB device found, idVendor=0403, idProduct=6010 [ 346.613196] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 346.613199] usb 1-1.1: Product: Digilent Adept USB Device [ 346.613201] usb 1-1.1: Manufacturer: Digilent [ 346.613204] usb 1-1.1: SerialNumber: 210203825967 [ 346.628546] usbcore: registered new interface driver ftdi_sio [ 346.628567] usbserial: USB Serial support registered for FTDI USB Serial Device [ 346.628620] ftdi_sio 1-1.1:1.0: FTDI USB Serial Device converter detected [ 346.628657] usb 1-1.1: Detected FT2232H [ 346.629648] usb 1-1.1: FTDI USB Serial Device converter now attached to ttyUSB0 [ 346.629672] ftdi_sio 1-1.1:1.1: FTDI USB Serial Device converter detected [ 346.629700] usb 1-1.1: Detected FT2232H [ 346.630406] usb 1-1.1: FTDI USB Serial Device converter now attached to ttyUSB1 pc@pc:~/Download/libxpc$ sudo ./xpc init

What might cause this problem ?

doonny commented 11 months ago

lsusb shows the following info:

pc@pc:~/Download/libxpc$ sudo lsusb Bus 002 Device 002: ID 045b:0210 Hitachi, Ltd Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 004: ID 1c4f:0027 SiGma Micro Bus 001 Device 003: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse Bus 001 Device 005: ID 0403:6010 Future Technology Devices International, Ltd FT2232C Dual USB-UART/FIFO IC Bus 001 Device 002: ID 045b:0209 Hitachi, Ltd Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

fuger222 commented 11 months ago

@doonny This is meant to be a warning, not an actual error message. Cables with an FTDI chip are completely "plug and play", they don't require any kind of initialization, so you can safely ignore the first one. But keep in mind that I originally made this driver for an older cable that had a Cypress FX2 chip inside. I tried to add FTDI support a while ago too, but everything other than the xpc identify is untested, and very likely doesn't work at all.

fuger222 commented 11 months ago

As for why xpc identify didn't work, it was looking for a USB device with ID 0403:6014. I've added 0403:6010 too.

doonny commented 11 months ago

Thx for the reply, other functions does not work either.