DavidGriffith / minipro-import-test

An open source program for controlling the MiniPRO TL866xx series of chip programmers
GNU General Public License v3.0
3 stars 0 forks source link

Unable to compile under Cygwin #234

Open DavidGriffith opened 3 years ago

DavidGriffith commented 3 years ago

In GitLab by @rick83 on Jul 13, 2021, 10:16

Hello,

I'm trying to install minipro under Cygwin on Windows 10. I have seen people say they can do it with mingw64, but I have not had any success. Here are the steps I have followed:

-Run Cygwin install -Select Install from Internet -Mirror=https://mirrors.rit.edu -Search for wget --Set All -> Web -> wget 1.21.1-1 to install -Search for libusb --Select highest version for all returned libraries under All -> Lib --(I lready have libsub Windows executable installed) -Search for gcc --Select highest non-test version for all returned libraries under All -> Devel to Install -Click next -Finish install -Open Cygwin terminal -Realize I forgot git -Run install -Search for git --Select highest version of all returned libraries under All -> Devel -Realize I forgot make -Run install -Search for make --Select highest version of all returned libraries under All -> Devel that were not already installed -Get errors related to "conflicting types for ‘usb_open’" and "conflicting types for ‘usb_close’" (see below for exact errors) -Search for libusb --Select highest version for all libraries returned under All->Devel that were not already installed

I'm not sure what I'm getting wrong. Any help would be appreciated.

Thank you

PS: I'm aware that this minipro is for Linux and Mac, but as others have successfully done this, I thought it must be possible. I reached out to David before posting asking where the best place to ask for help was, and he pointed me here. Although I didn't tell him it was Cygwin related. I apologize if this is out of turn.

