Compilling NCurses on MSYS2 MinGW-w64 gave a compilling error

HGStyle

New Member
Joined
Jun 9, 2022
Messages
16
Reaction score
2
Credits
154
Hi. I'm trying to compile the GNU software NCurses on MSYS2 MinGW-w64 (x86_64) but when compilling by running ./configure && make && make install it stops at the make command with the error:
Code:
gcc ../objects/tic.o ../objects/dump_entry.o ../objects/tparm_type.o ../objects/transform.o -L../lib  -DHAVE_CONFIG_H -I../progs -I. -I../include -I/mingw64/include/ncurses -DNCURSES_STATIC -D_FILE_OFFSET_BITS=64 -DNDEBUG -DWINVER=0x0501 -DWIN32_LEAN_AND_MEAN -lncurses -L/mingw64/bin -static --param max-inline-insns-single=1200  -DNCURSES_STATIC -L../lib -static -lncurses -lncurses -dynamic   -o tic.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../lib\libncurses.a(lib_ttyflags.o):lib_ttyflags.c:(.text+0x76): undefined reference to `_nc_mingw_tcgetattr'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../lib\libncurses.a(lib_ttyflags.o):lib_ttyflags.c:(.text+0x181): undefined reference to `_nc_mingw_tcsetattr'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:262: tic.exe] Error 1
make[1] : we quit the directory « /home/[username]/ncurses-6.4/progs »
make: *** [Makefile:136: all] Error 2
I was unable to find a working solution, I know it's possible to compile NCurses on MSYS2 MinGW-w64 because annother person did it (https://stackoverflow.com/questions/66063363) but his solution didn't worked and gave the same error (I did pacman -Syuu mingw-w64-x86_64-toolchain && export CFLAGS="-I/mingw64/include/ncurses -lncurses -L/mingw64/bin -DNCURSES_STATIC -static" && export CXXFLAGS=$CFLAGS && ./configure && make && make install, maybe I did something wrong here...).
I know this is Linux forum, not Windows forum, but since MinGW is actually using BASH like Linux and it's a GNU software well-used on Linux, I think it's OK to ask this on a Linux forum...
 


Without looking at the thread you’ve linked, I can tell you that the solution you’ve posted will only work if you’re cross-compiling an executable for windows using mingw on an Arch Linux system.
Pacman is a package manager for Arch Linux.

If you’re using MSYS/mingw on windows, then that will not help you.

What you’re getting is a linker error, which states that gcc can’t find the appropriate link-library containing the definition/implementation of _nc_mingw_tcgetattr.

I’ve never really used msys, so I don’t know what to suggest offhand. Personally, on my windows PC at work, I install and use Cygwin to compile/build windows versions of Linux software. And I’ve never experienced any link errors like this.

At a guess, you probably need to be setting and exporting the CFLAGS and CXXFLAGS as per the Arch Linux suggestion (minus the Pacman stuff). But you’ll need to set the paths for the includes and the link libraries correctly, depending on where they actually are on your windows system.
The paths in your posted example are the paths on Arch. They might be slightly different under msys on Windows.
 
Without looking at the thread you’ve linked, I can tell you that the solution you’ve posted will only work if you’re cross-compiling an executable for windows using mingw on an Arch Linux system.
Pacman is a package manager for Arch Linux.

If you’re using MSYS/mingw on windows, then that will not help you.

What you’re getting is a linker error, which states that gcc can’t find the appropriate link-library containing the definition/implementation of _nc_mingw_tcgetattr.

I’ve never really used msys, so I don’t know what to suggest offhand. Personally, on my windows PC at work, I install and use Cygwin to compile/build windows versions of Linux software. And I’ve never experienced any link errors like this.

At a guess, you probably need to be setting and exporting the CFLAGS and CXXFLAGS as per the Arch Linux suggestion (minus the Pacman stuff). But you’ll need to set the paths for the includes and the link libraries correctly, depending on where they actually are on your windows system.
The paths in your posted example are the paths on Arch. They might be slightly different under msys on Windows.
Hi, thanks for your response.
Actually, MSYS2 MinGW-w64 is an environement that is "Linux-like" (or something like that). What I mean is that actually Linux paths are automatically "translated" into Windows paths and pacman is actually a package manager from Arch Linux but is also on MSYS2. (source: https://www.msys2.org/docs/package-management/)
How pacman works is simple: it does not takes packages containing Windows binaries. Actually, people using MSYS2 compilated every software available on MSYS2's version of pacman and publish them on MSYS2's pacman server so it's actually pre-compiled Windows binaries. (since you said you use Cygwin, it's actually the Cygwin software installer but in the terminal)
Also, paths like ~ or $HOME are actually not the Windows equivalent. When using MSYS2, the terminal is running in a separated directory so MSYS2's executables aren't mixed with native Windows executables. Actually, folders /home/username is the same as C:\msys64\home\username and running ls "C:\msys64\home\username", ls /home/username, ls $HOME and ls ~ is actually the same thing.
Anyways, since you said that you never had problems on Cygwin, I'll use it instead. Thanks !
 
I just seen that there is a Windows-compatible NCurses version called PDCurses, and building it works but I get a DLL (pdcurses.dll) but I'm unsure where to place it, any ideas please ?
 


Latest posts

Top