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

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

Open
AgustinBanchio opened this issue Aug 22, 2022 · 2 comments
Open

Comments

@AgustinBanchio
Copy link

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

@purcell
Copy link
Owner

purcell commented Aug 22, 2022

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.

@purcell
Copy link
Owner

purcell commented Aug 22, 2022

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

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

No branches or pull requests

2 participants