bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issues while building ncurses 6.2 using Visual Studio


From: Anonymous Maarten
Subject: Re: Issues while building ncurses 6.2 using Visual Studio
Date: Wed, 26 Feb 2020 20:28:16 +0100

On Wed, 26 Feb 2020 at 03:04, Thomas Dickey <address@hidden> wrote:
>
> On Wed, Feb 26, 2020 at 12:47:54AM +0100, Maarten Anonymous wrote:
> > I had to apply some patches to let MSVC build it.
> thanks - will take a look.
I have pushed a new version with some comments about what errors they fix.

> but as noted, I don't accept pull-requests.

That's fine for me.
As long as you're willing to fix the errors they address.

> what I have seems to work with MinGW...
Indeed it works find for mingw.
But alas, MSVC != mingw.

The behavior when building a shared library using MSVC with my patches included is
to not create any import library. This fails the build because the next library (libmenu) cannot find an import lbrary to link to.

Also note that include/ncurses_dll.h.in contains the following comment:
/* no longer needed on cygwin or mingw, thanks to auto-import       */
/* but this structure may be useful at some point for an MSVC build */
/* so, for now unconditionally define the important flags           */
/* "the right way" for proper static and dll+auto-import behavior   */

I can "fix" this by patching include/ncurses_dll.h.in:
define NCURSES_DLL and undefine NCURSES_STATIC.
But this will come to haunt me.

`ncurses6.dll` builds fine but libmenu fails while linking with the following error:

linking ../lib/libmenu6.dll
/bin/sh ../mk_shared_lib.sh ../lib/libmenu6.dll link -nologo user32.lib   ../obj_s/m_attribs.obj ../obj_s/m_cursor.obj ../obj_s/m_driver.obj ../obj_s/m_format.obj ../obj_s/m_global.obj ../obj_s/m_hook.obj ../obj_s/m_item_cur.obj ../obj_s/m_item_nam.obj ../obj_s/m_item_new.obj ../obj_s/m_item_opt.obj ../obj_s/m_item_top.obj ../obj_s/m_item_use.obj ../obj_s/m_item_val.obj ../obj_s/m_item_vis.obj ../obj_s/m_items.obj ../obj_s/m_new.obj ../obj_s/m_opts.obj ../obj_s/m_pad.obj ../obj_s/m_pattern.obj ../obj_s/m_post.obj ../obj_s/m_req_name.obj ../obj_s/m_scale.obj ../obj_s/m_spacing.obj ../obj_s/m_sub.obj ../obj_s/m_userptr.obj ../obj_s/m_win.obj -L../lib -lncurses
Linking shared library
** SHARED_LIB ../lib/libmenu6.dll
** IMPORT_LIB ../lib/libmenu.dll.a
   Creating library ../lib/libmenu.dll.a and object ../lib/libmenu.dll.exp
m_spacing.obj : error LNK2019: unresolved external symbol TABSIZE referenced in function set_menu_spacing
../lib/libmenu6.dll : fatal error LNK1120: 1 unresolved externals

This is because of a combination of my monkey patching (of include/ncurses_dll.h.in) and the different libraries not having their own import/export declarations.

> > I don't know how supportive the developers are about adding support for
> > modern build systems such as cmake/meson?
>
> "modern" is frequently misused.
> Don't go there.

Ok. Then that's out of the question :)

Bulding ncurses on MSVC also displays a few warnings.

The following warning is thrown A LOT:

C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\wincontypes.h(137): warning C4005: 'KEY_EVENT': macro redefinition
../include\curses.h(1602): note: see previous definition of 'KEY_EVENT'
'C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\
um\wincontypes.h

This warning is also shown:
ncurses/tinfo/lib_setup.c(486): warning C4028: formal parameter 1 different from declaration
ncurses/
tinfo/lib_setup.c(486): warning C4028: formal parameter 2 different from declaration

There may be more warnings, but the first warning about KEY_EVENT is drowning all other warnings.

Another nuissance is that at install time, ncurses install libncurses.a libraries,\
whereas Visual Studio expects ncurses.lib libraries (no prefix and other suffix).
This can be fixed by a rename though.

Best regards
Maarten

reply via email to

[Prev in Thread] Current Thread [Next in Thread]