postgresql Ubuntu:如何安装 flex 来制作 postgres?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3827938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-20 00:20:02  来源:igfitidea点击:

Ubuntu: how to install flex to make postgres?

postgresqlubuntuflex-lexer

提问by James

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

我正在尝试使用 ubuntu 10.04 在本地处理 postgresql。配置后出现此错误

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

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

当我 make && make install 时出现此错误:

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 flexbut I get the same error. How can I install flex so that this will work?

apt-get install flex但我得到了同样的错误。我如何安装 flex 才能使其正常工作?

回答by ivotron

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

您需要./configure再次运行,以便 make 文件“知道”flex。

回答by M. Tibbits

You can install postgresql directly using:

您可以使用以下命令直接安装 postgresql:

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

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.

0 个升级,1 个新安装,0 个删除,0 个未升级。

Need to get 261kB of archives.

需要获得 261kB 的档案。

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

此操作后,将使用 1,032kB 的额外磁盘空间。

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

获取:1 http://us.archive.ubuntu.com/ubuntu/lucid/mainflex 2.5.35-9 [261kB]

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

1 秒内获取 261kB (247kB/s)

Selecting previously deselected package flex.

选择以前取消选择的包 flex。

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

(正在读取数据库...当前安装了 208958 个文件和目录。)

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

解压 flex(来自 .../flex_2.5.35-9_amd64.deb)...

Processing triggers for install-info ...

处理安装信息的触发器...

Processing triggers for man-db ...

处理 man-db 的触发器...

Setting up flex (2.5.35-9) ...

设置 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:

因为这个包没有构建任何东西。当我在 KUbuntu 10.04 下运行上述命令时,我得到以下输出:

.

.