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

Fix build on msys2/mingw64 #5093

Merged
merged 1 commit into from
May 13, 2024
Merged

Fix build on msys2/mingw64 #5093

merged 1 commit into from
May 13, 2024

Conversation

tqfx
Copy link
Contributor

@tqfx tqfx commented May 12, 2024

MINGW64 # pacman -Ss xmake
mingw32/mingw-w64-i686-xmake 2.9.1-1
    A cross-platform build utility based on Lua (mingw-w64)
mingw64/mingw-w64-x86_64-xmake 2.9.1-1 [installed]
    A cross-platform build utility based on Lua (mingw-w64)
ucrt64/mingw-w64-ucrt-x86_64-xmake 2.9.1-1
    A cross-platform build utility based on Lua (mingw-w64)
clang32/mingw-w64-clang-i686-xmake 2.9.1-1
    A cross-platform build utility based on Lua (mingw-w64)
clang64/mingw-w64-clang-x86_64-xmake 2.9.1-1
    A cross-platform build utility based on Lua (mingw-w64)
MINGW64 # which xmake
/mingw64/bin/xmake
MINGW64 # xmake f --menu
error: ncurses not found, please install it first

@tqfx tqfx marked this pull request as ready for review May 12, 2024 15:08
@waruqi
Copy link
Member

waruqi commented May 13, 2024

I tried this patch, but it still does not work.

wangrunqing@IIGS-A8825-D MINGW64 /d/test
$ xmake f --menu
Error opening terminal: xterm.

@tqfx
Copy link
Contributor Author

tqfx commented May 13, 2024

It works on my device and I'm using the latest version of msys2/mingw64. You can try msys2/MINGW-packages#4035.

@waruqi
Copy link
Member

waruqi commented May 13, 2024

It works on my device and I'm using the latest version of msys2/mingw64. You can try msys2/MINGW-packages#4035.

I tried it and updated msys2. and it did not show any thing.

@tqfx
Copy link
Contributor Author

tqfx commented May 13, 2024

Will this minimal test case work?

// ncurses-1.c
#include <stdio.h>
#include <curses.h>

int main() {
  initscr();                 /* Start curses mode     */
  printw("Hello World !!!"); /* Print Hello World    */
  refresh();                 /* Print it on to the real screen */
  getch();                   /* Wait for user input */
  endwin();                  /* End curses mode    */
  return 0;
}
gcc ncurses-1.c `pkg-config ncursesw --cflags --libs`
./a.exe
ldd a.exe
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ffda0a10000)
        KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ffd9fd60000)
        KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ffd9e250000)
        msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ffda0900000)
        libncursesw6.dll => /mingw64/bin/libncursesw6.dll (0x7ffd6fef0000)
        USER32.dll => /c/Windows/System32/USER32.dll (0x7ffda0550000)
        win32u.dll => /c/Windows/System32/win32u.dll (0x7ffd9e650000)
        GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ffda0760000)
        gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ffd9e130000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x7ffd967c0000)
        msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ffd9e6b0000)
        libintl-8.dll => /mingw64/bin/libintl-8.dll (0x7ffd6feb0000)
        ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ffd9e550000)
        ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ffd9f0d0000)
        sechost.dll => /c/Windows/System32/sechost.dll (0x7ffd9fee0000)
        RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ffd9ea40000)
        bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ffd9e680000)
        libiconv-2.dll => /mingw64/bin/libiconv-2.dll (0x7ffd62a60000)

@waruqi
Copy link
Member

waruqi commented May 13, 2024

Will this minimal test case work?

// ncurses-1.c
#include <stdio.h>
#include <curses.h>

int main() {
  initscr();                 /* Start curses mode     */
  printw("Hello World !!!"); /* Print Hello World    */
  refresh();                 /* Print it on to the real screen */
  getch();                   /* Wait for user input */
  endwin();                  /* End curses mode    */
  return 0;
}
gcc ncurses-1.c `pkg-config ncursesw --cflags --libs`
./a.exe
ldd a.exe
        ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ffda0a10000)
        KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ffd9fd60000)
        KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ffd9e250000)
        msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ffda0900000)
        libncursesw6.dll => /mingw64/bin/libncursesw6.dll (0x7ffd6fef0000)
        USER32.dll => /c/Windows/System32/USER32.dll (0x7ffda0550000)
        win32u.dll => /c/Windows/System32/win32u.dll (0x7ffd9e650000)
        GDI32.dll => /c/Windows/System32/GDI32.dll (0x7ffda0760000)
        gdi32full.dll => /c/Windows/System32/gdi32full.dll (0x7ffd9e130000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x7ffd967c0000)
        msvcp_win.dll => /c/Windows/System32/msvcp_win.dll (0x7ffd9e6b0000)
        libintl-8.dll => /mingw64/bin/libintl-8.dll (0x7ffd6feb0000)
        ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ffd9e550000)
        ADVAPI32.dll => /c/Windows/System32/ADVAPI32.dll (0x7ffd9f0d0000)
        sechost.dll => /c/Windows/System32/sechost.dll (0x7ffd9fee0000)
        RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ffd9ea40000)
        bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ffd9e680000)
        libiconv-2.dll => /mingw64/bin/libiconv-2.dll (0x7ffd62a60000)

it works, but I run xmake f --menu. It does not work.

@waruqi
Copy link
Member

waruqi commented May 13, 2024

image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


image

@tqfx
Copy link
Contributor Author

tqfx commented May 13, 2024

I tried reinstalling msys2 and it works on my device.

  1. Download and unzip https://github.com/msys2/msys2-installer/releases/download/2024-05-07/msys2-base-x86_64-20240507.tar.xz
  2. Click mingw64.exe in the directory msys64 and execute the following command:
pacman -Syy
pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-ncurses mingw-w64-x86_64-readline
cd path/to/xmake
./configure --prefix=/mingw64
make
make install
xmake f -P core --menu

image

@waruqi
Copy link
Member

waruqi commented May 13, 2024

It works, thanks!

@waruqi waruqi merged commit 619079e into xmake-io:dev May 13, 2024
19 checks passed
@waruqi waruqi added this to the v2.9.2 milestone May 13, 2024
@tqfx tqfx deleted the patch-1 branch May 13, 2024 06:59
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

Successfully merging this pull request may close these issues.

3 participants