Bundle config for production only? - postgresql

I'm getting an error when deploying my application to CentOS 6.x similar to the following: An error occurred while installing pg (0.17.1), and Bundler cannot continue
I've installed the required libs but am still getting the error.
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/home/exporter/.rbenv/versions/2.1.5/bin/ruby extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
From reading around it seems like I need to add --with-pg-config=/path/to/pg_config. I can easily do this by configuring bundler to install with the flag:
bundle config build.pg --with-pg-config=/usr/pgsql-9.4/bin/pg_config
But how can I do this without affecting my local dev environment? The /path/to/pg_config will be different for my production environment and my local dev environment.

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.

Why am I getting a load error during pod init in Xcode?

Im building a social media app using Xcode. After running pod init im getting the error-
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in 'require': cannot load such file -- concurrent/executor/cached_thread_pool (LoadError)`
I've tried running sudo gem install concurrent executor cached thread pool with this result
**Building native extensions. This could take a while...
ERROR: Error installing concurrent:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/concurrent-0.2.2/ext/concurrent/futures
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20200311-6507-4x4g6z.rb extconf.rb
creating Makefile
current directory: /Library/Ruby/Gems/2.6.0/gems/concurrent-0.2.2/ext/concurrent/futures
make "DESTDIR=" clean
current directory: /Library/Ruby/Gems/2.6.0/gems/concurrent-0.2.2/ext/concurrent/futures
make "DESTDIR="
compiling futures.c
In file included from futures.c:10:
/Users/davidstreet/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/ruby/backward/rubysig.h:14:2: warning: rubysig.h is obsolete [-W#warnings]
#warning rubysig.h is obsolete
^
futures.c:11:10: fatal error: 'intern.h' file not found
#include "intern.h"
^~~~~~~~~~
1 warning and 1 error generated.
make: *** [futures.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/concurrent-0.2.2 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/concurrent-0.2.2/gem_make.out
Successfully installed executor-0.0.1
Parsing documentation for executor-0.0.1
Done installing documentation for executor after 0 seconds
Successfully installed cached-0.2
Parsing documentation for cached-0.2
Done installing documentation for cached after 0 seconds
Successfully installed thread-0.2.2
Parsing documentation for thread-0.2.2
Done installing documentation for thread after 0 seconds
Successfully installed pool-0.0.1
Parsing documentation for pool-0.0.1
Done installing documentation for pool after 0 seconds
4 gems installed
davidstreet#Davids-MacBook-Pro lnc.xcodeproj %**
I'm new to app development so any help would be awesome. Could anyone tell me if this is a bug I could download a pre-release and work around?
Use these command
gem install thread
And
gem install pool
Hope this will be useful

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

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

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

Installing do_postgres on MacOS

I'm fully at a loss here. I have `dm-postgres-adapter' in my gem file, and it's causing me a lot of headaches.
When I run bundle install on a small app before pushing to heroku, I'm met with this:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for main() in -lpq... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for postgres.h... yes
checking for mb/pg_wchar.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-pgsql-server-dir
--without-pgsql-server-dir
--with-pgsql-server-include
--without-pgsql-server-include=${pgsql-server-dir}/include
--with-pgsql-server-lib
--without-pgsql-server-lib=${pgsql-server-dir}/
--with-pgsql-client-dir
--without-pgsql-client-dir
--with-pgsql-client-include
--without-pgsql-client-include=${pgsql-client-dir}/include
--with-pgsql-client-lib
--without-pgsql-client-lib=${pgsql-client-dir}/
--with-pqlib
--without-pqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/do_postgres-0.10.14 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/do_postgres-0.10.14/ext/do_postgres/gem_make.out
An error occurred while installing do_postgres (0.10.14), and Bundler cannot continue.
Make sure that `gem install do_postgres -v '0.10.14'` succeeds before bundling.
I've spent the last couple of hours stumbling around the internet, so I'll list what I've tried to no avail:
Completely reinstalling postgresql through brew.
run with --with-pg-config=PATH (or something similar)
Add postgres to my path
soft linking gcc to gcc4.2
I know where mb/pg_wchar.h is located. It's in /usr/local/Cellar/postgresql/9.3.4/include/server/mb/pg_wchar.h/ right there. I've tried most of the options it lists with usr/local/Cellar/postgresql/9.3.4/include/server/, but none of the ones I've tried have worked. I think it's worth noting that postgres.h is located in the same directory as mb/pg_wchar.h, in the /server/ folder.
If anyone could possibly shed some light on this, that would be great.