Code Monkey home page Code Monkey logo

Comments (9)

ged avatar ged commented on July 23, 2024

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.

from ruby-pg.

ged avatar ged commented on July 23, 2024

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"

from ruby-pg.

ged avatar ged commented on July 23, 2024

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.

from ruby-pg.

ged avatar ged commented on July 23, 2024

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"

from ruby-pg.

ged avatar ged commented on July 23, 2024

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.

from ruby-pg.

ged avatar ged commented on July 23, 2024

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.

from ruby-pg.

ged avatar ged commented on July 23, 2024

Original comment by sl_bug (Bitbucket: sl_bug, ).


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

from ruby-pg.

ged avatar ged commented on July 23, 2024

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. :)

from ruby-pg.

ged avatar ged commented on July 23, 2024

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


Removing component: build-system (automated comment)

from ruby-pg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.