Install Haskell terminfo in Windows - haskell

I'm trying to install terminfo cabal package on my Windows Cygwin installation, but it fails because of curses headers:
$ cabal install terminfo
Resolving dependencies...
Configuring terminfo-0.3.2.5...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
...
checking ncurses.h usability... no
checking ncurses.h presence... no
checking for ncurses.h... no
checking curses.h usability... no
checking curses.h presence... no
checking for curses.h... no
configure: error: in `/tmp/terminfo-0.3.2.5-620/terminfo-0.3.2.5':
configure: error: curses headers could not be found, so this package cannot be built
See `config.log' for more details
Failed to install terminfo-0.3.2.5
cabal.exe: Error: some packages failed to install:
terminfo-0.3.2.5 failed during the configure step. The exception was:
ExitFailure 1
At the same time, NCurses is installed correctly (/usr/include/ncursesw and ncurses).
If before compilation I explicitly add that sub-folder to GCC, it proceeds
export C_INCLUDE_PATH=/usr/include/ncursesw
re-running cabal produced another error:
...
checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
checking for setupterm in -lncursesw... yes
configure: creating ./config.status
config.status: creating terminfo.buildinfo
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
cabal.exe: Missing dependency on a foreign library:
* Missing (or bad) header file: ncurses.h
* Missing C library: ncursesw
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
Failed to install terminfo-0.3.2.5
cabal.exe: Error: some packages failed to install:
terminfo-0.3.2.5 failed during the configure step. The exception was:
ExitFailure 1

