Using Curl in Haskell Platform on Windows 7 - haskell

I'm trying to use 'import Text.XML.HXT.Curl' in my project so I can have access to online files (some xml files).
So the error I get is :
Could not find module `Text.XML.HXT.Curl':
Use -v to see a list of the files searched for.
I tried :
:! cabal install curl
but I get an error that it must be on unix or cygwin, so I go on installing cygwin, now it says:
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
cabal: Error: some packages failed to install:
curl-1.3.7 failed during the configure step. The exception was:
ExitFailure 77
:! gcc -version
Access is denied
I tried to download the curl package and install it with cmd : runHaskell Setup.hs configure but I get this :
Setup.hs: Missing dependency on a foreign library:
Missing C library: curl
This problem can usually be solved by installing the system package that provides this library (you may need the "-dev" version)
Tried installing gcc,g++,libcurl,make in cygwin, still fails.
Tried installing mingw/mysis and I failed too. Something about curl/curl.h missing.
Does anyone succeeded and can tell me how he did it ?

Installing curl on windows can be tricky. But you can try hxt-http package. It is based on native HTTP package, and doesn't require external dependencies. AFAIK it will just work out of the box on windows.
Small note: to use curl with hxt, you need to install hxt-curl package. But, yes, it will not help, cos it depends of curl package :(
So, my answer actually is about "using hxt on windows", not about "using curl on windows". You can ignore it in case it doesn't help you.

Related

Error when running stack build language-plutus-core on Windows 8

When I ran the command stack build language-plutus-core I received the following error:
-- While building custom Setup.hs for package cryptonite-openssl-0.7 using:
C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6
.4.exe --builddir=.stack-work\dist\e626a42b configure --with-ghc=C:\Users...
Process exited with code: ExitFailure 1
Logs have been written to: C:\Projects\2019-08-07-Plutus\plutus-master\.stac
k-work\logs\cryptonite-openssl-0.7.log
Configuring cryptonite-openssl-0.7...
Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.4.exe: Missing dependencies on foreign libraries:
* Missing (or bad) C libraries: eay32, ssl32
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.
If the library files do 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.
Anyone any idea how to fix this? Do i need to install eay32, ssl32 separately?
Consider installing these packages using the bundled MSYS in your stack installation. First do stack exec bash to enter MSYS, then use the pacman in that MSYS environment.
The packages from the bundled pacman are from MinGW32, MinGW64 and MSYS2, so most of them (as far as I have used) should be prefixed with mingw-w64-i686- or mingw-w64-x86_64-. See the official documentation for msys2 for detailed information.

Haskell cabal: C compiler cannot create executables

I'm trying to install ghc-mod for GHC 8.0.1 on windows/x64. When I try to install ghc-mod via cabal install ghc-mod I get an error saying my C compiler isn't working (it is using the c-compiler bundled with ghc).
Here is the output (of the second time I ran the command. Its basically what the first one says but reduced to the error message):
C:\Users\******>cabal install ghc-mod
Resolving dependencies...
Configuring old-time-1.1.0.3...
Failed to install old-time-1.1.0.3
Build log ( C:\Users\******\AppData\Roaming\cabal\logs\old-time-1.1.0.3.log ):
Configuring old-time-1.1.0.3...
bash.exe: warning: could not find /tmp, please create!
configure: WARNING: unrecognized options: --with-compiler
checking for gcc... C:\PROGRA~1\Haskell Platform\8.0.1\mingw\bin\gcc.exe
^ I think the error lies here, as you can see the file path is corrupted but I wasn't able to locate the cause for this
checking whether the C compiler works... no
configure: error: in `/cygdrive/c/Users/******/AppData/Local/Temp/cabal-tmp-6084/old-time-1.1.0.3':
configure: error: C compiler cannot create executables
See `config.log' for more details
cabal: Leaving directory 'C:\Users\******\AppData\Local\Temp\cabal-tmp-6084\old-time-1.1.0.3'
cabal: Error: some packages failed to install:
cpphs-1.20.2 depends on old-time-1.1.0.3 which failed to install.
ghc-mod-5.6.0.0 depends on old-time-1.1.0.3 which failed to install.
haskell-src-exts-1.17.1 depends on old-time-1.1.0.3 which failed to install.
hlint-1.9.35 depends on old-time-1.1.0.3 which failed to install.
old-time-1.1.0.3 failed during the configure step. The exception was:
ExitFailure 77
Could you please help me to install ghc-mod or provide any other way of installing it.
I already trieded reinstalling Haskell since I'm just starting off but this didn't make any difference.
And YES I added the 3 lines provided on the haskell homepage.
I can't know for certain, but thought I'd write an answer with what I think is going on.
The old-time package contains a configure script, which is a Unix shell script used to (surprise!) configure the package. The Cabal build system allows packages to automatically integrate configure, and will run the script for them. On POSIX systems, there's always a shell easily available. However, on Windows, that's not the case. I believe that's the problem you're running into.
Now the tricky part: why don't you have a shell? In theory, the Haskell Platform ships a shell. Well, here are my guesses:
For Stack usage, there's a Haskell Platform bug where Stack cannot find the MSYS tools, which include the shell script. Newer versions of Stack work around this bug, but passing in --no-system-ghc tells Stack to ignore any installed toolchain and manage the installation itself, which is more reliable than using HP's copy.
For Cabal usage, I'm less certain. I think the HP team decided to require you to use a special batch program to set environment variables correctly, so if you just run cabal install foo from a normal command window, Cabal won't find MSYS and it will fail. However, without more information, I can't be certain this is the case.
My personal recommendation: uninstall Haskell Platform, and use the recommended Stack installation instructions. In your case, that's just downloading and running the 64-bit Windows installer.
Finally: your suspected problem is not actually a problem; on Windows, pathnames longer than 8 characters can be compressed in the way you see (with ~1 at the end). There's nothing buggy in that path display.

Installing erlang from tar resulting in errors, wondering how to specify folders

I had the inspiration to start messing around with Erlang and I am having problems installing it... I am using Linux Mint 16 (petra). I installed the dependencies, and then downloaded otp_src_17.1.tar.gz and ran 'tar -zxf otp_src_17.1.tar.gz' I then ran ./configure which gave me some errors that made it impossible to run make.
These are the errors I'm getting (actually what I did was I did ./configure > configure.txt to get all the lines it prints as it configures, and it conveniently still printed to the console everything that has errors - neat)
configure: WARNING: No odbc library found skipping odbc
configure: WARNING: "ODBC library - header check failed"
configure: WARNING: "ODBC library - link check failed"
rm: remove write-protected regular file './CONF_INFO'?
configure: WARNING: No GLU headers found, wx will NOT be usable
/home/core/Desktop/otp_src_17.1/lib/wx/./configure: line 5195: wx-config: command not found
/home/core/Desktop/otp_src_17.1/lib/wx/./configure: line 5893: ./CONF_INFO: Permission denied
configure: WARNING:
wxWidgets must be installed on your system.
Please check that wx-config is in path, the directory
where wxWidgets libraries are installed (returned by
'wx-config --libs' or 'wx-config --static --libs' command)
is in LD_LIBRARY_PATH or equivalent variable and
wxWidgets version is 2.8.4 or above.
rm: remove write-protected regular file 'doc/CONF_INFO'?
/home/core/Desktop/otp_src_17.1/erts/configure: line 6466: doc/CONF_INFO: Permission denied
configure: WARNING: No 'xsltproc' command found: the documentation cannot be built
/home/core/Desktop/otp_src_17.1/erts/configure: line 6513: doc/CONF_INFO: Permission denied
configure: WARNING: No 'fop' command found: going to generate placeholder PDF files
configure: error: No curses library functions found
configure: error: /bin/bash '/home/core/Desktop/otp_src_17.1/erts/configure' failed for erts
The thing is - I know that I have the ncurses library, as evidenced by the fact that when I do "sudo apt-get install ncurses-base ncurses-bin" it says:
Reading package lists... Done
Building dependency tree
Reading state information... Done
ncurses-base is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
When I run "locate ncurses" it gives me the following:
/lib/i386-linux-gnu/libncurses.so.5
/lib/i386-linux-gnu/libncurses.so.5.9
/lib/x86_64-linux-gnu/libncurses.so.5
/lib/x86_64-linux-gnu/libncurses.so.5.9
/lib/x86_64-linux-gnu/libncursesw.so.5
/lib/x86_64-linux-gnu/libncursesw.so.5.9
/usr/bin/ncurses5-config
/usr/bin/ncursesw5-config
/usr/lib/vlc/plugins/gui/libncurses_plugin.so
/usr/share/doc/libncurses5
/usr/share/doc/libncursesw5
/usr/share/doc/ncurses-base
/usr/share/doc/ncurses-bin
/usr/share/doc/ncurses-base/changelog.Debian.gz
/usr/share/doc/ncurses-base/copyright
/usr/share/doc/ncurses-bin/FAQ
/usr/share/doc/ncurses-bin/changelog.Debian.gz
/usr/share/doc/ncurses-bin/copyright
/usr/share/lintian/overrides/ncurses-base
/usr/share/man/man1/ncurses5-config.1.gz
/usr/share/man/man1/ncursesw5-config.1.gz
/var/cache/apt/archives/libncurses5_5.9+20130608-1ubuntu1_i386.deb
/var/lib/dpkg/info/libncurses5:amd64.list
/var/lib/dpkg/info/libncurses5:amd64.md5sums
/var/lib/dpkg/info/libncurses5:amd64.postinst
/var/lib/dpkg/info/libncurses5:amd64.postrm
/var/lib/dpkg/info/libncurses5:amd64.shlibs
/var/lib/dpkg/info/libncurses5:amd64.symbols
/var/lib/dpkg/info/libncurses5:i386.list
/var/lib/dpkg/info/libncurses5:i386.md5sums
/var/lib/dpkg/info/libncurses5:i386.postinst
/var/lib/dpkg/info/libncurses5:i386.postrm
/var/lib/dpkg/info/libncurses5:i386.shlibs
/var/lib/dpkg/info/libncurses5:i386.symbols
/var/lib/dpkg/info/libncursesw5:amd64.list
/var/lib/dpkg/info/libncursesw5:amd64.md5sums
/var/lib/dpkg/info/libncursesw5:amd64.postinst
/var/lib/dpkg/info/libncursesw5:amd64.postrm
/var/lib/dpkg/info/libncursesw5:amd64.shlibs
/var/lib/dpkg/info/libncursesw5:amd64.symbols
/var/lib/dpkg/info/ncurses-base.conffiles
/var/lib/dpkg/info/ncurses-base.list
/var/lib/dpkg/info/ncurses-base.md5sums
/var/lib/dpkg/info/ncurses-bin.list
/var/lib/dpkg/info/ncurses-bin.md5sums
I am at a loss as to where to proceed. Thanks for any help
I believe you need to install ncurses-dev
'sudo yum install ncurses-devel.x86_64' prior to running ./configure worked just fine for me. Fedora 21 x64, btw.
After I extracted the tar, the documentation was in '/opt_src_{version}/HOWTO/INSTALL.md. The contents of which states:
Required Utilities
These are the tools you need in order to unpack and build Erlang/OTP.
WARNING: Please have a look at the [Known platform issues][] chapter
before you start.
Unpacking
GNU unzip, or a modern uncompress.
A TAR program that understands the GNU TAR format for long filenames.
Building
GNU make
Compiler -- GNU C Compiler, gcc or the C compiler frontend for LLVM, clang.
Perl 5
GNU m4 -- If HiPE (native code) support is enabled. HiPE can be
disabled using --disable-hipe
ncurses, termcap, or termlib -- The development headers and
libraries are needed, often known as ncurses-devel. Use
--without-termcap to build without any of these libraries. Note that
in this case only the old shell (without any line editing) can be used.
sed -- Stream Editor for basic text transformation.
ncurses just happened to be the only required package I didn't have installed on this development VM. So your mileage may vary.
This was the output of 'locate ncurses' after I installed the ncurses lib:
/usr/lib64/libncurses++.so.5
/usr/lib64/libncurses++.so.5.9
/usr/lib64/libncurses++w.so.5
/usr/lib64/libncurses++w.so.5.9
/usr/lib64/libncurses.so.5
/usr/lib64/libncurses.so.5.9
/usr/lib64/libncursesw.so.5
/usr/lib64/libncursesw.so.5.9
/usr/share/doc/ncurses
/usr/share/doc/ncurses-base
/usr/share/doc/ncurses/ANNOUNCE
/usr/share/doc/ncurses/AUTHORS
/usr/share/doc/ncurses/NEWS.bz2
/usr/share/doc/ncurses/README
/usr/share/doc/ncurses/TO-DO
/usr/share/doc/ncurses-base/README
/usr/share/licenses/ncurses-base
/usr/share/licenses/ncurses-base/COPYING
So I'd say the OP had a corrupt / bad ncurses install. I'm just posting this here because this was the #1 Google result I got when I was too lazy to RTFD.
One alternative is using the option "--without-termcap"
otp_src_18.0/configure file says:
--without-termcap do not use any termcap libraries
(ncurses,curses,termcap,termlib)
./configure --prefix=/home/username/erlang/18.0 --without-termcap
Set your PATH variable as shown below.
export PATH=$PATH=/home/username/erlang/18.0/bin
Not sure about implications though. :)
Hope this helps someone.

How to install wxHaskell on Windows with MinGW/MSYS

I was trying to install wxHaskell into a machine running Windows XP64, with MinGW/MSYS and wxWidget 3.0 built from source using gcc. I did:
cabal install wx
and got an error:
...
Configuring wxc-0.90.0.4...
setup.exe: wx-config: does not exist
Failed to install wxc-0.90.0.4
cabal.exe: Error: some packages failed to install:
wx-0.90.0.1 depends on wxc-0.90.0.4 which failed to install.
wxc-0.90.0.4 failed during the configure step. The exception was:
ExitFailure 1
wxcore-0.90.0.3 depends on wxc-0.90.0.4 which failed to install.
I had successfully used wxWidgets to write an sample application in C++ (gcc). So I do have a working wxWidget installation. And I have wx-config at:
$ which wx-config
/usr/local/bin/wx-config
The problem is that wx-config is a unix shell script, and cabal (called from MSYS) somehow refuses to recognize it even if it's on the system path. If I run wx-config in MSYS, I get something like:
$ wx-config --cxxflags
-I/usr/local/lib/wx/include/msw-unicode-3.0 -I/usr/local/include/wx-3.0 -D_LARGE
FILE_SOURCE=unknown -DWXUSINGDLL -D__WXMSW__ -mthreads
I have asked a question https://stackoverflow.com/questions/21998763/how-to-convert-msys-shell-scripts-to-windows-exe-files to see if it's possible to convert the script to an exe, but no one responded with any solutions.
There is also a related question here, wxHaskell installation on windows , and another here wx 0.90.0.1 fails to install on Haskell Platform 2012.2.0.0 (WinXP). In fact, I couldn't found an answer that's confirmed to work. Also, the errors/settings here seem to be different, or the answers therein don't seem solve my problem. In particular, I downloaded an external wx-config.exe from https://sourceforge.net/projects/wxhaskell/files/wx-config-win/ per http://www.haskell.org/haskellwiki/WxHaskell/Windows. But running wx-config.exe can't recognize my wxWidget installation and always gives me an error about cannot find wxWidgets, like this:
$ ./wx-config.exe --prefix=/usr/local/
wx-config Error: wxWidgets hasn't been found installed at 'C:\MinGW\msys\1.0\loc
al'.
Please use the --prefix flag (as in wx-config --prefix=C:\wxWidgets)
or set the environment variable WXWIN (as in WXWIN=C:\wxWidgets)
to specify where is your installation of wxWidgets.
Any idea how to work around this issue?
Thanks,
-- Update --
#JP I tried:
C:\temp\wxdirect-0.90.0.1>runhaskell Setup configure --extra-lib-dirs=c:\MinGW\lib --extra-include-dirs=c:\MinGW\include --extra-include-dirs=c:\MinGW\msys\1.0\local\include
Configuring wxdirect-0.90.0.1...
and got
Setup: At least the following dependencies are missing:
containers >=0.2 && <0.5, strict -any
I tweaked wxdirect.cabal to bypass containers >=0.2 && <0.5, but can't get pass strict.
I've written a powershell script that automates the setup of MinGW and the downloading/building of wxWidgets in order to build wxHaskell for Windows 7.
https://github.com/cessationoftime/wxHaskell-Windows-Builder

trying to install hs-ffmpeg haskell package fails to find libdc1394

doing "cabal install hs-ffmpeg" fails like this:
checking for faacEncGetVersion in -lfaac... no
checking for zlibVersion in -lz... yes
checking for libdc1394... configure: error: Package requirements (libdc1394) were not met:
No package 'libdc1394' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables libdc1394_CFLAGS
and libdc1394_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
cabal: Error: some packages failed to install:
hs-ffmpeg-0.3.4 failed during the configure step. The exception was:
exit: ExitFailure 1
I have libdc1394-22 and libdc1394-22-dev installed on Ubuntu 9.10 Karmic Koala.
I'm thinking that the dependency needs to be updated to reflect the new package that supercedes libdc1394, but I'm not sure how to do that.
hs-ffmpeg's configure script is looking for a libdc1394.pc. For some reason, Ubuntu ships a libdc1394-2.pc instead.
Edit hs-ffmpeg's configure.ac to use the "correct" name and then run autoreconf, and it should work.
Something like mkdir -p ~/.pc; ln -s /usr/lib/pkgconfig/libdc1394-2.pc ~/.pc/libdc1394.pc; export PKG_CONFIG_PATH+=:~/.pc may work too.

Resources