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: Thu, 27 Feb 2020 14:47:04 +0100


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, 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`)
  4. export some variables:
    export CC="/usr/share/automake-1.16/compile cl -nologo"
    export CXX="/usr/share/automake-1.16/compile cl -nologo"
    export LD="link -nologo"
    export LDFLAGS=user32.lib
    export NM="dumpbin -symbols"
    export STRIP=:
    export AR="/usr/share/automake-1.16/ar-lib lib"
    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.
    (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.

For conan, I've fixed this by using getopt-for-visual-studio.
To avoid linking, I've patched 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.

there's some special-case used for some platforms, which can be adapted...
 
Great!


reply via email to

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