-2

I am following this tutorial for installing Apache AGE and am getting the following error:

$ make && make install
***
ERROR: `flex` is missing on your system. It is needed to create the
file `src/backend/parser/ag_scanner.c`. You can either get flex from a GNU mirror
site or download an official distribution of PostgreSQL, which
contains pre-packaged flex output.
***
make: *** [/usr/local/pgsql/lib/pgxs/src/makefiles/../../src/Makefile.global:758
: src/backend/parser/ag_scanner.c] Error 1
$ flex --version
flex 2.6.4

As you can see, I have flex already installed yet it is giving me this error.

I have tried reinstalling flex but to no avail.

zforgo
  • 2,508
  • 2
  • 14
  • 22
  • Hey Abdullah! Please, paste the terminal output in your answer in markdown style so it is easier for us to see what is happening. – Carla Apr 25 '23 at 14:03
  • What Apache AGE version are you installing? – Carla Apr 25 '23 at 14:16
  • 1
    [Here's the reason why you shouldn't upload text as image](https://meta.stackoverflow.com/a/285557/13447). Edit your question to contain all the information in text form - consider to use the editor's formatting options. Also see [ask]. – Olaf Kock Apr 25 '23 at 15:44

8 Answers8

0

Seems make is not aware of flex being present on your system.

Please attempt running ./configure again before attempting make & make install.

RU-D
  • 224
  • 8
0

Run the make commands as sudo. The problem probably lies in the sudo and non-sudo environments being different.

moeed865
  • 304
  • 1
  • 6
0

Execute this command once again sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison. and then execute the command that threw error. Check your PostgreSQL and age versions as well. As age supports PostgreSQL 11 and 12 only.

If above instructions do not work.. I would suggest you to start all over again, delete the files you installed before and follow below steps for smooth installation of age:

Installing dependencies:

First, we are going to install age For that make a new directory and a sub-directory:

mkdir age_installation
cd age_installation
mkdir pg
cd pg

Download some important libraries by using the below commands before starting the process of installation of Apache Age. Since we are specifically using Linux to install the apache age, we will be using the below commands.

Remember below commands might vary according to the operating systems.

sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison

Installation of PostgreSQL from Source:

First, we will install PostgreSQL from source. We need an age compatible version of PostgreSQL. For now, age only supports Postgres 11 and 12.

Download the files in the folder age-installation/pg

wget https://ftp.postgresql.org/pub/source/v11.18/postgresql-11.18.tar.gz && tar -xvf postgresql-11.18.tar.gz && rm -f postgresql-11.18.tar.gz

The command will download and extract the tar files for Linux users from Source in the working directory. Installing PG: Now we will install PostgreSQL.

cd postgresql-11.18

# configure by setting flags
./configure --enable-debug --enable-cassert --prefix=$(path) CFLAGS="-ggdb -Og -fno-omit-frame-pointer"

# now install
make install

# go back
cd ../../

In the above command, the prefix flag will contain the path where you would like to install the PSQL. Replace your path with the path in the parenthesis.

AGE:

Downloading:

Download the age from the GitHub repository. i.e. clone it in the age_installation directory.

git clone https://github.com/apache/age.git

Installing:

Configure age with PostgreSQL.

cd age/
sudo make PG_CONFIG=/home/talhastinyasylum/Desktop/age_installation/pg/postgresql-11.18/bin/pg_config install
make PG_CONFIG=/home/talhastinyasylum/Desktop/age_installation/pg/postgresql-8/bin/pg_config installcheck

In the above commands, PG_CONFIG requires the path to the pg_config file. The second command will check whether the installation was successful or not.

At the end of the check command, you will receive a message saying all tests passed.

You can also look more in below links:

  1. https://github.com/apache/age#readme
Talha Munir
  • 121
  • 5
0

I assume you are installing from source code. There are dependencies that are meant to be installed in your machine before you can start to install PostgreSQL and AGE, dependencies such as build-essential, libreadline-dev, zlib1g-dev, flex and bison. I explained in my blog link. Visit AGE documentation for more info.

I would advise you remove all objects using make clean or delete and re-extract the postgresql source code, then rerun ./configure with your prefixes and flags for make to become aware of these dependencies. You can now run gmake and gmake install to recompile postgresql

0

I recommend that you reinstall all the requirements and then reinstall PostgreSQL. If you are installing from the package management, make sure you installed both postgresql and postgresql-server-dev for versions 11, 12, or 13. By default, the binaries are installed in the directory /usr/lib/postgresql/{version}/bin, where {version} is the PostgreSQL version you installed (e.g. 13).

After that, you can try a clean installation of AGE. First, configure the PATH variable and install AGE by setting up the PG_CONFIG variable running these commands:

export PATH=/usr/lib/postgresql/{version}/bin
sudo make PG_CONFIG=/usr/lib/postgresql/{version}/bin/pg_config install

If you want a detailed tutorial on how to install PostgreSQL via package management for Apache AGE, you can refer to this post: Step-by-Step Guide to Install PostgreSQL via Package Management for Apache AGE on Ubuntu.

Carla
  • 326
  • 1
  • 7
0

please run the following command to see if is there the flex executables:

echo $PATH

if the flex variables isn't in the PATH you can configure it by

export PATH=$PATH:{path to flex}/flex

You can also add this command to your shell's startup file (~/.bashrc or ~/.zshrc) so that the PATH variable is updated automatically every time you open a new terminal session.

Marcos Silva
  • 115
  • 5
0

The problem might be that you have not check the dependencies when installing AGE. please check the dependencies according to your OS. Althpugh if you are using ubntu try running the command.
sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison

Also i recommending following this tutorial for easy installation guide to install AGE and AGE-Viewer. Its helps in handling the dependencies for installation and also tells the compatible versions for installation.

0

I see this is a recurring issue. As my understanding goes I think you might have to first of all check your version of postgreSQL so that does not interfere with this make sure the postgreSQL is version 11 or 12 because Apache AGE is only compatible with these versions. Then check for flex and bison using the command

sudo apt-get install build-essential libreadline-dev zlib1g-dev flex bison 

Now proceed with installation and your AGE should be installed properly.

Umairus
  • 21
  • 2