Homebrew- impossible to install postgresql - ruby-on-rails

I am stuck in the installation process of pg, making circles with the same issues, and couldn't resolve them.
I brew install libpq, then brew install openssl#1.1 then pg, and the exit error goes back to ask me to reinstall OpenSSL.
I have several Rails projects where PG used to work fine. I updates homebrew a few days ago and my configuration is a total mess.
My system is Mac OS Mojave 10.14.6. What do you advise to clean and start again with a proper configuration? (I am far from being a command line expert..)
Thanks for all recommendations!
Here is the mkmf.log I get when the installation of pg fails:
find_executable: checking for pg_config... -------------------- no
--------------------
checking for libpq per pkg-config... -------------------- no
"pkg-config --exists libpq"
| pkg-config --libs libpq
=> "-lpq\n"
"clang -fdeclspec -o conftest -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/x86_64-darwin18 -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0 -I. -I/Users/rougnaux/.rbenv/versions/3.0.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -fstack-protector-strong -L/usr/local/lib -lruby.3.0 "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
"clang -fdeclspec -o conftest -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/x86_64-darwin18 -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0 -I. -I/Users/rougnaux/.rbenv/versions/3.0.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -L. -L/Users/rougnaux/.rbenv/versions/3.0.0/lib -fstack-protector-strong -L/usr/local/lib -lruby.3.0 -lpq "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
| pkg-config --cflags-only-I libpq
=> "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr/local/include\n"
| pkg-config --cflags-only-other libpq
=> "\n"
| pkg-config --libs-only-l libpq
=> "-lpq\n"
package configuration for libpq
incflags: -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr/local/include
cflags:
ldflags:
libs: -lpq
--------------------
find_header: checking for libpq-fe.h... -------------------- no
"clang -E -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/x86_64-darwin18 -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0/ruby/backward -I/Users/rougnaux/.rbenv/versions/3.0.0/include/ruby-3.0.0 -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.Internal.sdk/usr/local/include -I/Users/rougnaux/.rbenv/versions/3.0.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -fno-common -pipe conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'libpq-fe.h' file not found
#include <libpq-fe.h>
^~~~~~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */

have you tried using an installed instead? https://www.postgresql.org/download/

Related

Rails postresql installation issue

Hi folks, I have a problem when I try to install the postgresql, it is about a project, first I install the postgresql, then I write: sudo bundle install and it gives me this error and I cannot run the project because of it:
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.20.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/pg-0.20.0 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.20.0/gem_make.out
Below is the code from the file: mkmf.log
nd_executable: checking for pg_config... -------------------- yes
/usr/lib/ruby/2.3.0/mkmf.rb:1547: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
--------------------
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"gcc -o conftest -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -L. -L/usr/lib/x86_64-linux-gnu -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby-2.3 -Wl,-rpath, -lpthread -lgmp -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
find_header: checking for libpq-fe.h... -------------------- no
"gcc -E -I/usr/include/x86_64-linux-gnu/ruby-2.3.0 -I/usr/include/ruby-2.3.0/ruby/backward -I/usr/include/ruby-2.3.0 -I. -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC conftest.c -o conftest.i"
conftest.c:3:22: fatal error: libpq-fe.h: No such file or directory
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */
--------------------

Gem install fails on windows. mkmf.log cannot find -lX11

I am trying to install rmagick gem on for my rails framework.
I have installed imagemagick and set lib and include path in system variables
But when installing gem install rmagick -- '--with-opt-dir="c:\RailsInstaller\ImageMagick-6.7.9-Q8"' i still get errors.
gem command
C:\sites\redmine> gem install rmagick -- '--with-opt-dir="c:\RailsInstaller\ImageMagick-6.7.9-Q8"'
gem.bat : ERROR: While executing gem ... (OptionParser::InvalidOption)
At line:1 char:4
+ gem <<<< install rmagick -- '--with-opt-dir="c:\RailsInstaller\ImageMagick-6
.7.9-Q8"'
+ CategoryInfo : NotSpecified: (ERROR: While e...:InvalidOption)
:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
invalid option: --with-opt-dir=c:\RailsInstaller\ImageMagick-6.7.9-Q8
mkmf.log file says
assert_minimum_ruby_version!: checking for Ruby version >= 1.8.5... -------------------- yes
--------------------
"gcc -o conftest.exe -IC:/RailsInstaller/Ruby2.1.0/include/ruby-2.1.0/i386-mingw32 -IC:/RailsInstaller/Ruby2.1.0/include/ruby-2.1.0/ruby/backward -IC:/RailsInstaller/Ruby2.1.0/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LC:/RailsInstaller/Ruby2.1.0/lib -L. -lCORE_RL_magick_ -lX11 -lmsvcrt-ruby210 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
c:/railsinstaller/devkit/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lCORE_RL_magick_
c:/railsinstaller/devkit/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lX11
collect2.exe: error: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7: return 0;
8: }
/* end */
From log it is clear that devkit is not able to locate ImageMagick
But i have set it PATH = C:\RailsInstaller\ImageMagick-6.7.9-Q8
Have you considered developing with nitrous io? Developing rails in windows is much harder because there are a lot of errors you have to deal with that others don't and there's not a whole lot of documentation/support. Most answers boil down to something like "windows and rails don't mix".

