pganalyze / pg_query

Ruby extension to parse, deparse and normalize SQL queries using the PostgreSQL query parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for ARM64(AARCH64) architecture

paulgaumer opened this issue Β· comments

Hi,

pg_query_go recently got support for arm64 via this ticket.

I'm facing the exact same issue related to port/atomics/arch-arm.h with the pg_query gem on the new Macbook M1.

Would it be possible to add support for it? πŸ™

Error message:

Fetching pg_query 1.2.0
Installing pg_query 1.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/paulgaumer/.rvm/gems/ruby-2.5.8@veeqo/gems/pg_query-1.2.0/ext/pg_query
/Users/paulgaumer/.rvm/rubies/ruby-2.5.8/bin/ruby -I
/Users/paulgaumer/.rvm/rubies/ruby-2.5.8/lib/ruby/site_ruby/2.5.0 -r ./siteconf20210208-3945-9rvrvv.rb extconf.rb
compiling src/pg_query.c
compiling src/pg_query_fingerprint.c
compiling src/pg_query_json.c
compiling src/pg_query_json_plpgsql.c
In file included from src/pg_query_json_plpgsql.c:2:
In file included from src/pg_query_json_plpgsql.h:5:
In file included from ./src/postgres/include/plpgsql.h:21:
In file included from ./src/postgres/include/commands/trigger.h:17:
In file included from ./src/postgres/include/nodes/execnodes.h:17:
In file included from ./src/postgres/include/access/genam.h:19:
In file included from ./src/postgres/include/nodes/tidbitmap.h:26:
In file included from ./src/postgres/include/utils/dsa.h:17:
./src/postgres/include/port/atomics.h:68:10: fatal error: 'port/atomics/arch-arm.h' file not found
#include "port/atomics/arch-arm.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [src/pg_query_json_plpgsql.o] Error 1
cp: directory /Users/paulgaumer/.rvm/gems/ruby-2.5.8@veeqo/gems/pg_query-1.2.0/ext/pg_query/../../spec/files does
not exist
creating Makefile

current directory: /Users/paulgaumer/.rvm/gems/ruby-2.5.8@veeqo/gems/pg_query-1.2.0/ext/pg_query
make "DESTDIR=" clean

current directory: /Users/paulgaumer/.rvm/gems/ruby-2.5.8@veeqo/gems/pg_query-1.2.0/ext/pg_query
make "DESTDIR="
compiling pg_query_ruby.c
linking shared-object pg_query/pg_query.bundle
ld: library not found for -lpg_query
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pg_query.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/paulgaumer/.rvm/gems/ruby-2.5.8@veeqo/gems/pg_query-1.2.0 for inspection.
Results logged to
/Users/paulgaumer/.rvm/gems/ruby-2.5.8@veeqo/extensions/-darwin-20/2.5.0/pg_query-1.2.0/gem_make.out

An error occurred while installing pg_query (1.2.0), and Bundler cannot continue.
Make sure that `gem install pg_query -v '1.2.0'` succeeds before bundling.

In Gemfile:
  pg_exec_array_params was resolved to 0.1.1, which depends on
    pg_query

@paulgaumer Can you try upgrading to 1.3.0? (see CHANGELOG: https://github.com/lfittl/pg_query/blob/master/CHANGELOG.md#130-----2020-12-28)

That should fix ARM support :)

My bad! That's great, thanks a lot for the quick reply @lfittl.