Haskell and postgresql - build error "The program pg_config is required but it could not be found." - postgresql

I am currently learning haskell and just tried using postgresql as a database.
I generated my project with stack (stack new <name> -> stack setup -> stack build)
and then all I changed was adding the dependencies needed to persistent and postgresql to the
package.yaml file (under "dependencies:").
These are:
persistent
persistent-postgresql
persistent-template
This however results in a failing build with the following message:
postgresql-libpq > setup.exe: The program 'pg_config' is required but it could not be found.
postgresql-libpq >
-- While building package postgresql-libpq-0.9.4.2 using:
C:\Users\\AppData\Local\Temp\stack14388\postgresql-libpq-0.9.4.2.stack-work\dist\e626a42b\setup\setup --builddir=.stack-work\dist\e626a42b configure --user --package-db=clear --package-db=global --package-db=C:\sr\snapshots\365a3dde\pkgdb --libdir=C:\sr\snapshots\365a3dde\lib --bindir=C:\sr\snapshots\365a3dde\bin --datadir=C:\sr\snapshots\365a3dde\share --libexecdir=C:\sr\snapshots\365a3dde\libexec --sysconfdir=C:\sr\snapshots\365a3dde\etc --docdir=C:\sr\snapshots\365a3dde\doc\postgresql-libpq-0.9.4.2 --htmldir=C:\sr\snapshots\365a3dde\doc\postgresql-libpq-0.9.4.2 --haddockdir=C:\sr\snapshots\365a3dde\doc\postgresql-libpq-0.9.4.2 --dependency=Cabal=Cabal-2.4.1.0-5rQrtDcYhR2LOcYye7obEr --dependency=Win32=Win32-2.6.1.0 --dependency=base=base-4.12.0.0 --dependency=bytestring=bytestring-0.10.8.2 -f-use-pkg-config --extra-include-dirs=C:\Users\\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include --extra-lib-dirs=C:\Users\\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\lib --extra-lib-dirs=C:\Users\\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\bin --exact-configuration --ghc-option=-fhide-source-paths
Process exited with code: ExitFailure 1
Does anyone know how to resolve this issue and why it even occurs?
Do I have to install postgresql just for being able to run build the project? If so, how would you
do this in production, when the database could basically lie everywhere?

It looks like Haskell is trying to build with the PostgreSQL client shared library libpq.dll and uses pg_config at build time to determine where PostgreSQL is installed and how it was built.
That would mean that you have to install PostgreSQL on the machine where you build Haskell, including the header files, build environment or however it is called by the installer.
For running Haskell you would only need libpq.dll and the dependent shared libraries.

I solved the issue in Ubuntu with the following command:
apt install libpq-dev

Related

Checksum failed 'download/jpegsrc.v8b.tar.gz while installing SDL. How to resolve?

I am trying to install SDL but error with checksum occur:
Building Alien-SDL-1.446
Build option used:
Source code build
z(v1.2.5) jpeg(v8b) tiff(v3.9.1) png(v1.4.1) freetype(v2.3.12) SDL(v1.2.15) SDL_image(v1.2.11) ogg(v1.3.0) vorbis(v1.3.3) SDL_mixer(v1.2.12) SDL_ttf(v2.0.11) SDL_gfx(v2.0.25)
Building Alien-SDL
Fetching 'http://froggs.de/libz/zlib-1.2.5.tar.gz'...
Checking checksum for 'download/zlib-1.2.5.tar.gz'...
Fetching 'http://www.ijg.org/files/jpegsrc.v8b.tar.gz'...
###WARN## checksum for file download/jpegsrc.v8b.tar.gz is 033998fb47d66e1a5e16a51243424be7a172296b but we expect 15dc1939ea1a5b9d09baea11cceb13ca59e4f9df
###ERROR### Checksum failed 'download/jpegsrc.v8b.tar.gz' at inc/My/Builder.pm line 161.
Checking checksum for 'download/jpegsrc.v8b.tar.gz'...
-> FAIL Installing Alien::SDL failed. See /home/kes/.cpanm/work/1634308125.20978/build.log for details. Retry with --force to force install it.
Searching Tie::Simple on mirror index /home/kes/work/projects/SDL/test/local/cache/modules/02packages.details.txt ...
--> Working on Tie::Simple
Fetching http://cpan.metacpan.org/authors/id/H/HA/HANENKAMP/Tie-Simple-1.04.tar.gz
-> OK
How to install SDL?
_build/config_data has the wrong first source set for jpeg v8b. The second source passes the sha1sum, but the first doesn't. If the correct archive is downloaded, the system then hangs up when configuring SDL. SDL_image and SDL_mixer can be manually configured, but SDL_ttf cannot be configured successfully. One should not rely on cpan's sources here. Install all the binary SDL1.2 libraries in a binary distro, also install packages e.g. perl-Alien, libalien-sdl-perl libalien-sdl-dev-perl to have alien installed, and then when it runs the Build.PL for SDL, choose the option to use your own /usr/ libraries (you will see 3 options if it works, choose [1] instead of [2]). Cpan will then succeed with install SDL.
There should be extra instructions with this, that you need to use binary libraries here. Because the script install is super outdated as far as I can tell, if you are running linux that is.

