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: Thomas Dickey
Subject: Re: Issues while building ncurses 6.2 using Visual Studio
Date: Sat, 29 Feb 2020 18:23:31 -0500
User-agent: NeoMutt/20170113 (1.7.2)

On Thu, Feb 27, 2020 at 02:47:04PM +0100, Anonymous Maarten wrote:
> On Thu, 27 Feb 2020 at 10:40, Thomas Dickey <address@hidden> wrote:
> 
> > It's not a huge change.  It would help to know how you've set up the
> > build-environment (e.g., cygwin or mingw with some given version of
> > Visual Studio, etc.), to save time.
> >
> 
> I am currently building ncurses with conan, that is using msys2.
> See the build() function at
> https://github.com/madebr/conan-center-index/blob/ncurses/recipes/ncurses/all/conanfile.py
> In it, you can read what options I'm passing to configure.
> By submitting this script to CCI
> <https://github.com/conan-io/conan-center-index>, it will also be built for
> gcc@Linux, clang@Linux, apple-clang@Macos and all relevant MSVC versions on
> Windows.
> 
> So my setup is msys2+VS2017.
> 
> This script is fully automated.
> For some more interactive building I've compiled the steps this script does:
> 
>    1. On Windows
>    2. Start a msys2 terminal
>    3. Install automake (`pacman -S automake`)

I'm not using automake anywhere in ncurses :-)

>    4. export some variables:
>    export CC="/usr/share/automake-1.16/compile cl -nologo"
>    export CXX="/usr/share/automake-1.16/compile cl -nologo"

offhand, I'd do
        CC="cl -w4"

(ymmv)

>    export LD="link -nologo"
>    export LDFLAGS=user32.lib
>    export NM="dumpbin -symbols"
>    export STRIP=:
>    export AR="/usr/share/automake-1.16/ar-lib lib"

I hadn't noticed that before -- but it doesn't appear to have a case for msys2.

>    export RANLIB=:
>    5. Run `cmd.exe` to start a cmd terminal inside msys2 (the path env
>    variable of msys2 will be inherited)
>    6. Run `cmd.exe /k "C:\Program Files (x86)\Microsoft Visual
>    Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"` to source the
>    paths of VS2017.

ok... I was curious if $PATH would be transformed (will find out, a little
later).

Most of the patches look okay, except the one for lib_gen.c (which will
make the library not provide a lot of the entrypoints it's supposed to).

I'll have to investigate that when I get a development environment set up
for this (have started, but am only halfway through - for the moment am
reviewing/validating the patches against mingw).

btw, STDIN_FILENO should be "0" (not "1").

>    (This path will be different for VS2019. I've found it by right clicking
>    on "x64 Native Tools Command Prompt for VS 2017" in my start menu)
>    7. cd to your build directory (You are now in a cmd shell)
>    8. Run `sh ../configure`
> 
> The first error should be missing `getopt` for building progs.
> Running `sh ../configure --without-progs` does not work around this problem.

The configure script checks if either --without-progs or --without-tests
was given (both require getopt), so if you add --without-tests, the build
"should" work.

(The Ada binding also uses getopt, but I don't suppose you're using that).
 
> For conan, I've fixed this by using getopt-for-visual-studio
> <https://github.com/skandhurkat/Getopt-for-Visual-Studio>.
> To avoid linking, I've patched
> <https://github.com/conan-io/conan-center-index/pull/877/files#diff-503e8c63e7c135902515a5e09f5f7a44>
> it a bit: https://github.com/conan-io/conan-center-index/pull/877
> 
> Since microsoft's compiler supports different arguments as gcc, I needed to
> wrap it using automake's compile.
> Compiling and linking a simple hello world c program in one step can be
> done as:
> cl hello.c /link /out:hello.exe
> Skipping the /link /out:hello.exe, would only create a hello.obj file.
> 
> In my steps, I've added user32.lib to LDFLAGS, I'm not entirely sure this
> is needed but at one point some linking error forced me to.
> 
> If you happen to have some more questions, do not hesitate to ask me.

sure (but initially I'll be adding to my own build-scripts)
 
> there's some special-case used for some platforms, which can be adapted...
> >
> 
> Great!

-- 
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

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