yandex/odyssey

Undefined reference to `__ubsan_handle_out_of_bounds'

japinli opened this issue · 6 comments

Hi,

When I try to build odyssey master with PostgreSQL 17 using the following commands, it complains $subject.

PREFIX=/tmp/pg
./configure \
        --prefix=$PREFIX \
        --enable-tap-tests \
        --enable-debug \
        --enable-cassert \
        --enable-depend \
        --enable-dtrace \
        --with-icu \
        --with-llvm \
        --with-openssl \
        --with-python \
        --with-libxml \
        --with-libxslt \
        --with-lz4 \
        --with-pam \
        CFLAGS='-Wmissing-prototypes -Wincompatible-pointer-types -fsanitize=bounds' \
        >configure.log 2>&1

# -DOPTIMIZER_DEBUG=1
make -j $(nproc) -s && make install -s
(cd contrib/ && make -j $(nproc) -s && make install -s)

cat <<EOF >$PREFIX/env.sh
export PGHOME=$PREFIX
export PATH=\$PGHOME/bin:\$PATH
export LD_LIBRARY_PATH=\$PGHOME/lib:\$LD_LIBRARY_PATH
export PGPORT=9917
export PGDATA=\$PGHOME/pgdata
EOF

git clone https://github.com/yandex/odyssey
cd odyssey
make local_build

Here are errors:

/usr/bin/ld: /home/japin/Codes/pg/REL_17_STABLE/build/pg/lib/libpgcommon.a(base64.o): in function `pg_b64_decode':
/home/japin/Codes/pg/REL_17_STABLE/build/../src/common/base64.c:159:(.text+0x360): undefined reference to `__ubsan_handle_out_of_bounds'
/usr/bin/ld: /home/japin/Codes/pg/REL_17_STABLE/build/pg/lib/libpgcommon.a(scram-common.o): in function `scram_SaltedPassword':
/home/japin/Codes/pg/REL_17_STABLE/build/../src/common/scram-common.c:97:(.text+0x24a): undefined reference to `__ubsan_handle_out_of_bounds'
/usr/bin/ld: /home/japin/Codes/pg/REL_17_STABLE/build/pg/lib/libpgcommon.a(unicode_norm.o): in function `get_code_decomposition':
/home/japin/Codes/pg/REL_17_STABLE/build/../src/common/unicode_norm.c:148:(.text+0x173): undefined reference to `__ubsan_handle_out_of_bounds'
/usr/bin/ld: /home/japin/Codes/pg/REL_17_STABLE/build/pg/lib/libpgcommon.a(unicode_norm.o): in function `recompose_code':
/home/japin/Codes/pg/REL_17_STABLE/build/../src/common/unicode_norm.c:292:(.text+0x3e5): undefined reference to `__ubsan_handle_out_of_bounds'
/usr/bin/ld: /home/japin/Codes/pg/REL_17_STABLE/build/../src/common/unicode_norm.c:300:(.text+0x458): undefined reference to `__ubsan_handle_out_of_bounds'
/usr/bin/ld: /home/japin/Codes/pg/REL_17_STABLE/build/pg/lib/libpgcommon.a(unicode_norm.o):/home/japin/Codes/pg/REL_17_STABLE/build/../src/common/unicode_norm.c:301: more undefined references to `__ubsan_handle_out_of_bounds' follow
collect2: error: ld returned 1 exit status
make[3]: *** [sources/CMakeFiles/odyssey.dir/build.make:954: sources/odyssey] Error 1
make[3]: Leaving directory '/data/Codes/extensions/odyssey/build'
make[2]: *** [CMakeFiles/Makefile2:218: sources/CMakeFiles/odyssey.dir/all] Error 2
make[2]: Leaving directory '/data/Codes/extensions/odyssey/build'
make[1]: *** [Makefile:91: all] Error 2
make[1]: Leaving directory '/data/Codes/extensions/odyssey/build'
make: *** [Makefile:35: local_build] Error 2

However, if I remove the -fsanitize=bounds when configuring it compiled without errors.

hi! seems like the cause is that you building odyssey without any sanitizers

can you try to use make build_asan instead make local_build?

hi! seems like the cause is that you building odyssey without any sanitizers

can you try to use make build_asan instead make local_build?

Thanks, make build_asan works.

hmm, and with -fsanitize=bounds in https://github.com/yandex/odyssey/blob/master/CMakeLists.txt#L65

Does this mean it overwrites the -fsanitize=bounds flags?

Does this mean it overwrites the -fsanitize=bounds flags?

fsanitize=undefined includes fsanitize=bounds

my second comment was wrong, there is no need to add fsanitize=bounds in odyssey build

Does this mean it overwrites the -fsanitize=bounds flags?

fsanitize=undefined includes fsanitize=bounds

my second comment was wrong, there is no need to add fsanitize=bounds in odyssey build

Thanks @rkhapov.