Postgresql fails to install #13022

Closed
erskingardner opened this Issue Jun 25, 2012 · 30 comments

Projects

None yet
@erskingardner

I'll get the basics out of the way first.

☺  brew update                                                                    1.9.3-p125
Updated Homebrew from 523641bb to c2373edf.

~
☺  brew outdated                                                                  1.9.3-p125

~
☺  brew doctor                                                                    1.9.3-p125
Your system is raring to brew.
☺  brew --config                                                                  1.9.3-p125
HOMEBREW_VERSION: 0.9
HEAD: c2373edff26833d138ecf70e036c679ef1d04166
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit dunno
OS X: 10.7.4
Kernel Architecture: x86_64
Xcode: 4.3.3, CLT 4.3.0.0.1.1249367152
GCC-4.0: N/A
GCC-4.2: N/A
LLVM: build 2336
Clang: 3.1 build 318
MacPorts or Fink? false
X11: /usr/X11
System Ruby: 1.8.7-357
Which Perl:   /usr/bin/perl
Which Python: /usr/bin/python
Which Ruby:   /Users/jeff/.rbenv/shims/ruby
~
☺  brew --env                                                                     1.9.3-p125
CC: /usr/bin/clang
CXX: /usr/bin/clang++ => /usr/bin/clang
LD: /usr/bin/clang
CFLAGS: -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include
CXXFLAGS: -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include
CPPFLAGS: -isystem /usr/local/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include
LDFLAGS: -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -L/usr/local/lib
MACOSX_DEPLOYMENT_TARGET: 10.7
MAKEFLAGS: -j4

Link to full verbose output of failed install: https://gist.github.com/2991316

I'm on a brand new mid-2012 MacBook Air. I've installed xcode 4.3.3 (with command line tools). Other brews are going fine, it just seems to be postgres that doesn't like me.

I've looked at the issue mentioned at the end of the failure and that is something different. I've also installed gcc-4.2 from homebrew/dupes in the hopes that that might help as well - no love. Strange that brew --config isn't showing gcc-4.2 even though it's clearly installed:

~
☺  which gcc-4.2                                                                  1.9.3-p125
/usr/local/bin/gcc-4.2

~
☺  which gcc                                                                      1.9.3-p125
/usr/bin/gcc

I've restarted a few times throughout this process, the most recent time just after installing gcc-4.2. Any help would be greatly appreciated.

@gbuesing

I'm getting the exact same error. Brand new 2012 Air -- I installed XCode and command line tools, and then Homebrew.

@nickbauman

I have the same problem. I tried everything posted on

#11759

to no avail. Even downgraded my recipe to 9.1.3. No dice. Is this XCode / clang issue?

/usr/bin/gcc -v

gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)

@adamv

@erskingardner Do you have coreutils installed? Where is gmkdir coming from?

@gbuesing

@adamv fwiw, I just did "brew install coreutils" and tried to install postgres again -- got the same error.

@adamv

@gbuesing I'm not suggesting that coreutils be installed. I see failures in the original poster's install log refering to /usr/local/bin/gmkdir.

@adamv

NOTE: If you have "me too"'ed this thread, but have not gisted your own install failure and brew doctor, you'll need to gist your output as well.

@2bits

@samueljohn, this might be related to your PR.

After running brew update myself, I can reproduce this on Lion 10.7.4 without coreutils and with XCode-4.3.3 + CLT from within XCode Preferences using no command line options, just brew install -vd postgresql.

Homebrew had a significant update yesterday. One consequence of that is the -mmacosx-version-min=10.7 we can see in the compile log. If the PGS source code use API from 10.6, then our setting it to 10.7 will break things. The -I and -L paths would not cause this error. Too busy to test my theory atm.

@nickbauman

I have "me too"'ed this thread. My gist is here:

https://gist.github.com/2990761

@2bits confirms my situation

@adamv

Probably we're trying to link against /usr/lib/libpgtypes and similar that are present in Lion, and weren't trying to do that before, per the -I and -L changes.

@gbuesing

Gist of install failure: https://gist.github.com/5ac02b71464619aef33c

brew doctor reports "Your system is raring to brew."

@samueljohn

The clean solution would be to call ENV.macosxsdk 10.6 for a formula that needs -mmacosx-version-min=10.6. I just got up and will look into these issues today.

@erskingardner

Probably shouldn't have gone to sleep straight after posting this...

@adamv Yes, coreutils is installed. Looks like gmkdir was installed by coreutils:

☺  which gmkdir                                                    1.9.3-p125 master c2373ed
/usr/local/bin/gmkdir

lrwxr-xr-x 1 jeff admin 35 Jun 25 15:00 gmkdir -> ../Cellar/coreutils/8.17/bin/gmkdir

Thanks for the responses everyone. @samueljohn, let me know if I can help in any way.

@2bits

I tried ENV.remove_from_cflags '-mmacosx-version-min=10.7' and got the exact same error.
I tried ENV.macosxsdk 10.6 but there's a configure error with Python: MACOS_DEPLOYMENT_TARGET mismatch
I tried ENV.macosxsdk 10.6 and brew install --no-python postgresql and it worked.

So we are getting somewhere. Thanks for looking into this.

@erskingardner

@2bits do you suggest that as a way to install it or will there be a more "normal" brew install for postgres coming? I'm not super pressed to have postgres running immediately and I don't want to do any installs that are going to be messy to keep upgraded.

@2bits

I figure the formula will get adjusted in the next day or two, once @samueljohn considers the issues. It'll be easier for you to wait if you have the time. Thankfully it's a short compile, but there are a lot of options to test.

@erskingardner

👍 thanks for all the help.

@Gilead

I had the same error and I confirm that after adding 'ENV.macosxsdk 10.6' to /usr/local/Library/Formula/postgresql.rb at line 30 (right after 'def install') 'brew install --no-python postgresql' managed to install postgresql just fine. Thanks @2bits :)

@samueljohn

It's good to hear that the clean solution to use the appropriate macosxsdk works as intended. We have added this ENV.macosxsdk function, because it is necessary for Xcode-only installs.

On default ENV.macosxsdk is set to your OS X version. So, yes, there might be formulae, which need adjustments like this. But I think it is a good think to state it explicitly when a formula needs an older SDK.

@samueljohn

I hope to address remaining issues with #13037 but it looks like explicitly stating the ENV.macosxsdk 10.6 does the trick for this one.

@ficho

Thanks for your help all this just solved my issue, postgresql installed!

@gbuesing

I can also confirm that the solution found by @2bits works -- postgresql installed successfully. Thanks everyone for your help!

@2bits

On my system, the changes @samueljohn is making in #13037 fixed Postgresql.

After it gets pulled, we can likely leave the PGS formula unchanged, as long as it works for everyone else.

@kibaekr

The ENV.macosxsdk 10.6 solution just worked on my brand new Retina MBP. But "initdb /usr/local/var/postgres" doesn't work but I'm guessing that's a different issue

@kibaekr

@gbuesing Yes that solved it! Thank you!

@safarista

New to this but could you elaborate what adding that line looks like please?

Am "thinking" adding that line will look like below:

  def install
    ENV.libxml2 if MacOS.snow_leopard?
    ENV.macosxsdk 10.6
    ...

But my mind keeps telling me I should try:

  def install
    ENV.libxml2 if ENV.macosxsdk 10.6
    ...

Am I missing something?

@safarista

Ok so the first one is the correct one. I was just being silly I guess the all-nighter's not doing me any good. Tried brew update but guess my system needs some restart before I retire to bed. Thanks ya'll

@jgarth

@safarista +1 the first one you suggested works for me! Thanks everybody!

@adamv

Please brew update and try again; we've pulled #13037.

@adamv adamv closed this Jun 27, 2012
@samueljohn

Anyone who brew pulled #13037 already, you'll probably have to

cd `brew --prefix`
git reset --hard b0cc25007a9eb3e8b5409e3bbd6932611e3c9f94
brew update

because the fix is now in homebrew's master.

However, if the ENV.macosxsdk 10.6 is still needed has to be checked, still. On Xcode-only systems this may very well be the case. If so, we perhaps need to update postgresql.

@xu-cheng xu-cheng locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.