So I tried cabal install terminfo --extra-lib-dirs=/lib/ncursesw, but then I realized that cabal is a windows app, so I've also tried --extra-lib-dirs=c:/cygwin/lib/ncursesw
In the end, final solution is as follows:
Install Cygwin and ncursesw-devel package there
Run cygwin and configure GCC:
$ export C_INCLUDE_PATH=/usr/include/ncursesw
Since C:\cygwin\usr\include\ncursesw\ncurses.h is a soft-reference in Cygwin, you should manually replace this file with curses.h from the same folder
From the same Cygwin terminal you can now start Cabal (it's a Windows program!):
$ cabal install terminfo --extra-lib-dirs=c:/cygwin/lib --extra-include-dirs=c:/cygwin/usr/include/ncursesw --extra-include-dirs=c:/cygwin/usr/include
So, the library was installed. But when I try to actually use that function, ghc complains:
Loading package terminfo-0.3.2.5 ... linking ... ghc.exe: c:/cygwin/lib\libncursesw.a: unknown symbol `__imp____ctype_ptr__'

Related

How to install 'readline' with Cabal on Windows

I would like to install 'readline' using Cabal on Windows. When running the command it is saying that readline isn't found. Cabal is up to date.
Command
cabal install readline
Output
Resolving dependencies...
Notice: installing into a sandbox located at
C:\Users\Michael\Desktop\haskell-project\.cabal-sandbox
Configuring readline-1.0.3.0...
Failed to install readline-1.0.3.0
Build log ( C:\Users\Michael\Desktop\haskell-project\.cabal-sandbox\logs\readline-1.0.3.0.log ):
Configuring readline-1.0.3.0...
checking for gcc... gcc
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for GNUreadline.framework... checking for readline... no
checking for tputs in -lncurses... no
checking for tputs in -ltermcap... no
checking for tputs in -lcurses... no
checking for rl_readline_version... no
configure: error: readline not found, so this package cannot be built
See `config.log' for more details.
cabal: Error: some packages failed to install:
readline-1.0.3.0 failed during the configure step. The exception was:
ExitFailure 1
What could be the reason for this?
If you are using an msys distro that includes pacman (the one that ships with the windows haskell platform installer should be such a distro) then you can use pacman to install the readline library, and this should let you link against it.
Also note that ghc ships with the haskeline library, which is a pure-haskell replacement for readline that is more portable.

"X11 libraries not found" error when installing the X11 package with Stack

I need to use the x11 package with the lts-8.2 resolver, and when I run the command stack build, I get the following :
X11-1.8: configure
Progress: 1/2
-- While building package X11-1.8 using:
/tmp/stack7885/X11-1.8/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 /setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 configure --with-ghc=/home/userXYZ/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --with-ghc-pkg=/home/userXYZ/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/pkgdb --libdir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/lib --bindir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/bin --datadir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/share --libexecdir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/libexec --sysconfdir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/etc --docdir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/doc/X11-1.8 --htmldir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/doc/X11-1.8 --haddockdir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/doc/X11-1.8 --dependency=base=base-4.9.1.0 --dependency=data-default=data-default-0.7.1.1-7EGYJX2YWqWJRbPFUHNoCr
Process exited with code: ExitFailure 1
Logs have been written to: /home/userXYZ/Documents/programming/haskell/projects/MyStack/screen-linux/.stack-work/logs/X11-1.8.log
[1 of 1] Compiling Main ( /tmp/stack7885/X11-1.8/Setup.hs, /tmp/stack7885/X11-1.8/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/Main.o )
/tmp/stack7885/X11-1.8/Setup.hs:6:29: warning: [-Wdeprecations]
In the use of ‘defaultUserHooks’
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
compatibility in which case you must stick with defaultUserHooks"
Linking /tmp/stack7885/X11-1.8/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup ...
Warning: defaultUserHooks in Setup script is deprecated.
Configuring X11-1.8...
configure: WARNING: unrecognized options: --with-hc
checking for gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/gcc accepts -g... yes
checking for /usr/bin/gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... /usr/bin/gcc -E
checking for X... no
configure: error: in `/tmp/stack7885/X11-1.8':
configure: error: X11 libraries not found, so X11 package cannot be built
See `config.log' for more details
I am running on LinuxMint 17.2 64bits.
I found a similar issue here, but unfortunately that did not help me to solve my issue.
I am looking for any help to fix the issue. I am not entirely sure where to start with.
===============================
EDIT: following the suggestion of duplode, I loaded libx11-dev, and then got the following set of other messages after running stack build :
X11-1.8: configure
Progress: 1/2
-- While building package X11-1.8 using:
/tmp/stack12282/X11-1.8/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.2.0 configure --with-ghc=/home/userXYZ/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc --with-ghc-pkg=/home/userXYZ/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --package-db=clear --package-db=global --package-db=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/pkgdb --libdir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/lib --bindir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/bin --datadir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/share --libexecdir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/libexec --sysconfdir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/etc --docdir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/doc/X11-1.8 --htmldir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/doc/X11-1.8 --haddockdir=/home/userXYZ/.stack/snapshots/x86_64-linux/lts-8.2/8.0.2/doc/X11-1.8 --dependency=base=base-4.9.1.0 --dependency=data-default=data-default-0.7.1.1-7EGYJX2YWqWJRbPFUHNoCr
Process exited with code: ExitFailure 1
Logs have been written to: /home/userXYZ/Documents/programming/haskell/projects/MyStack/screen-linux/.stack-work/logs/X11-1.8.log
[1 of 1] Compiling Main ( /tmp/stack12282/X11-1.8/Setup.hs, /tmp/stack12282/X11-1.8/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/Main.o )
/tmp/stack12282/X11-1.8/Setup.hs:6:29: warning: [-Wdeprecations]
In the use of ‘defaultUserHooks’
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
compatibility in which case you must stick with defaultUserHooks"
Linking /tmp/stack12282/X11-1.8/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/setup/setup ...
Warning: defaultUserHooks in Setup script is deprecated.
Configuring X11-1.8...
configure: WARNING: unrecognized options: --with-hc
checking for gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/gcc accepts -g... yes
checking for /usr/bin/gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... /usr/bin/gcc -E
checking for X... libraries , headers
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... no
checking whether to build Xinerama... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking X11/extensions/Xinerama.h usability... no
checking X11/extensions/Xinerama.h presence... no
checking for X11/extensions/Xinerama.h... no
WARNING: Xinerama headers not found. Building without Xinerama support
checking X11/extensions/Xrandr.h usability... no
checking X11/extensions/Xrandr.h presence... no
checking for X11/extensions/Xrandr.h... no
configure: error: X11/extensions/Xrandr.h (from libXrandr) is required
Errors about missing libraries when installing packages with stack or cabal-install are typically about non-Haskell dependencies that must be installed separately, as the Haskell-specific tools aren't meant to pull them on their own. In this case, to quote the readme of the X11 Haskell package...
You will need development versions of at least the X11, xrandr, and Xinerama libraries installed for the build to succeed [...]
The development versions of these libraries can be installed through the package manager of your Linux distribution; in the case of Mint they amount to the libx11-dev, libxrandr-dev and libxinerama-dev packages respectively.

error installing a package in R pertaining stringr package [duplicate]

This question already has an answer here:
Error installing r packages (Linux Mint 17.1) "error: C preprocessor "g++ -E" fails sanity check"
(1 answer)
Closed 7 years ago.
I have problem with installing packages in RStudio.
I'm using Linux Mint and have already installed libgdal-dev and libproj-dev.
Here's the text in the terminal:
* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
checking for local ICUDT_DIR... icu55/data
checking for R_HOME... /usr/lib/R
checking for R... /usr/lib/R/bin/R
checking for R >= 3.1.0... no
*** disabling C++11 use
checking for cat... /bin/cat
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... g++ -E
configure: error: in `/tmp/Rtmp3NFJZN/R.INSTALL28c32774afde/stringi':
configure: error: C preprocessor "g++ -E" fails sanity check
See `config.log' for more details
ERROR: configuration failed for package ‘stringi’
* removing ‘/home/varum/R/x86_64-pc-linux-gnu-library/3.0/stringi’
Warning in install.packages :
installation of package ‘stringi’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmpv9QKWM/downloaded_packages’
Any ideas where the problem is?
checking for R >= 3.1.0... no
It might help to update your R version. The current release is version 3.2.2
Check the installation guidelines here.
Maybe installing the g++ could help
sudo apt-get install g++

Problems trying to install the plugin package

So I was going to try playing around with run time code reloading, and IIRC plugins was the way to go.
But on my msys terminal, the compilation fails. Is this a package bug or I'm missing a dependency?
My GHC is from the latest Haskell platform, 7.4.1.
Thanks in advance.
Mdx#Bhmt ~
$ cabal install plugins
Resolving dependencies...
Configuring plugins-1.5.2.3...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
checking build system type... i686-pc-mingw32
checking for ghc... ghc
checking for value of __GLASGOW_HASKELL__... 704
checking for ghc library directory... C:\Program Files (x86)\Haskell Platform\20
12.2.0.0\lib
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for arc4random... no
checking for a BSD-compatible install... /usr/bin/install -c
configure: creating ./config.status
config.status: creating config.mk
config.status: creating testsuite/makewith/io/TestIO.conf
config.status: creating testsuite/makewith/unsafeio/Unsafe.conf
config.status: creating config.h
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
Building plugins-1.5.2.3...
Preprocessing library plugins-1.5.2.3...
[ 1 of 12] Compiling System.Plugins.Process ( src\System\Plugins\Process.hs, dis
t\build\System\Plugins\Process.o )
[ 2 of 12] Compiling System.Plugins.Parser ( src\System\Plugins\Parser.hs, dist\
build\System\Plugins\Parser.o )
[ 3 of 12] Compiling System.Plugins.LoadTypes ( src\System\Plugins\LoadTypes.hs,
dist\build\System\Plugins\LoadTypes.o )
[ 4 of 12] Compiling System.Plugins.Consts ( src\System\Plugins\Consts.hs, dist\
build\System\Plugins\Consts.o )
src\System\Plugins\Consts.hs:39:23:
lexical error in string/character literal at character 'P'
cabal.exe: Error: some packages failed to install:
plugins-1.5.2.3 failed during the building phase. The exception was:
ExitFailure 1
You should update your ghc from 7.0.4 version.

How can I get Haskell readline installing under Cygwin?

Here's the message I get when trying to install in via cabal-install:
$ cabal install --extra-include-dirs="C:\no_spaces\cygwin\usr\include" --extra-lib-dirs="C:\no_spaces\cygwin\lib" readline
Resolving dependencies...
Configuring readline-1.0.1.0...
checking for gcc... gcc
checking for C compiler default output file name... a.exe
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... .exe
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for GNUreadline.framework... checking for readline... no
checking for tputs in -lncurses... yes
checking for readline in -lreadline... yes
checking for rl_readline_version... yes
checking for rl_begin_undo_group... yes
checking for rl_erase_empty_line... yes
checking for rl_free_undo_list... yes
checking for rl_completion_word_break_hook in -lreadline... yes
configure: creating ./config.status
config.status: creating config.mk
config.status: creating readline.buildinfo
config.status: creating include/HsReadlineConfig.h
config.status: include/HsReadlineConfig.h is unchanged
cabal.exe: Missing dependencies on foreign libraries:
* Missing header file: HsReadline.h
* Missing C libraries: readline, ncurses
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.
cabal.exe: Error: some packages failed to install:
readline-1.0.1.0 failed during the configure step. The exception was:
ExitFailure 1
I have readline.h and whatnot, and clearly it seems to find them. The lack of HsReadline.h being an issue seems strange: isn't that part of the package I'm trying to install?
Any advice on how to get this working would be appreciated. I've spent days mucking around trying to get this to work, whether under gnuWin32 readline, MinGW, or cygwin.
I'm going to venture a guess that what's throwing Cygwin off is the DOS/Windows-style path: "C:\no_spaces\cygwin\usr\include"
Try navigating to these files in the Cygwin shell. It'll probably look something like "/cygdrive/c/no_spaces/cygwin/usr/include"
The message about HsReadline.h is probably a red herring. The real issue is that Cabal can't find the underlying dev library to compile against.

Resources