How to run stack ghci on WSL? - haskell

I installed Haskell stack in WSL (Ubuntu 20.04.3 LTS on Windows 10).
After that, I successfully installed stack using command curl -sSL https://get.haskellstack.org/ | sh
However, after I tried to run gchi I got this error:
et#DESKTOP-D0DE6C4:~$ stack ghci
Writing implicit global project config file to: /home/et/.stack/global-project/stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-18.16
Preparing to install GHC (tinfo6) to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-tinfo6-8.10.7.
ghc-pkg: Couldn't open database /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/package.conf.d for modification: {handle: /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/lib/ghc-8.10.7/package.conf.d/package.cache.lock}: hLock: invalid argument (Invalid argument)
make[1]: *** [ghc.mk:985: install_packages] Error 1
make: *** [Makefile:51: install] Error 2
Received ExitFailure 2 when running
Raw command: /usr/bin/make install
Run from: /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7.temp/ghc-8.10.7/
Error: Error encountered while installing GHC with
make install
run in /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7.temp/ghc-8.10.7/
The following directories may now contain files, but won't be used by stack:
- /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7.temp/
- /home/et/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7/
For more information consider rerunning with --verbose flag
Installing GHC ...
et#DESKTOP-D0DE6C4:~$
--verbose flag did not help as it shows the same error again.
I did not manage to Google anything useful on that.

I installed WSL 2 as explained here WSL | Ubuntu and after that I successfully installed stack ghci. Thanks Joseph for the idea.

Related

Yum reports an error:CRITICAL:yum.cli:Config error: Error accessing file for config file:///etc/yum.conf

My environment: python3.8, gcc12.2, cmake4.3. I want to compile and install the glibc library. When I finish compiling and installing, my yum has an error
The following is the error content:
CRITICAL:yum.cli:Config error: Error accessing file for config file:///etc/yum.conf
But I obviously have /etc/yum.conf, but I still get an error
I hope to know why and get a solution, thank you
I downloaded and compiled glibc, and the installation was successful, but there was an error message after installation
collect2: error: ld returned 1 exit status
Execution of gcc failed!
The script has found some problems with your installation!
Please read the FAQ and the README file and check the following:
- Did you change the gcc specs file (necessary after upgrading from
Linux libc5)?
- Are there any symbolic links of the form libXXX.so to old libraries?
Links like libm.so -> libm.so.5 (where libm.so.5 is an old library) are wrong,
libm.so should point to the newly installed glibc file - and there should be
only one such link (check e.g. /lib and /usr/lib)
You should restart this script from your build directory after you've
fixed all problems!
Btw. the script doesn't work if you're installing GNU libc not as your
primary library!
make[1]: *** [Makefile:111: install] Error 1
make[1]: Leaving directory '/opt/glibc-2.29'
make: *** [Makefile:12:install] 错误 2
But I found on the net that this error doesn't affect anything

Build mozilla JSS

I followed NSS build instructions and built NSS successfully.
Then I follow JSS build instructions and building fails with error:
In file included from CryptoManager.c:6:0:
../../../../dist/public/nss/secitem.h:15:21: fatal error: plarena.h: No such file or directory
compilation terminated.
This result is on Ubuntu 16.04 LTS.
On WIndows I get:
All directories (dist, jss, nspr and nss) are on the same level.
What am I doing wrong?
Check my post here. Basically it's due to missing packages. If not working, this file is somewhere under nspr. Copy it and place it beside the .c file which needs it.
EDIT:
To sum it up:
1. Install build-essential and gcc with g++.
2. Try to install zlib1g-dev and libc6-dev, if they are absent.
3. And, install zlib1g-dev.
4. cd into the nss directory, and run the build like this:
gmake nss_build_all NSS_SSL_ENABLE_ZLIB=
if you are under a x64 environment, add USE_64=1, too.
It should work.

Error when installing haskell-platform from source

I need to install from source files the haskell platform so as indicated in the instructions installed cabal, ghc and other libraries for Ubuntu that are needed.
When I try to install the haskell platform with the command:
./platform.sh /home/myuser/haskell/ghc-7.10.2-x86_64-unknown-linux-deb7.tar.bz2 -j 3
I get the following error:
***
*** Building hptool
***
Building hptool-0.1...
Preprocessing executable 'hptool' for hptool-0.1...
***
*** Running hptool
***
Error when running Shake build system:
* 3
Error, file does not exist and no rule available:
3
and I don't find anyone with same error. The haskell platform version that I have downloaded is haskell-platform-7.10.2-a
When using the ./platform.sh script you can't pass a build option like -j 3.
Try building and running hptool manually like this:
cd hptool
cabal sandbox init
cabal install -j3
cd ..
./hptool/.cabal-sandbox/bin/hptool PATH-TO-GHC-BINDIST SHAKE-TARGET
Run hptool with no arguments to get a list of valid values for SHAKE-TARGET.

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

Using Curl in Haskell Platform on Windows 7

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.

Resources