`Undefined symbol: ossl_sha3_512_functions` when trying to build the Kadena chainweb-node Haskell project - haskell

I've been trying to compile the Kadena chainweb-node project from source (via the docs found here) in a docker container running the arm64v8/ubuntu base image on an Apple M1 host machine and I keep getting errors. Thanks to the super helpful folks in the #haskell IRC channel, I've made it over a number of small hurdles, but the build still fails with:
Undefined symbol: ossl_sha3_512_functions
I can not find any resources on how to fix this but one of the #haskell community members informed me that these symbols are not provided by the openssl 3.0 API. That person created an issue here: https://github.com/larskuhtz/hs-hashes/issues/14
I've found that I can use the docker base image haskell:8 which comes preinstalled with ghc, cabal, and openssl 1.1.1 to cabal build chainweb-node successfully using a slightly different set of apt-get dependencies. However, when trying to cabal install the binaries so that I can run chainweb-node, I get:
Failed to build chainweb-2.14.1. The failure occurred during the configure
step.
Build log (
/root/.cabal/logs/ghc-8.10.7/chainweb-2.14.1-36aedf5adc1967eb17358e6434b6fd51bc7e64082f6c12e0df40ddafece6ff69.log
):
[1 of 1] Compiling Main ( /tmp/cabal-install.-838/dist-newstyle/tmp/src-838/chainweb-2.14.1/dist/setup/setup.hs, /tmp/cabal-install.-838/dist-newstyle/tmp/src-838/chainweb-2.14.1/dist/setup/Main.o )
Linking /tmp/cabal-install.-838/dist-newstyle/tmp/src-838/chainweb-2.14.1/dist/setup/setup ...
Configuring chainweb-2.14.1...
setup: Encountered missing or private dependencies:
criterion -any,
data-ordlist >=0.4.7,
resource-pool >=0.2,
retry >=0.7,
statistics >=0.15,
tasty-json >=0.1
cabal: Failed to build chainweb-2.14.1. See the build log above for details.
I've tried cabal install criterion and the other missing deps, one by one, but the cabal install gives me the same errors.
Can someone tell me what I'm doing wrong and help me get a working chainweb-node binary built from source and installed using docker?

Related

Trying to compile gi-gtk-declarative

I am new to GTK, but not to Haskell. I am currently running Arch linux.
I cloned gi-gtk-declarative, and did a checkout of the release-0.6.3 branch.
I tried compiling with both stack build and cabal v2-build all, and both fail on gi-glib with the following error:
> Unknown GIR element "docsection" when processing namespace "GLib", aborting.
How can I fix this? Is there a patched version of gi-glib?
This looks like an issue regarding version constraints:
gi-gtk-declarative depends on haskell-gi (>=0.21 && <0.24)
Looks like this issue was fixed on haskell-gi 0.24.4
As you can see, the author of gi-gtk-declarative needs to update his dependencies.
As a workaround, you can run stack build --allow-newer or cabal build --allow-newer which will bypass the version constraint.

How can I resolve cabal install system-fileio failure if the error is "The import of `System.IO.Error' is redundant"

