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

[DEV-13] postgres mojave update #11

Merged
merged 5 commits into from
Nov 13, 2018
Merged

[DEV-13] postgres mojave update #11

merged 5 commits into from
Nov 13, 2018

Conversation

jsnb
Copy link
Contributor

@jsnb jsnb commented Oct 19, 2018

I'm doing a dev environment set up on a new laptop with OSX Mojave
The postgres install failed with the following error:

configure: error: header file <perl.h> is required for Perl

After some googling I found this solution that worked:

brew install cloverhealth/tap/postgresql --without-perl

Not sure if it matters for high sierra or not. Anyone with brew skills know what the best practice is here? Maybe this shouldn't be updated? Maybe it should be updated in the Makefile? Or directly in the postgres formula?

@jsnb jsnb requested review from rawrgrr, 6C1 and jiffyclub October 19, 2018 16:45
@jiffyclub
Copy link
Contributor

I suspect we need to copy over this section of the 9.6 recipe from Homebrew: https://github.com/Homebrew/homebrew-core/blob/master/Formula/[email protected]#L87-L101

    # As of Xcode/CLT 10.x the Perl headers were moved from /System
    # to inside the SDK, so we need to use `-iwithsysroot` instead
    # of `-I` to point to the correct location.
    # https://www.postgresql.org/message-id/153558865647.1483.573481613491501077%40wrigleys.postgresql.org
    if DevelopmentTools.clang_build_version >= 1000
      inreplace "configure",
                "-I$perl_archlibexp/CORE",
                "-iwithsysroot $perl_archlibexp/CORE"
      inreplace "contrib/hstore_plperl/Makefile",
                "-I$(perl_archlibexp)/CORE",
                "-iwithsysroot $(perl_archlibexp)/CORE"
      inreplace "src/pl/plperl/GNUmakefile",
                "-I$(perl_archlibexp)/CORE",
                "-iwithsysroot $(perl_archlibexp)/CORE"
    end

@jiffyclub
Copy link
Contributor

This section also seems relevant: https://github.com/Homebrew/homebrew-core/blob/master/Formula/[email protected]#L108-L123

    # Temporarily disable building/installing the documentation.
    # Postgresql seems to "know" the build system has been altered and
    # tries to regenerate the documentation when using `install-world`.
    # This results in the build failing:
    #  `ERROR: `osx' is missing on your system.`
    # Attempting to fix that by adding a dependency on `open-sp` doesn't
    # work and the build errors out on generating the documentation, so
    # for now let's simply omit it so we can package Postgresql for Mojave.
    if DevelopmentTools.clang_build_version >= 1000
      system "make", "all"
      system "make", "-C", "contrib", "install", "all", *dirs
      system "make", "install", "all", *dirs
    else
      system "make", "install-world", *dirs
    end
  end

@jsnb jsnb changed the title postgres install without perl postgres mojave update Oct 23, 2018
postgresql.rb Outdated
"pkglibdir=#{lib}/postgresql"
end

def post_install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this might have accidentally removed this post_install function? https://github.com/Homebrew/homebrew-core/blob/master/Formula/[email protected]#L125-L131

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! 😟
this kind of got away from me. it didn't work -- maybe this was the problem

@rawrgrr
Copy link
Contributor

rawrgrr commented Oct 31, 2018

I'm planning on upgrading later this week. Will give this a try when I run into the issue!

@jsnb
Copy link
Contributor Author

jsnb commented Nov 1, 2018

I'm going through the manual steps but using this command to install the tap version
brew install --build-from-source ./code/homebrew-tap/postgresql.rb
im getting an error on initdb
could not access file "$libdir/ascii_and_mic"
I'm working on debugging it when I have some free time. I'm able to see the ascii_and_mic.so file in the libdir so not sure how that is cropping up.

@alyssawhitwell
Copy link

Related to general dev setup makefile PR: https://github.com/CloverHealth/documentation/pull/1033/

@rawrgrr
Copy link
Contributor

rawrgrr commented Nov 12, 2018

/cc @alyssawhitwell, @kirk-clover for context relating to Makefile setup

@alyssawhitwell alyssawhitwell changed the title postgres mojave update [DEV-13] postgres mojave update Nov 13, 2018
@kirk-clover
Copy link
Contributor

Is there any need for perl support?

When I ran into this problem myself, I found this:
petere/homebrew-postgresql#41 (comment)

After editing the formula locally, I believe it installed correctly.

@jiffyclub jiffyclub force-pushed the postgres-without-perl branch from b3d28fa to be0d8ac Compare November 13, 2018 21:37
@jiffyclub
Copy link
Contributor

jiffyclub commented Nov 13, 2018

I've updated this by copying over Postgres 9.6 installation file from https://github.com/Homebrew/homebrew-core/blob/master/Formula/[email protected]. It seems to already handle building on Mojave. I made minor edits to remove the @9.6 aspect of the installation, this should install as plain Postgres. This also updates us to Postgres 9.6.10.

I tested this by running:

> brew services stop postgresql
> brew uninstall postgis
> brew uninstall postgresql
> brew install postgresql  # installs 10.5
> brew unlink postgresql
> brew install --build-from-source ./code/homebrew-tap/postgresql.rb
> brew install --build-from-source ./code/homebrew-tap/postgis.rb
> brew services start postgresql

It seems to work, but I'm not running Mojave:

> pgcli postgresql://[email protected]:5432/postgres
Server: PostgreSQL 9.6.10

@jiffyclub jiffyclub merged commit 16eef53 into master Nov 13, 2018
@jiffyclub jiffyclub deleted the postgres-without-perl branch November 13, 2018 21:56
@kirk-clover
Copy link
Contributor

Was the bump from 9.6.8 to 9.6.10 intentional?

jiffyclub added a commit that referenced this pull request Nov 14, 2018
This reverts commit 16eef53.

Postgis doesn't correctly install against this postgres installation
so reverting for now.
jiffyclub added a commit that referenced this pull request Nov 14, 2018
This reverts commit 16eef53.

Postgis doesn't correctly install against this postgres installation
so reverting for now.
--datadir=#{HOMEBREW_PREFIX}/share/postgresql
--libdir=#{HOMEBREW_PREFIX}/lib
--sysconfdir=#{etc}
--datadir=#{pkgshare}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if this change is causing the problem... What is pkgshare set to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants