Skip to content

Building with -O0 causes programs/zstd to fail to link #2950

@eli-schwartz

Description

@eli-schwartz

For example, configuring the meson build using

$ meson setup --buildtype=debug builddir/
$ ninja -C builddir/
[50/50] Linking target programs/zstd
FAILED: programs/zstd 
cc  -o programs/zstd programs/zstd.p/.._.._.._programs_zstdcli.c.o programs/zstd.p/.._.._.._programs_util.c.o programs/zstd.p/.._.._.._programs_timefn.c.o programs/zstd.p/.._.._.._programs_fileio.c.o programs/zstd.p/.._.._.._programs_benchfn.c.o programs/zstd.p/.._.._.._programs_benchzstd.c.o programs/zstd.p/.._.._.._programs_datagen.c.o programs/zstd.p/.._.._.._programs_dibio.c.o programs/zstd.p/.._.._.._programs_zstdcli_trace.c.o programs/zstd.p/.._.._.._lib_common_xxhash.c.o -Wl,--as-needed -Wl,--no-undefined '-Wl,-rpath,$ORIGIN/../lib' -Wl,-rpath-link,/tmp/zstd-1.5.1/build/meson/builddir/lib -Wl,--start-group lib/libzstd.so.1.5.1 /usr/lib/libz.so /usr/lib/liblzma.so /usr/lib/liblz4.so -Wl,--end-group
/usr/bin/ld: programs/zstd.p/.._.._.._programs_dibio.c.o: in function `ERR_getErrorName':
/tmp/zstd-1.5.1/build/meson/builddir/../../../programs/../lib/common/error_private.h:75: undefined reference to `ERR_getErrorString'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

I can reproduce the failure by setting the buildtype=plain, and make the error go away by additionally adding CFLAGS=-O1.

Although presumably zstd may rather suffer for building without any optimizations, undefined symbols seems odd.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions