Ubuntu: how to install flex to make postgres?
Asked Answered
S

3

12

I'm trying to work on postgresql locally with ubuntu 10.04. I get this error after I configure with

./configure --enable-cassert --enable-debug --prefix=$HOME/pgsql

when I make && make install I get this error:

make -C parser all
make[3]: Entering directory `/home/james/school/db/pg-stuff/hw1/postgresql-8.4.2/src/backend/parser'

ERROR: `flex' is missing on your system. It is needed to create the
file `scan.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[3]: *** [scan.c] Error 1
make[3]: Leaving directory `/home/james/school/db/pg-stuff/hw1/postgresql-8.4.2/src/backend/parser'
make[2]: *** [parser-recursive] Error 2
make[2]: Leaving directory `/home/james/school/db/pg-stuff/hw1/postgresql-8.4.2/src/backend'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/james/school/db/pg-stuff/hw1/postgresql-8.4.2/src'
make: *** [all] Error 2

I tried to

apt-get install flex but I get the same error. How can I install flex so that this will work?

Semiporcelain answered 30/9, 2010 at 5:14 Comment(0)
I
35

You need to run ./configure again so that the make files are "aware" of flex.

Industrialize answered 14/4, 2011 at 23:44 Comment(2)
Thanks! It got rid of ERROR: flex is missing on your system.Candycecandystriped
Thanks. This answer resolved my issue for the same error but in my case not flex, its bison.Schou
A
2

You can install postgresql directly using:

sudo apt-get install postgresql-8.4

I don't understand how you could get the same error if you ran:

sudo apt-get install flex

mypc:~/> sudo apt-get install flex

Reading package lists... Done

Building dependency tree

Reading state information... Done

Suggested packages:

bison

The following NEW packages will be installed:

flex

0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

Need to get 261kB of archives.

After this operation, 1,032kB of additional disk space will be used.

Get:1 http://us.archive.ubuntu.com/ubuntu/ lucid/main flex 2.5.35-9 [261kB]

Fetched 261kB in 1s (247kB/s)

Selecting previously deselected package flex.

(Reading database ... 208958 files and directories currently installed.)

Unpacking flex (from .../flex_2.5.35-9_amd64.deb) ...

Processing triggers for install-info ...

Processing triggers for man-db ...

Setting up flex (2.5.35-9) ...

Because this package doesn't build anything. When I run the above command under KUbuntu 10.04, I get the following output:

.

Affer answered 30/9, 2010 at 5:21 Comment(2)
What error do you get when you run: sudo apt-get install flex ? Please include exactly what apt returns.Affer
It installs correctly: Unpacking flex (from .../flex_2.5.35-9_i386.deb) ... Processing triggers for install-info ... Processing triggers for man-db ... Setting up flex (2.5.35-9) .. but i get the same error when I try to make && make installSemiporcelain
T
0

the manual says:

Bison and Flex are required to build from Git, but not required when building from a release file. OnlyBison 1.875 or versions 2.2 and later will work. Flex must be version 2.5.31 or late

Terrence answered 4/3, 2021 at 11:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.