415 Star 1.4K Fork 1.6K

GVPopenGauss/openGauss-server

 / 详情

编译报错

已完成
缺陷
创建于  
2021-04-24 01:30

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

  • bug

  • feature

What happened:
系统:openEuler release 20.03 (LTS-SP1)
三方件用的是官网编译好的。
编译指令:
./configure --gcc-version=7.3.0 CC=g++ CFLAGS='-O0' --prefix=$GAUSSHOME --3rd=$BINARYLIBS --enable-debug --enable-cassert --enable-thread-safety --without-readline --without-zlib
make -sj 4

编译报错:
[shift@08-00-27-B4-FE-77 openGauss-server]$ make -sj 1
Writing fmgroids.h
Writing fmgrtab.cpp
Writing pg_builtin_proc.h
cat: snowball/objfiles.txt: 没有那个文件或目录
-I../../../../src/include -I../../../../src/lib/gstrace -D_GNU_SOURCE -I/home/shift/opengauss_source/binarylibs/dependency/install_tools_openeuler_x86_64/unixodbc/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/libobs/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/libcgroup/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/openssl/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/liborc/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/libparquet/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/protobuf/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/grpc/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/boost/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/llvm/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/kerberos/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/postgresql-hll/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/cjson/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/libedit/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/numactl/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/zlib1.2.11/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/lz4/comm/include -I/home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/libcurl/comm/include
bufmgr.cpp: In function ‘Buffer ReadBuffer_common(SMgrRelation, char, ForkNumber, BlockNumber, ReadBufferMode, BufferAccessStrategy, bool*)’:
bufmgr.cpp:2164:10: warning: unused variable ‘block_exist’ [-Wunused-variable]
bool block_exist = true;
^~~~~~~~~~~
cat: ../../src/common/interfaces/libpq/objfiles.txt: 没有那个文件或目录
cat: ../../contrib/test_decoding/objfiles.txt: 没有那个文件或目录
cat: ../../contrib/mppdb_decoding/objfiles.txt: 没有那个文件或目录
cat: ../../contrib/postgres_fdw/objfiles.txt: 没有那个文件或目录
cat: ../../src/common/interfaces/libpq/objfiles.txt: 没有那个文件或目录
cat: ../../contrib/test_decoding/objfiles.txt: 没有那个文件或目录
cat: ../../contrib/mppdb_decoding/objfiles.txt: 没有那个文件或目录
cat: ../../contrib/postgres_fdw/objfiles.txt: 没有那个文件或目录
ld: warning: libsecurec.so, needed by /home/shift/opengauss_source/binarylibs/dependency/openeuler_x86_64/libobs/comm/lib/libeSDKOBS.so, not found (try using -rpath or -rpath-link)
ld: ../../src/common/backend/parser/parser.o: in function base_yylex(YYSTYPE*, int*, void*)': /home/shift/opengauss_source/openGauss-server/src/common/backend/parser/parser.cpp:134: undefined reference to core_yylex(core_YYSTYPE*, int*, void*)'
ld: /home/shift/opengauss_source/openGauss-server/src/common/backend/parser/parser.cpp:143: undefined reference to core_yylex(core_YYSTYPE*, int*, void*)' ld: /home/shift/opengauss_source/openGauss-server/src/common/backend/parser/parser.cpp:166: undefined reference to core_yylex(core_YYSTYPE*, int*, void*)'
ld: /home/shift/opengauss_source/openGauss-server/src/common/backend/parser/parser.cpp:187: undefined reference to core_yylex(core_YYSTYPE*, int*, void*)' ld: /home/shift/opengauss_source/openGauss-server/src/common/backend/parser/parser.cpp:209: undefined reference to core_yylex(core_YYSTYPE*, int*, void*)'
ld: ../../src/common/backend/parser/parser.o:/home/shift/opengauss_source/openGauss-server/src/common/backend/parser/parser.cpp:231: more undefined references to core_yylex(core_YYSTYPE*, int*, void*)' follow ld: ../../src/gausskernel/storage/replication/repl_gram.o: in function replication_yylex(YYSTYPE*, int*, void*)':
/home/shift/opengauss_source/openGauss-server/src/gausskernel/storage/replication/repl_gram.y:419: undefined reference to replication_scanner_yylex(replication_scanner_YYSTYPE*, int*, void*)' ld: ../../src/gausskernel/storage/replication/syncrep.o: in function syncrep_yylex(YYSTYPE*, int*, void*)':
/home/shift/opengauss_source/openGauss-server/src/gausskernel/storage/replication/syncrep.cpp:1622: undefined reference to syncrep_scanner_yylex(syncrep_scanner_YYSTYPE*, int*, void*)' ld: ../../src/common/pl/plpgsql/src/libplpgsql.a(pl_scanner.o): in function internal_yylex(TokenAuxData*)':
/home/shift/opengauss_source/openGauss-server/src/common/pl/plpgsql/src/pl_scanner.cpp:321: undefined reference to `core_yylex(core_YYSTYPE*, int*, void*)'
make[2]: *** [Makefile:343:gaussdb] 错误 1
make[1]: *** [Makefile:64:all-gausskernel-recurse] 错误 2
make: *** [GNUmakefile:11:all-src-recurse] 错误 2

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Version:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

评论 (8)

PY2Chen 创建了缺陷
PY2Chen 关联仓库设置为openGauss/openGauss-server
展开全部操作日志

Hey @PY2Chen, Welcome to openGauss Community.
All of the projects in openGauss Community are maintained by @opengauss-bot.
That means the developers can comment below every pull request or issue to trigger Bot Commands.
Please follow instructions at https://gitee.com/opengauss/community/blob/master/contributors/command.en.md to find the details.

你好,能否看下机器上flex和bison的版本是多少?
看着像这两个组件引起的问题。

zhangxubo 添加了
 
kind/bug
标签
zhangxubo 添加了
 
sig/storageengine
标签
zhangxubo 添加了
 
sig/sqlengine
标签
zhangxubo 移除了
 
sig/storageengine
标签

你好,版本信息如下:

[shift@08-00-27-B4-FE-77 ~]$ flex --version
flex 2.6.4
[shift@08-00-27-B4-FE-77 ~]$ bison --version
bison (GNU Bison) 3.6.4
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

是的,确实是和flex的版本有关。我用flex-2.5.x版本不会出现编译报错,用2.6.x版本就会出现这个报错。
我研究了一下编译报错原因。
flex-2.5.x生成的scan.inc文件中yylex定义如下:

extern int core_yylex \
               (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);

#define YY_DECL int core_yylex \
               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)

其中yylex的函数名直接改成了core_yylex,而flex-2.6.x版本生成的scan.inc文件中yylex定义如下:

#ifdef yylex
#define core_yylex_ALREADY_DEFINED
#else
#define yylex core_yylex
#endif

通过宏定义将yylex转成core_yylex。
而gram.cpp、parser.cpp和scan.inc这三个文件的调用关系如下:
gram.cpp #define yylex base_yylex
parser.cpp 中定义了base_yylex函数,但在base_yylex函数中调用了core_yylex
scan.inc 中正常应该实现了core_yylex函数

但是用flex-2.6.4版本生成的scan.inc文件,由于yylex宏在gram.cpp中已经define成了base_yylex,因此scan.inc中的yylex没有正确的被替换成core_yylex而是被替换成了base_yylex,因此在编译parser.cpp的时候报错找不到core_yylex。

所以问题的根本原因在于gram.cpp和scan.inc这两个文件都define了yylex这个宏,但是宏的值是不同的,导致编译的时候函数名替换出错。

PY2Chen 修改了描述

ubuntu 18.04 版本, flex 2.6.4 , bison (GNU Bison) 3.5.4 碰到一样的问题

ubuntu@ubuntu:~$ flex --version
flex 2.6.4
ubuntu@ubuntu:~$ bison --version
bison (GNU Bison) 3.5.4
赵文浩 负责人设置为zhangxubo

Looks like flex changed its behaviour in this commit:

commit a1634aa8d3d41a257ad659788dac222739df89f5
Author: Demi Obenour demiobenour@gmail.com
Date: Tue May 2 20:05:14 2017 -0400

Honor user definitions of yy_* macros

The user may have defined the yy_* macros themselves.  In that case,
don't clobber them.

我们也遇到了同样的问题

LSB Version:    n/a                                                                                                    
Distributor ID: openEuler                                                                                              
Description:    openEuler release 20.03 (LTS-SP2)                                                                      
Release:        20.03                                                                                                  
Codename:       LTS-SP2
[root@localhost sda]# uname -a
Linux localhost.localdomain 4.19.90-2106.3.0.0095.oe1.x86_64 #1 SMP Wed Jun 23 15:18:59 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost sda]# flex --version
flex 2.5.37
[root@localhost sda]# bison --version
bison (GNU Bison) 3.6.4

经测试flex版本2.5.37,2.5.39,2.6.1,2.6.4均无法编译通过,且报错信息一致

在此之前我们还在configure阶段遇到了这一问题
#I1MC1E:CentOS8.2上编译时,运行configure脚本在3321行异常退出
经过debug发现

export LD_LIBRARY_PATH=$GCC_PATH/gmp/lib/:$LD_LIBRARY_PATH

会导致expr命令无法正确执行,具体来说*无法识别,导致configure代码3524行exit 1
我们的解决方案是手动计算了expr表达式的值并赋值给RELSEG_SIZE,以此通过了configure阶段

但编译阶段的core_yylex未定义的问题仍无法解决

发现 make distclean 并不会清理*.inc文件,因此重新clone一份代码目录,编译成功

zhangxubo 优先级设置为严重
赵文浩 移除了
 
sig/sqlengine
标签
赵文浩 添加了
 
sig/storageengine
标签
zhangxubo 通过opengauss/openGauss-server Pull Request !1488任务状态待办的 修改为已完成

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(6)
5622128 opengauss bot 1581905080
C++
1
https://gitee.com/opengauss/openGauss-server.git
git@gitee.com:opengauss/openGauss-server.git
opengauss
openGauss-server
openGauss-server

搜索帮助

A270a887 8829481 3d7a4017 8829481