【问题标题】:x86_64-conda_cos6-linux-gnu-cc: Command not found with postgres function makefilex86_64-conda_cos6-linux-gnu-cc:找不到带有 postgres 函数 makefile 的命令
【发布时间】:2020-02-26 18:04:25
【问题描述】:

我正在尝试编写本教程:https://linuxgazette.net/139/peterson.html,以便我可以学习编写 postgres 函数。

它说要使用这个makefile,但失败了:

MODULES = example
PGXS := $(shell pg_config --pgxs)
include $(PGXS)

错误:

(base) weather@weather:~/pg_func_learn$ make
/tmp/build/80754af9/postgresql-split_1552510884761/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/weather/anaconda3/include -fdebug-prefix-map=/tmp/build/80754af9/postgresql-split_1552510884761/work=/usr/local/src/conda/postgresql-split-11.2 -fdebug-prefix-map=/home/weather/anaconda3=/usr/local/src/conda-prefix -fPIC -I. -I./ -I/home/weather/anaconda3/include/server -I/home/weather/anaconda3/include/internal  -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -D_GNU_SOURCE  -I/home/weather/anaconda3/include  -c -o example.o example.c
make: /tmp/build/80754af9/postgresql-split_1552510884761/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc: Command not found
<builtin>: recipe for target 'example.o' failed
make: *** [example.o] Error 127

根据类似问题的答案,我尝试了几件事,包括更新 conda 和 anaconda。还没有任何效果。

在这种情况下如何编译 postgres 函数?

【问题讨论】:

    标签: c linux postgresql makefile anaconda


    【解决方案1】:

    这个错误是由于你的机器中没有GCC编译器((/tmp/build/80754af9/postgresql-split_1552510884761/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc)引起的。因此,你需要重写一个制定规则。

    1. 更新 gcc 编译器版本 6 或更高版本。
    2. 通过在“include $(PGXS)”行下方添加“CC := /usr/bin/gcc”来重写 Makefile。

    ifdef USE_PGXS
    PG_CONFIG = pg_config
    PGXS := $(shell $(PG_CONFIG) --pgxs)
    包括 $(PGXS)
    CC := /usr/bin/gcc 3. 最后,编译你的扩展。 (USE_PGXS=1 品牌)

    【讨论】:

      猜你喜欢
      • 2020-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-23
      • 1970-01-01
      • 2021-06-27
      • 2018-06-26
      相关资源
      最近更新 更多