bundle install fails installing ruby-oci8 on osx 10.9

I ran 'bundle install' with ruby 2.0 and when it gets to the ruby-oci8 gem it fails.
"xcrun clang -o conftest -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin13 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -I/opt/oracle_11_2/instantclient_11_2/rdbms/public conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L. -L/usr/local/lib -arch x86_64 -arch i386 -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L/opt/oracle_11_2/instantclient_11_2/lib -lclntsh -lruby.2.0.0 -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L/opt/oracle_11_2/instantclient_11_2/lib -lclntsh -lpthread -ldl -lobjc "
conftest.c:7:29: error: too few arguments to function call, expected 5, have 0
int t(void) { OCIInitialize(); return 0; }
~~~~~~~~~~~~~ ^
/opt/oracle_11_2/instantclient_11_2/rdbms/public/ociap.h:7085:1: note: 'OCIInitialize' declared here
sword OCIInitialize (ub4 mode, void *ctxp,
How do I fix this?
turns out I had the 32 bit instead of the 64 bit oracle instantclient

Problems while installing pg gem

I need to install pg gem, but the installation failed. I've tried all the solution propesed in other questions but no luck.
Here is my output, and here is my "mkmf.log" file
Any idea?
[UPDATE]
I've solved the first problem by putting libs in the correct directory. But now I've another problem:
find_executable: checking for pg_config... -------------------- yes
--------------------
"gcc -o conftest -I/usr/include/ruby-1.9.1/i686-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -I/usr/include/postgresql -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby-1.9.1-static -lpthread -lrt -ldl -lcrypt -lm -lc"
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
[UPDATE2]
Solved it by putting links to "libgcc", "libgcc_s", "crtend.o", "crtendS.o", "crtbeginS.o" and "crtbegin.o" into /usr/lib
It looks like you are missing development libraries even for glibc. Just install devel packages for glibc and postgresql and try again.

Rails 2.3.8 won't run on Passenger after upgrade to Ruby EE - iconv error

I just installed Ruby EE 11.01. I had a Rails 2.3.8 application that was running against Passenger 3.0.2 on Apache2. Now, my application will not come up. The error is:
no such file to load -- iconv
I am on Mac OS X 10.6.4. I installed Ruby EE with:
sudo ./installer -c --with-openssl-dir=/opt/local -c --with-readline-dir=/opt/local -c --with-iconv-dir=/opt/local
"which iconv" yields:
/opt/local/bin/iconv
Attempting to install gem iconv yields:
Building native extensions. This could take a while...
ERROR: Error installing iconv:
ERROR: Failed to build gem native extension.
/opt/ruby-enterprise-1.8.7-2011.01/bin/ruby extconf.rb
checking for iconv() in iconv.h... no
checking for iconv() in -liconv... 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.
is my iconv path wrong in the install line? Help!
EDIT:
Looking in the log file above I see this:
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { void ((*volatile p)()); p = (void ((*)()))iconv; return 0; }
/* end */
"gcc -o conftest -I. -I/opt/ruby-enterprise-1.8.7-2011.01/lib/ruby/1.8/i686-darwin10.4.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -O2 -pipe -fno-common conftest.c -L. -L/opt/ruby-enterprise-1.8.7-2011.01/lib -L. - lruby-static -ldl -lobjc "
conftest.c: In function 't':
conftest.c:5: error: too few arguments to function 'libiconv'
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { iconv(); return 0; }
/* end */
--------------------
have_library: checking for iconv() in -liconv... -------------------- no
"gcc -o conftest -I. -I/opt/ruby-enterprise-1.8.7-2011.01/lib/ruby/1.8/i686-darwin10.4.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -O2 -pipe -fno-common conftest.c -L. -L/opt/ruby-enterprise-1.8.7-2011.01/lib -L. - lruby-static -liconv -ldl -lobjc "
Undefined symbols:
"_libiconv", referenced from:
_t in ccxx7BhR.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { void ((*volatile p)()); p = (void ((*)()))iconv; return 0; }
/* end */
"gcc -o conftest -I. -I/opt/ruby-enterprise-1.8.7-2011.01/lib/ruby/1.8/i686-darwin10.4.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -O2 -pipe -fno-common conftest.c -L. -L/opt/ruby-enterprise-1.8.7-2011.01/lib -L. - lruby-static -liconv -ldl -lobjc "
conftest.c: In function 't':
conftest.c:5: error: too few arguments to function 'libiconv'
checked program was:
/* begin */
1: #include <iconv.h>
2:
3: /*top*/
4: int main() { return 0; }
5: int t() { iconv(); return 0; }
/* end */
--------------------
I highly recommend using RVM on Mac OS. It's extremely easy to install and it handles downloading and compiling the environment with readline, iconv, openssl, zlib, etc. I can't tell you how many hours it's saved me.
http://rvm.beginrescueend.com/
Back to your question - did you try gem install iconv -- --with-iconv-dir=/opt/local ?

Resources