Skip to content
Advertisement

x86_64-conda_cos6-linux-gnu-cc: Command not found with postgres function makefile

I am trying to do this tutorial: https://linuxgazette.net/139/peterson.html so I can learn to write postgres functions.

It says to use this makefile, which fails:

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

Errors:

(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

I have tried several things, including updating conda and anaconda, as per the answers to similar questions. Nothing has worked yet.

How do I compile postgres function given this situation?

Advertisement

Answer

This error has occurred caused by absent GCC compiler((/tmp/build/80754af9/postgresql-split_1552510884761/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc) in your machine. Therefore, you need to rewrite a make rule.

  1. Update the gcc compiler version 6 or later.
  2. Rewrite the Makefile by adding “CC := /usr/bin/gcc” below the line of “include $(PGXS)”.

ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) –pgxs)
include $(PGXS)
CC := /usr/bin/gcc 3. Finally, compile your extension. (USE_PGXS=1 make)

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement