purcell / sqlint

Simple SQL linter supporting ANSI and PostgreSQL syntaxes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fails to install and run on M1 Macs because of pg_query version

AgustinBanchio opened this issue · comments

Hi,

Unfortunately, I'm not savvy with ruby to understand how to update the pg_query version used in this linter myself.

Since we updated to M1 macbooks we had trouble running the linter

Could not find pg_query-1.2.0 in any of the sources
Run `bundle install` to install missing gems.

When trying to install we get a lot of errors.

 Building native extensions. This could take a while...
ERROR:  Error installing pg_query:
        ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/pg_query-1.2.0/ext/pg_query
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20220822-64024-sb0a0l.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] Err

Turns out M1 Macs are compatible with pg_query 1.3.0 or later.

pganalyze/pg_query#210

Is there a way to update the pg_query version that this linter uses?

Thanks

I don't understand why this error happens for you: the dependencies of sqlint are already such that the newer pg_query will get used, generally 2.x.

(And it's working fine for me on Apple Silicon machines.)