In file included from /usr/include/w32api/winusb.h:57, from usb_win.c:23: /usr/include/w32api/winusbio.h:60:3: error: unknown type name ‘USBD_PIPE_TYPE’ 60 | USBD_PIPE_TYPE PipeType; | ^~~~~~ /usr/include/w32api/winusbio.h:67:3: error: unknown type name ‘USBD_PIPE_TYPE’ 67 | USBD_PIPE_TYPE PipeType; | ^~~~~~ In file included from usb_win.c:23: /usr/include/w32api/winusb.h:88:152: error: unknown type name ‘PUSBD_ISO_PACKET_DESCRIPTOR’; did you mean ‘PUSB_INTERFACE_DESCRIPTOR’? 88 | WINBOOL WINAPI WinUsb_ReadIsochPipe (WINUSB_ISOCH_BUFFER_HANDLE BufferHandle, ULONG Offset, ULONG Length, PULONG FrameNumber, ULONG NumberOfPackets, PUSBD_ISO_PACKET_DESCRIPTOR IsoPacketDescriptors, LPOVERLAPPED Overlapped); | ^~~~~~~ | PUSB_INTERFACE_DESCRIPTOR /usr/include/w32api/winusb.h:89:157: error: unknown type name ‘PUSBD_ISO_PACKET_DESCRIPTOR’; did you mean ‘PUSB_INTERFACE_DESCRIPTOR’? 89 | WINBOOL WINAPI WinUsb_ReadIsochPipeAsap (WINUSB_ISOCH_BUFFER_HANDLE BufferHandle, ULONG Offset, ULONG Length, BOOL ContinueStream, ULONG NumberOfPackets, PUSBD_ISO_PACKET_DESCRIPTOR IsoPacketDescriptors, LPOVERLAPPED Overlapped); | ^~~~~~~ | PUSB_INTERFACE_DESCRIPTOR In file included from usb_win.c:24: usb.h:23:7: error: conflicting types for ‘usb_open’ 23 | void usb_open(uint8_t verbose); | ^~~~ In file included from /usr/include/w32api/winusbio.h:53, from /usr/include/w32api/winusb.h:57, from usb_win.c:23: /usr/include/usb.h:328:21: note: previous declaration of ‘usb_open’ was here 328 | usb_dev_handle usb_open(struct usb_device dev); | ^~~~ In file included from usb_win.c:24: usb.h:24:5: error: conflicting types for ‘usb_close’ 24 | int usb_close(void usb_handle); | ^~~~~ In file included from /usr/include/w32api/winusbio.h:53, from /usr/include/w32api/winusb.h:57, from usb_win.c:23: /usr/include/usb.h:329:9: note: previous declaration of ‘usb_close’ was here 329 | int usb_close(usb_dev_handle dev); | ^~~~~ usb_win.c:61:7: error: conflicting types for ‘usb_open’ 61 | void usb_open(uint8_t verbose) { | ^~~~ In file included from /usr/include/w32api/winusbio.h:53, from /usr/include/w32api/winusb.h:57, from usb_win.c:23: /usr/include/usb.h:328:21: note: previous declaration of ‘usb_open’ was here 328 | usb_dev_handle usb_open(struct usb_device dev); | ^~~~ usb_win.c:125:5: error: conflicting types for ‘usb_close’ 125 | int usb_close(void handle) { | ^~~~~ In file included from /usr/include/w32api/winusbio.h:53, from /usr/include/w32api/winusb.h:57, from usb_win.c:23: /usr/include/usb.h:329:9: note: previous declaration of ‘usb_close’ was here 329 | int usb_close(usb_dev_handle dev); | ^~~~~ make: *** [: usb_win.o] Error 1

DavidGriffith commented 3 years ago

In GitLab by @radiomanV on Jul 13, 2021, 11:32

As i'm the one who added the Windows support i can tell you that this project can be compiled under Windows without any changes or workarounds, but, you need to install the right tools (not Cygwin).
So pay attention here.

First go to https://www.msys2.org/ and download the MSYS2 installer and follow the instructions from that page. After the installer finish please go to your start menu and choose MSYS2 MinGW 64-bit like this:
msys
Then from the msys console do pacman -Syu. The msys will update and exit itself. Run the MSYS2 MinGW 64-bit again and this time issue pacman -Su. This way you just installed and upgraded the MSYS2 core.

Now install the Mingw compiler package with: pacman -S --needed base-devel mingw-w64-x86_64-toolchain and confirm with enter to install the default packages when asked. Now wait for all packages to be installed.
Now install the git package with: pacman -S --needed git

If all was ok, we can proceed to our task. Make a work directory with; mkdir /c/minipro && cd /c/minipro/ (or where you want).
Clone the minipro repo with git clone https://gitlab.com/DavidGriffith/minipro.git . and finally compile with make.

Connect your TL866 and give it a try with : ./minipro -V.
This way the minipro will use the native usb communication (manufacturer driver must be installed) and only windows native libraries are used as dependencies :
depends

Cheers!

DavidGriffith commented 3 years ago

In GitLab by @rick83 on Jul 13, 2021, 13:30

Thank you for the great explanation! I only ran into one issue with these instructions. When I ran make, it told me GCC wasn't installed. I ran packman -S --needed gcc, and that allowed me to install gcc and compile minipro. Otherwise this worked perfectly!

DavidGriffith commented 3 years ago

In GitLab by @radiomanV on Jul 13, 2021, 13:52

There must have been something wrong; the pacman -S --needed base-devel mingw-w64-x86_64-toolchain should have install all needed packages but well.. I wrote what i did but i'm glad that finally you figured out.

DavidGriffith commented 3 years ago

In GitLab by @rick83 on Jul 13, 2021, 15:33

You wrote enough for me to be able to figure out the gcc issue myself. This is one of the clearest and most helpful reply to a post on the Internet I've ever had. Again, thank you!

DavidGriffith commented 3 years ago

In GitLab by @radiomanV on Jul 13, 2021, 16:23

Ok, you are welcome. But just for my curiosity can you please paste the output of ldd ./minipro.exe ? i want to see against what libraries was the .exe linked.

DavidGriffith commented 3 years ago

In GitLab by @rick83 on Jul 19, 2021, 18:01

I'm sorry it took so long to get back to you on this. Here's the output.

$ ldd ./minipro.exe
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ffce3410000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ffce2100000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ffce11b0000)
        SETUPAPI.dll => /c/WINDOWS/System32/SETUPAPI.dll (0x7ffce19e0000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ffce1940000)
        msys-2.0.dll => /usr/bin/msys-2.0.dll (0x180040000)
        cfgmgr32.dll => /c/WINDOWS/System32/cfgmgr32.dll (0x7ffce0ed0000)
        ucrtbase.dll => /c/WINDOWS/System32/ucrtbase.dll (0x7ffce0f50000)
        RPCRT4.dll => /c/WINDOWS/System32/RPCRT4.dll (0x7ffce2ce0000)
        bcrypt.dll => /c/WINDOWS/System32/bcrypt.dll (0x7ffce0f20000)
        WINUSB.DLL => /c/WINDOWS/SYSTEM32/WINUSB.DLL (0x7ffcd09a0000)