Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MinGW build instructions and Makefile #459

Open
maxgerhardt opened this issue Jul 21, 2021 · 0 comments
Open

Update MinGW build instructions and Makefile #459

maxgerhardt opened this issue Jul 21, 2021 · 0 comments

Comments

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Jul 21, 2021

I could not get this project to compile as-is under a Windows + MSys2 MinGW environment due to multiple errors:

  • the WIN macro responsible for detection of MSys is commented out in the Makefile.common. Therefore it doesn't even try and set the Windows / MinGW specific options.

    simavr/Makefile.common

    Lines 87 to 90 in a56b550

    # FIXME uname -o doesn't work on bsd derivatives
    #WIN := ${shell uname -o}
    ifeq (${WIN}, Msys)
  • a list of dependencies within the MSYS2 system should be given. For 64-bit builds, that is
    • pacman -S mingw-w64-x86_64-toolchain
    • pacman -S mingw-w64-x86_64-libelf
    • pacman -S mingw-w64-x86_64-avr-toolchain
    • pacman -S mingw-w64-x86_64-freeglut
  • GCC, which is of the very recent version 10.3.0 from 2020 (mingw-w64-x86_64-gcc 10.3.0-2), fails to find strsep as reported in undefined reference to strsep #403. The issue was closed without giving a resolution other than "old libc, not worth my time", making compilation on Windows impossible. PR Check if environment is MinGW and implement missing strsep() #404 is partly correct here, in my case I also needed to ammend the header file to expose the function.
  • The function avr_usb_ep_read() fails to compile under the above GCC option because it thinks v might be uninitialized upon return, and that warning is turned into an error by -Werror.
  • Using WinAVR like the README.mingw says and the makefile references isn't really needed if MSys2 provides the package mingw-w64-x86_64-avr-toolchain (AVR-GCC 8.4.0). All it matters that there's avr-gcc and avr-libc. A slight adaption in the Makefile to fix the AVR include path to /mingw64/avr and AVR compiler path / prefix fixes this.
  • While building simavr via make build-simavr can be done, a normal make fails while compiling an example requiring the Unix header pty.h. Non-compatible examples should be excluded from the build. Or, https://github.com/rprichard/winpty can be substituted.
CC uart_pty.c
uart_pty.c:38:10: fatal error: pty.h: No such file or directory
   38 | #include <pty.h>
      |          ^~~~~~~
compilation terminated.
make[1]: *** [../..//Makefile.common:189: obj-x86_64-w64-mingw32/uart_pty.o] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant