gpt4 book ai didi

postgresql - 在 Cygwin : "undefined reference to _SET_VARSIZE' "上编译 PostgreSQL 8.3.1 src/tutorial

转载 作者:行者123 更新时间:2023-11-29 14:01:38 24 4
gpt4 key购买 nike

跟进 my previous question about finding pg_config , 我仍然很难编译 /src/tutorial 子目录。

我在 Windows 7 上运行 cygwin。这不是一个理想的环境,但我正在尝试获取在此版本中编写的 PostgreSQL 扩展,该扩展使用基于 Windows 的界面来工作。一旦我开始运行,我将迁移到 Linux 和更好的 PostgreSQL。

回到问题:

我在 /src/tutorial 上运行 make 时得到以下信息。我没有更改目录中的任何内容。

$ make
dlltool --export-all --output-def complex.def complex.o
dllwrap -o complex.dll --def complex.def complex.o -L/usr/lib -lpostgres -L/usr/ lib -lpostgres
rm -f complex.def
gcc -O2 -pipe -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration -after-statement -Wendif-labels -fno-strict-aliasing -fwrapv -I. -I/usr/include /postgresql/server -I/usr/include/postgresql/internal -c -o funcs.o funcs.c
funcs.c:19:1: warning: ‘Pg_magic_func’ redeclared without dllimport attribute: p revious dllimport ignored
funcs.c: In function ‘copytext’:
funcs.c:74:2: warning: implicit declaration of function ‘SET_VARSIZE’
dlltool --export-all --output-def funcs.def funcs.o
dllwrap -o funcs.dll --def funcs.def funcs.o -L/usr/lib -lpostgres -L/usr/lib -l postgres
funcs.o:funcs.c:(.text+0xb6): undefined reference to `_SET_VARSIZE'
funcs.o:funcs.c:(.text+0x142): undefined reference to `_SET_VARSIZE'
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1

我不知道需要包含在 funcs 中的正确头文件是什么。

此错误发生在未打补丁的 8.3.1 中。

谢谢

编辑

我在安装中发现了上述问题。/src/tutorial下的Makefile运行

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)

不幸的是,除了我的 installation-folder/bin

中的那个之外,还有另一个 pg_config

所以一旦我解决了这个问题,/src/tutorial 下的所有内容都会正常构建

最佳答案

如评论中所述,这次是由于版本错误的额外pg_config引起的。很可能这也不是错误版本的唯一方面。正在使用的旧头文件可能是最接近的原因,pg_config 将指向旧头文件。

一般来说,正确的做法是找到两个文件的所有版本,然后确定正在使用的是哪一个。这些文件是:

  1. pg_config

  2. postgres.h

完成此操作后,确定要删除或移出脚本可以找到的位置应该很简单。

关于postgresql - 在 Cygwin : "undefined reference to _SET_VARSIZE' "上编译 PostgreSQL 8.3.1 src/tutorial,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12907015/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com