h3-pg icon indicating copy to clipboard operation
h3-pg copied to clipboard

Cannot create extension h3 in Postgres.app after building from source

Open psparrow opened this issue 1 year ago • 5 comments

I'm not sure if this is a Postgres.app issue or an h3-pg issue.

  • cmake build/install is successful
  • h3 shows in list of available postgres extensions
  • creating the extension yields a "No such file or directory" error
Screenshot 2024-09-27 at 3 03 00 PM

psparrow avatar Sep 27 '24 19:09 psparrow

@zachasme I think I figured out the difference between building manually and building with pgxn.

pgxn generates a .so file and make on the source directory generates a .dylib file.

Output from make install on source

cmake --install build --component h3-pg
-- Install configuration: "Release"
-- Installing: /Applications/Postgres.app/Contents/Versions/17/lib/postgresql/h3.dylib
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3.control
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--unreleased.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--0.1.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--0.1.0--0.2.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--0.2.0--0.3.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--0.3.0--0.3.1.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--0.3.1--0.3.2.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--0.3.2--0.4.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--0.4.0--1.0.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--1.0.0--1.0.1.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--1.0.1--1.0.2.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--1.0.2--1.0.3.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--1.0.3--1.0.4.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--1.0.4--1.0.5.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--1.0.5--1.0.6.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--1.0.6--3.4.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.4.0--3.4.1.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.4.1--3.5.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.5.0--3.6.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.6.0--3.6.1.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.6.1--3.6.2.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.6.2--3.6.3.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.6.3--3.6.4.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.6.4--3.6.5.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.6.5--3.7.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.7.0--3.7.1.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.7.1--3.7.2.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--3.7.2--4.0.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--4.0.0--4.0.1.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--4.0.1--4.0.2.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--4.0.2--4.0.3.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--4.0.3--4.1.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--4.1.0--4.1.1.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--4.1.1--4.1.2.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--4.1.2--4.1.3.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3--4.1.3--unreleased.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/lib/postgresql/h3_postgis.dylib
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3_postgis.control
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3_postgis--unreleased.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3_postgis--4.0.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3_postgis--4.0.0--4.0.1.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3_postgis--4.0.1--4.0.2.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3_postgis--4.0.2--4.0.3.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3_postgis--4.0.3--4.1.0.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3_postgis--4.1.0--4.1.1.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3_postgis--4.1.1--4.1.2.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3_postgis--4.1.2--4.1.3.sql
-- Installing: /Applications/Postgres.app/Contents/Versions/17/share/postgresql/extension/h3_postgis--4.1.3--unreleased.sq

For pgxn output, see my comment on #155

jmealo avatar Oct 08 '24 18:10 jmealo

@psparrow: On MacOS 14.5 (23F79), the manually built extension installs fine for 17, here are the steps that worked for me:

Set $PG_VERSION to equal the version you're trying to install for.

export PG_VERSION=17

# 1. Set the PATH to prioritize PostgreSQL $PG_VERSION binaries
export PATH="/Applications/Postgres.app/Contents/Versions/$PG_VERSION/bin:$PATH"

# 2. Set PG_CONFIG to point to PostgreSQL $PG_VERSION
export PG_CONFIG="/Applications/Postgres.app/Contents/Versions/$PG_VERSION/bin/pg_config"

# 3. Verify the PostgreSQL version
psql --version

#4. Clone repo
git clone https://github.com/zachasme/h3-pg.git

#5. Make & Install
cd h3-pg
make
make install

jmealo avatar Oct 08 '24 18:10 jmealo

Hi @jmealo, thanks for investigating! Can you tell if this only happens on an M chip? Or is it a general Mac issue?

I'll have to figure out what pgxn is doing differently, i was certain it simply did make && make install.

zachasme avatar Oct 09 '24 07:10 zachasme

@zachasme: I don't have an Intel Mac handy but a coworker does, I can try to see if it's reproducible in the next week or two.

jmealo avatar Oct 10 '24 16:10 jmealo

Thanks! Also I forgot about this PR: #140. I need to figure how these three issues are connected, and whether it depends on pg version and/or Mac chip. I don't currently have access to a Mac either, so any help is appreciated.

zachasme avatar Oct 11 '24 08:10 zachasme

Hi @jmealo @shaunakv1

Can you confirm if the latest release 4.1.4 resolves this?

zachasme avatar Nov 06 '24 10:11 zachasme

@zachasme: Confirmed working on MacOS 14.5 with Postgres.app (16)

I had to manually remove the pgxn install h3 extension, as pgxn uninstall h3 yielded the following error:

❯ pgxn uninstall h3
INFO: best version: h3 4.1.4
INFO: saving /var/folders/7w/6vxgr0m53zqdy6cc3x_4cc0h0000gp/T/tmphyr3kf2d/h3-4.1.4.zip
INFO: unpacking: /var/folders/7w/6vxgr0m53zqdy6cc3x_4cc0h0000gp/T/tmphyr3kf2d/h3-4.1.4.zip
INFO: removing extension
make: *** No rule to make target `uninstall'.  Stop.
ERROR: command returned 2: make PG_CONFIG=/Applications/Postgres.app/Contents/Versions/16/bin/pg_config uninstall

I have no idea how common it is for extensions to support uninstalling via pgxn uninstall. I'm not considering it an issue, just wanted to let you know.

jmealo avatar Nov 06 '24 14:11 jmealo

That's great! I've never had to use uninstall either, so I didn't know it was missing. Might try to add that.

Thanks for testing, @jmealo

zachasme avatar Nov 06 '24 14:11 zachasme