rust-lld: error: unable to find library -lpq

I'm trying to build a simple web app using Yew, Diesel, and Postgres. When I run
wasm-pack build --target web --out-name wasm --out-dir ./static
I get the following error:
*rust-lld: error: unable to find library -lpq*
I'm on macOS Catalina. I installed Postgres through Homebrew. My libpq.dylib file is at /usr/local/lib.
These are the troubleshooting I've tried already:
Added /usr/local/lib to $PATH. My pg_config shows LIBDIR = /usr/local/lib.
Re-installed Postgres
Updated rustc -nightly
Ideas here are not helpful as well: How can I link a Rust Wasm application with libpq via wasm-pack?
Still it is not resolved. I'd be grateful for any suggestions.
Libpq does not support the wasm-web platform as far as I'm aware therefore there is no way to make this work. As already mentioned in the comments you probably want to use diesel in your backend code, not in the frontend.

Installing Tensorflow from source

I've been trying to install Tensorflow and get it working over the past few days. Whilst I have managed to install TF and get it working as tested by opening Python in the terminal and typing,
import tensorflow as tf
I have not been successful attempting to retrain Inception v3. I managed to install it from source once by following the instructions laid out here however I am no longer able to do so. When I get to the section 'Create the pip package and install' and go to run bazel build -c opt //tensorflow/tools/pip_package:build_pip_package in the root of my Tensorflow directiory I get the following error.
kieran#kieranUbuntu:~/tensorflow$ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
ERROR: /home/kieran/tensorflow/tensorflow/core/BUILD:1068:1: no such target '//tensorflow/tools/git:gen/spec.json': target 'gen/spec.json' not declared in package 'tensorflow/tools/git' defined by /home/kieran/tensorflow/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: /home/kieran/tensorflow/tensorflow/core/BUILD:1068:1: no such target '//tensorflow/tools/git:gen/head': target 'gen/head' not declared in package 'tensorflow/tools/git' defined by /home/kieran/tensorflow/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: /home/kieran/tensorflow/tensorflow/core/BUILD:1068:1: no such target '//tensorflow/tools/git:gen/branch_ref': target 'gen/branch_ref' not declared in package 'tensorflow/tools/git' defined by /home/kieran/tensorflow/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'.
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted.
INFO: Elapsed time: 3.063s
This is the same error I ran into when I managed to install it and then attempted retaining the classifier following this tutorial. At the section, bazel build tensorflow/examples/image_retraining:retrain.
I just can't figure out what is going wrong and I have been trying for so long.
I'm using this pip version, # Ubuntu/Linux 64-bit, CPU only, Python 2.7
I think you should search before ask, This link can probably solve your issue.
The issue lied in the incorrect use of ./configure. Whilst it was ran I currently have two versions of python on my computer, both of which are stored in different locations, when running ./configure I pointed it to the wrong python version. After rectifying the issue everything worked correctly.

Hygieia - Creation of dashboard is failing

I'm working no setting up Hygieia dashboard.
Hygieia: https://github.com/gigaaks/Hygieia
Trying both approaches of setting it up locally or using Docker based installation/setup.
I'm successfully able to get mongoDB, it's API, UI modules up and running. Hygieia main login screen comes up fine. I successfully created the login user and able to log in.
At this point, I have mongoDB running, API, UI pieces running and it's time to create a CAP One / Split Dashboard (templates provided by Hygieia). When I provide the values for creating a new dashboard, it's throwing the following error in the API logs on the server (vagrant/VirtualBox instance) OR within the Docker's container.
What I found was there are lots of issues in this project's module where things are not correct i.e. database name in one module is dashboard, in other module it's dashboardb and in other, it's expecting dashboarddb. I fixed those issues in my github repo/project and initiated a pull request which is approved and will be merged. The following error though, tells my that Hygieia's UI piece is NOT sending a parameter what the API piece is expecting while trying to create a dashboard (in mongoDB). The parameter is "type" and as UI (Hygieia GUI) is not sending it (as per their latest code in GitHUB), the API is failing throwing an error saying that type variable value is passed as NULL. I found the same when I tried POST operation by sending the same JSON RestAPI query using Postman.
Due to this, I'm currently not able to create a dashboard and start using the collectors provided by Hygieia out of the box (for Stash, GitHub, Jenkins, SonarQube etc).
Has anyone of you have faced or found a workaround for this error/issue?
2016-04-01 02:40:40,357 WARN c.c.d.rest.RestApiExceptionHandler - Bad Request - bind exception:
org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'dashboardRequest' on field 'type': rejected value [null]; codes dashboardRequest.type,NotNull.type,NotNull.java.lang.String,NotNull]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [dashboardRequest.type,type]; arguments []; default message [type]]; default message [may not be null]
at com.capitalone.dashboard.rest.RestApiExceptionHandler.handleMethodArgumentNotValid(RestApiExceptionHandler.java:55) [api.jar!/:2.0.0-SNAPSHOT]
at org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler.handleException(ResponseEntityExceptionHandler.java:156) [spring-webmvc-4.1.7.RELEASE.jar!/:4.1.7.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_72-internal]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_72-internal]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_72-internal]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_72-internal]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) [spring-web-4.1.7.RELEASE.jar!/:4.1.7.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) [spring-web-4.1.7.RELEASE.jar!/:4.1.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) [spring-webmvc-4.1.7.RELEASE.jar!/:4.1.7.RELEASE]
The issue was coming due to that fact that I used Hygieia modules docker images built locally using Maven (mvn clean install ; mvn docker:build) but for the UI module, as I was getting an error message, I cherry picked that image from captial one/hygieia-ui image. For some reason, it didn't work and was showing the above error (as there could be API level changes).
I had to run the following to get Hygieia dashboard up and running in local machine:
git config --global --unset-all url.https
git config --global url."https://".insteadOf git://
npm config set prefix /usr/local
sudo npm install --color=false; sudo npm install -g bower gulp; sudo npm install bower install
mvn clean install; mvn docker:build
gulp serve
Now, everything is working as expected for creating dashboard (PS: You have to create mongo db database first using mongo command line as shows in Hygieia's documentation).
npm -g option will install bower and gulp globally. without -g, it'll also install the same locally. Global values actually refer the local values.
For docker based solution, I just used docker-comopose file and got it up and running.
NodeJS(node) version: v5.10.0
NPM (Node pkg mgr) : 3.8.3
Bower version : 1.7.9
Gulp version : [08:18:42] CLI version 3.9.1,[08:18:42] Local version 3.9.1,
Maven version : Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
Java version :

Transferring data from postgres to rabbitmq

I am quiet new to rabbitmq and currently trying to install Postgres listen exchange plugin at:
https://github.com/aweber/pgsql-listen-exchange
I tried following the instructions listed there but i am getting following errors:
/bin/sh: escript: command not found
make[1]: *** [deps.mk] Error 127
make: *** [../rabbitmq-server/dist/.done.0.0.0] Error 2
I am currently working on Mac, not sure if it is because of i missing some essential libraries.
If you want just install the plugin you have to:
Download the package here https://github.com/aweber/pgsql-listen-exchange/releases and exactly this https://github.com/aweber/pgsql-listen-exchange/releases/download/0.3.0-v3.5.x/pgsql-listen-exchange-0.3.0-v3.5.x.zip
Extract the zip and copy the files into the rabbitmq plug-in directory, usually this : rabbitmq_server-3.5.4/plugins
After that execute sudo ./rabbitmq-plugins enable pgsql_listen_exchange, and as result you should have:
The following plugins have been enabled:
epgsql
pgsql_listen_exchange
you are trying to rebuild the package, but if you want just use it, you don't need to rebuild it.
hope it helps