I tried to install system-fileio to my global package db and failure was :
c:\Haskell\2013.2.0.0\bin>cabal-1.20.0.1.exe install system-fileio
Resolving dependencies...
Configuring system-fileio-0.3.13...
Building system-fileio-0.3.13...
Failed to install system-fileio-0.3.13
Last 10 lines of the build log ( C:\Users\bitli\AppData\Roaming\cabal\logs\system- fileio-0.3.13.log ):
The import of `System.IO.Error' is redundant
except perhaps to import instances from `System.IO.Error'
To import instances alone, use: import System.IO.Error()
lib\hssystemfileio-win32.c: In function 'hssystemfileio_copy_permissions':
lib\hssystemfileio-win32.c:10:17:
error: storage size of 'st' isn't known
lib\hssystemfileio-win32.c:11:2:
warning: implicit declaration of function '_wstat64'
cabal-1.20.0.1.exe: Error: some packages failed to install:
system-fileio-0.3.13 failed during the building phase. The exception was:
ExitFailure 1
I tried it on Windows 7.
I just ran into this same problem on Windows 7 with system-fileio-0.3.13, using both the windows command line with Haskell Platform 2013.2.0.0's built-in mingw and also inside msys with a newer mingw64. The problem appears to be caused by a change introduced between system-fileio-0.3.12 and system-fileio-0.3.13. system-fileio's git repo doesn't seem to have a web interface to link to, but 0.3.12's lib\hssystemfileio-win32.c uses:
struct _stat st;
int rc = _wstat(old_path, &st);
while 0.3.13's hssystemfileio-win32.c has changed to:
struct _stat64 st;
int rc = _wstat64(old_path, &st);
Copying 0.3.12's hssystemfileio-win32.c over top of 0.3.13's does seem to allow it to build, though I don't know if it actually functions correctly.
I don't know if this will work for you, but I'm trying to build yesod on Windows 7 (inside a sandbox with an upgraded cabal-install from the one in the Haskell Platform) and I extracted a system-fileio 0.3.13 tarball from Hackage, copied 0.3.12's hssystemfileio-win32.c over, and then did a cabal sandbox add-source ../system-fileio-0.3.13 inside my yesod sandbox. My cabal install of yesod could then proceed and seems to have worked. If you're doing a system install of system-fileio, you probably should be able to just build in the extracted and modified system-fileio-0.3.13 directory directly.
I'm sure someone who knows something about Haskell and cabal will be able to provide a proper solution instead of this hack.

How to install "cryptopp" on Ubuntu 13.10 for Haskell?

When trying to install clckwrks, I get the following error after a couple cabal install tries:
~/Progs/clckwrks/clckwrks$ cabal install
Resolving dependencies...
Configuring happstack-server-tls-7.1.0...
cabal: Missing dependency on a foreign library:
* Missing C library: cryptopp
....
Why can I not find this library in the repositories? Is it the Crypto++ from cryptopp.com? Oddly enough there's no mention of this on the getting started guide at http://clckwrks.com/page/view-page-slug/3/get-started .
Yes, you need to install crypto++. If you'll get the same error after installing this lib, look at this question.
BTW, actually, the problem is in happstack-server-tls, not in clckwrks, so they haven't mentioned it.
Update
On server running you can get error about ssl/localhost.key and ssl/localhost.cer. In this case - look for the answer here.

Cannot install accelerate-cuda in Haskell

I am on a linux box and trying to experiment with Haskell's Accelerate library but having problems installing it. I have successfully installed the accelerate package but there seems to be a dependency problem, which I have detailed below.
cabal: Error: some packages failed to install:
accelerate-cuda-0.14.0.0 depends on haskell-src-exts-1.14.0.1 which failed to
install.
cuda-0.5.1.1 failed during the configure step. The exception was:
ExitFailure 1
haskell-src-exts-1.14.0.1 failed during the configure step. The exception was:
ExitFailure 1
haskell-src-meta-0.6.0.5 depends on haskell-src-exts-1.14.0.1 which failed to
install.
language-c-quote-0.7.6 depends on haskell-src-exts-1.14.0.1 which failed to
install.
I searched SO and noticed someone else had a similiar issue installed the cuda package, and was resolved by adding the cabal bin path to the PATH; I tried this but it didn't solve this problem.
Please could someone help as I really keen to play with this fantastic library.
I wanted to check accelerate-examples and play with them and I also didn't have CUDA GPU (AMD only) and that's how I eventually installed accelerate-examples with stack:
git clone https://github.com/AccelerateHS/accelerate-examples
cd accelerate-examples
#choose version:
ln stack-8.6.yaml stack.yaml
#build without CUDA targeting:
stack build --flag accelerate-examples:-llvm-ptx --flag accelerate-fft:-llvm-ptx
Installation will build all the examples and print the info regarding where they was put.
Might also need to specify GHC libs path with something like: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.stack/programs/x86_64-linux/ghc-8.6.5/lib/ghc-8.6.5/rts/
Also checked that accelerate installs as well the same way but even without specifying any flags (I guess because it doesn't build any programs yet?), but examples are what's fun :)
P.S. You can move llvm-ptx flags to stack.yaml config: change # flags: {} line to:
flags:
accelerate-fft:
llvm-ptx: false
accelerate-examples:
llvm-ptx: false

