Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.10.0 build failed on mac os #53

Closed
ged opened this issue Dec 2, 2010 · 9 comments
Closed

0.10.0 build failed on mac os #53

ged opened this issue Dec 2, 2010 · 9 comments

Comments

@ged
Copy link
Owner

ged commented Dec 2, 2010

Original report by sl_bug (Bitbucket: sl_bug, ).


log:

ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

/Users/user/.rvm/rubies/ruby-head/bin/ruby extconf.rb
checking for pg_config... yes
Ruby cflags: " -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long  -fno-common -pipe"
MacOS X build: fixing architecture flags:
  finding flags common to both Ruby and PostgreSQL...

*** Your PostgreSQL installation doesn't seem to have an architecture in common with the running ruby interpreter (["ppc", "i386", "x86_64"] vs. [])
I'll continue anyway, but if it fails, try setting ARCHFLAGS.
  testing for architecture: "ppc"
  testing for architecture: "i386"
  testing for architecture: "x86_64"
checking for libpq-fe.h... *** 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=/Users/user/.rvm/rubies/ruby-head/bin/ruby
        --with-pg
        --without-pg
        --with-pg-config
        --without-pg-config
        --with-pg-dir
        --without-pg-dir
        --with-pg-include
        --without-pg-include=${pg-dir}/include
        --with-pg-lib
        --without-pg-lib=${pg-dir}/lib
/Users/user/.rvm/rubies/ruby-head/lib/ruby/1.9.1/mkmf.rb:367:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /Users/user/.rvm/rubies/ruby-head/lib/ruby/1.9.1/mkmf.rb:480:in `try_cpp'
        from /Users/user/.rvm/rubies/ruby-head/lib/ruby/1.9.1/mkmf.rb:944:in `block in find_header'
        from /Users/user/.rvm/rubies/ruby-head/lib/ruby/1.9.1/mkmf.rb:764:in `block in checking_for'
        from /Users/user/.rvm/rubies/ruby-head/lib/ruby/1.9.1/mkmf.rb:279:in `block (2 levels) in postpone'
        from /Users/user/.rvm/rubies/ruby-head/lib/ruby/1.9.1/mkmf.rb:253:in `open'
        from /Users/user/.rvm/rubies/ruby-head/lib/ruby/1.9.1/mkmf.rb:279:in `block in postpone'
        from /Users/user/.rvm/rubies/ruby-head/lib/ruby/1.9.1/mkmf.rb:253:in `open'
        from /Users/user/.rvm/rubies/ruby-head/lib/ruby/1.9.1/mkmf.rb:275:in `postpone'
        from /Users/user/.rvm/rubies/ruby-head/lib/ruby/1.9.1/mkmf.rb:763:in `checking_for'
        from /Users/user/.rvm/rubies/ruby-head/lib/ruby/1.9.1/mkmf.rb:943:in `find_header'
        from extconf.rb:123:in `<main>'

everything was ok in 0.9.0 pg gem.

@ged
Copy link
Owner Author

ged commented Dec 2, 2010

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


Can you also attach or paste your mkmf.log? That will have the specifics as to why it can't find the libpq-fe.h header.

Thanks!

PS: while I do all of my development on a Mac, I haven't tested this under 1.9.1 since 1.9.2 came out. I doubt that's the issue, however.

@ged
Copy link
Owner Author

ged commented Dec 2, 2010

Original comment by sl_bug (Bitbucket: sl_bug, ).


i don't know why 1.9.1 in path, but i use ruby 1.9.3

ruby -v output:

ruby 1.9.3dev (2010-11-20 trunk 29843) [x86_64-darwin10.5.0]

P.S. using ruby 1.9.2 i got same error. and strange 1.9.1 in path too - "/Users/user/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/mkmf.rb"

@ged
Copy link
Owner Author

ged commented Dec 2, 2010

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


Oh, right, I forgot that 1.9.2 uses the 1.9.1 library path; I don't know why, but that's normal. Thanks for the log.

@ged
Copy link
Owner Author

ged commented Dec 2, 2010

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


I think the problem is that your libpq is compiled as a universal binary (with three architectures) and your Ruby is compiled without at least one of them. If you do a file which ruby``, it should show which architectures your Ruby supports, and you'll have to either reinstall PostgreSQL with only those architectures, or your Ruby with all three that your Postgres supports.

For example, my system Ruby says:

$ file `which ruby`
/usr/bin/ruby: Mach-O universal binary with 3 architectures
/usr/bin/ruby (for architecture x86_64):	Mach-O 64-bit executable x86_64
/usr/bin/ruby (for architecture i386):	Mach-O executable i386
/usr/bin/ruby (for architecture ppc7400):	Mach-O executable ppc

while my rvm-installed 1.9.2 says:

$ rvm 1.9.2
$ file `which ruby`
[...]/.rvm/rubies/ruby-1.9.2-p0/bin/ruby: Mach-O 64-bit executable x86_64

The clue is in the linker phase from the mkmkf.log:

lipo: can't figure out the architecture type of: /var/folders/DR/DR5qjIGGEWiVOvkRtZ5u3E+++TI/-Tmp-//ccqYG1Im.out
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

That's why I put that warning in the extconf that says:

*** Your PostgreSQL installation doesn't seem to have an architecture in 
common with the running ruby interpreter (["ppc", "i386", "x86_64"] vs. [])
I'll continue anyway, but if it fails, try setting ARCHFLAGS.
  testing for architecture: "ppc"
  testing for architecture: "i386"
  testing for architecture: "x86_64"

@ged
Copy link
Owner Author

ged commented Dec 2, 2010

Original comment by sl_bug (Bitbucket: sl_bug, ).


I haven't compiled postgres by myself, i downloaded binary. seems like only one way to fix it is compile ruby as universal binary or set ARCHFLAGS='-arch x86_64' before installing pg gem.

@ged
Copy link
Owner Author

ged commented Dec 2, 2010

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


Even setting the architecture yourself won't work, as it won't be able to link completely due to the missing architectures. If you want to use the installation of PostgreSQL you're currently using, the only way (that I know of) is, as you say, to compile Ruby with the same three architectures that your Postgres supports.

@ged ged closed this as completed Dec 2, 2010
@ged
Copy link
Owner Author

ged commented Dec 2, 2010

Original comment by sl_bug (Bitbucket: sl_bug, ).


setting archflags helped. at least gem installed successfully and it works.

@ged
Copy link
Owner Author

ged commented Dec 2, 2010

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


Oh, good! I didn't think you could link that way, but I stand corrected. Thanks for trying, and especially for reporting that it worked. :)

@ged
Copy link
Owner Author

ged commented Apr 19, 2011

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


Removing component: build-system (automated comment)

@ged ged added this to the Pending milestone Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant