Tencent / TBase

TBase is an enterprise-level distributed HTAP database. Through a single database cluster to provide users with highly consistent distributed database services and high-performance data warehouse services, a set of integrated enterprise-level solutions is formed.
Other
1.38k stars 262 forks source link

Does not compile under gcc8 due to undefined Recovery_IsStandby. #33

Closed yazun closed 4 years ago

yazun commented 4 years ago

Seems gcc/ld 8 got stricter about undefined functions and lack of body of Recovery_IsStandby breaks the compilation (possibly due to flto enabled).

Steps to reproduce on centos 7 with devtoolset-8 installed.

scl enable devtoolset-8 bash
export AR="gcc-ar"
export NM="gcc-nm"
export RANLIB="gcc-ranlib"
export XHOME=$HOME/XZ_10_STABLE
./configure '--with-libxml' '--with-libxslt' '--prefix=XZ_10_STABLE' '--with-segsize=8' '--with-blocksize=16' '--with-wal-segsize=64' '--with-wal-blocksize=16' '--with-ldap' '--with-python' '--enable-debug' 'CC=gcc' 'CFLAGS=-DPGXC -DXCP -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g  -O3  -flto -fuse-linker-plugin -fno-omit-frame-pointer -march=native' --enable-user-switch --with-openssl  --with-ossp-uuid

gives:

...
gcc -D_PG_ORCL_ -DPGXC -DXCP -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -D_USER_SWITCH_ -DPGXC -DXCP -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribut
e -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g  -O3  -flto -fuse-linker-plugin -fno-omit-frame-pointer -march=native -pthread -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -L../../../src/port -L../../../src/common -Wl,--as-needed -Wl,-rpath,'/home/pgxzDR3/XZ_10_STABLE/lib',--enable-new-dtags -lpgcommon -lpgport -lpthread
 -lxslt -lxml2 -lssl -lcrypto -lz -lreadline -lrt -lcrypt -ldl -lm  main.o gtm_thread.o gtm_txn.o gtm_seq.o gtm_snap.o gtm_standby.o gtm_opt.o gtm_backup.o gtm_store.o gtm_xlog.o ../libpq/libpqcomm.a ../path/libgtmpath.a ../recovery/libgtmrecovery.a ../client/libgtmclient.a ../common/libgtm.a ../../port/libpgport.a -o gtm
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: Dwarf Error: Could not find abbrev number 118.
/tmp/ccNUWJtw.ltrans0.ltrans.o: In function `CreateLockFile.constprop.107':
<artificial>:(.text+0x2e41): undefined reference to `Recovery_IsStandby'
/tmp/ccNUWJtw.ltrans0.ltrans.o: In function `ProcessStartPreparedTransactionCommand.constprop.60':
<artificial>:(.text+0x71e8): undefined reference to `Recovery_IsStandby'
<artificial>:(.text+0x7202): undefined reference to `Recovery_IsStandby'
/tmp/ccNUWJtw.ltrans0.ltrans.o: In function `ProcessSequenceInitCommand.constprop.44':
<artificial>:(.text+0x8b7b): undefined reference to `Recovery_IsStandby'
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: Dwarf Error: Offset (317445) greater than or equal to .debug_str size (1374).
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: Dwarf Error: Offset (2365960) greater than or equal to .debug_str size (1374).
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: Dwarf Error: Offset (613888) greater than or equal to .debug_str size (1374).
/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/ld: Dwarf Error: Could not find abbrev number 574.
/tmp/ccNUWJtw.ltrans1.ltrans.o: In function `RedoXLogRecord.isra.9.lto_priv.197':
<artificial>:(.text+0xc9ce): undefined reference to `Recovery_IsStandby'
/tmp/ccNUWJtw.ltrans1.ltrans.o:<artificial>:(.text+0xcafd): more undefined references to `Recovery_IsStandby' follow
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:23: gtm] Error 1
make[3]: Leaving directory '/home/pgxzDR3/git/TBase/src/gtm/main'
make[2]: *** [Makefile:22: all] Error 2
make[2]: Leaving directory '/home/pgxzDR3/git/TBase/src/gtm'
make[1]: *** [Makefile:38: all-gtm-recurse] Error 2
make[1]: Leaving directory '/home/pgxzDR3/git/TBase/src'
make: *** [GNUmakefile:11: all-src-recurse] Error 2
yazun commented 4 years ago

I see it is similar/duplicate of #6 Still, having inline here causing function body not to be found is not the best option.

yazun commented 4 years ago

Created pull request for two minor gcc8 fixes.

yazun commented 4 years ago

Fixed by https://github.com/Tencent/TBase/pull/59