GTK2HS fails to install with recent cabal versions

I'm starting a new project that will hopefully use gtk2hs. However, I can not get this package to install on my fairly typical Linux box. Here is the failure :
[1 of 2] Compiling SetupWrapper ( /tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs, /tmp/cairo-0.12.4-4201/cairo-0.12.4/dist/dist-sandbox-58b5f9c6/setup/SetupWrapper.o )
/tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:94:45:
Ambiguous occurrence `moreRecentFile'
It could refer to either `SetupWrapper.moreRecentFile',
defined at /tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:149:1
or `Distribution.Simple.Utils.moreRecentFile',
imported from `Distribution.Simple.Utils' at /tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:8:1-32
/tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:95:45:
Ambiguous occurrence `moreRecentFile'
It could refer to either `SetupWrapper.moreRecentFile',
defined at /tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:149:1
or `Distribution.Simple.Utils.moreRecentFile',
imported from `Distribution.Simple.Utils' at /tmp/cairo-0.12.4-4201/cairo-0.12.4/SetupWrapper.hs:8:1-32
Failed to install cairo-0.12.4
[1 of 2] Compiling SetupWrapper ( /tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs, /tmp/glib-0.12.4-4201/glib-0.12.4/dist/dist-sandbox-58b5f9c6/setup/SetupWrapper.o )
/tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:94:45:
Ambiguous occurrence `moreRecentFile'
It could refer to either `SetupWrapper.moreRecentFile',
defined at /tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:149:1
or `Distribution.Simple.Utils.moreRecentFile',
imported from `Distribution.Simple.Utils' at /tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:8:1-32
/tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:95:45:
Ambiguous occurrence `moreRecentFile'
It could refer to either `SetupWrapper.moreRecentFile',
defined at /tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:149:1
or `Distribution.Simple.Utils.moreRecentFile',
imported from `Distribution.Simple.Utils' at /tmp/glib-0.12.4-4201/glib-0.12.4/SetupWrapper.hs:8:1-32
Failed to install glib-0.12.4
It seems to be related to recent cabal versions, since that used to work before. It seems to be a known bug (http://trac.haskell.org/gtk2hs/ticket/1292 , http://trac.haskell.org/gtk2hs/ticket/1291 and http://trac.haskell.org/gtk2hs/ticket/1289), however it has not moved for weeks. I am not sufficiently competent to suggest a good fix, so I would like your advice. This is very annoying since I am stuck on this important project, and it pains me to think that the main GUI lib of our language has been broken for many weeks now.
cabal-install version 1.18.0.2 using version 1.18.1.1 of the Cabal library / ghc 7.4.1
Thanks for your help
The correct solution for now is to build from darcs. Detailed instructions are given in the Getting the latest and greatest section of the installation instructions; the short version is:
darcs get --lazy http://code.haskell.org/gtk2hs
cd gtk2hs
sh bootstrap.sh
EDIT: The official 0.12.5 release of gtk2hs from December 2013 supports cabal 1.18, so the above darcs instructions are no longer needed. The full installation instructions are still available from the Gtk2Hs download page; the short version is:
cabal install gtk2hs-buildtools
cabal install gtk gtk3
You can try with older Cabal version using cabal install --cabal-lib-version=1.16.0 gtk.

Resources