Skip to content

build.rs panics due to _FORTIFY_SOURCE warnings #108

@cratelyn

Description

@cratelyn

first, thanks for maintaining this crate. it is a very useful piece of software.

i have found that the build.rs panics when i attempt to build this package using clang 17, due to warnings related a missing optimization flag:

the panic looks like:

  thread 'main' panicked at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/jemalloc-sys-0.5.4+5.3.0-patched/build.rs:351:9:
  command did not execute successfully: cd "/home/user/project/target/debug/build/jemalloc-sys-3acf0278209d6cd4/out/build" && "make" "-j" "24"
  expected success, got: exit status: 2
  stack backtrace:
     0:     0x55d9c7f25c46 - std::backtrace_rs::backtrace::libunwind::trace::hbee8a7973eeb6c93
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
     1:     0x55d9c7f25c46 - std::backtrace_rs::backtrace::trace_unsynchronized::hc8ac75eea3aa6899
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:     0x55d9c7f25c46 - std::sys_common::backtrace::_print_fmt::hc7f3e3b5298b1083
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:68:5
     3:     0x55d9c7f25c46 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbb235daedd7c6190
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:44:22
     4:     0x55d9c7f4b570 - core::fmt::rt::Argument::fmt::h76c38a80d925a410
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/rt.rs:142:9
     5:     0x55d9c7f4b570 - core::fmt::write::h3ed6aeaa977c8e45
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/mod.rs:1120:17
     6:     0x55d9c7f2342f - std::io::Write::write_fmt::h78b18af5775fedb5
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/mod.rs:1810:15
     7:     0x55d9c7f25a24 - std::sys_common::backtrace::_print::h5d645a07e0fcfdbb
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:47:5
     8:     0x55d9c7f25a24 - std::sys_common::backtrace::print::h85035a511aafe7a8
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:34:9
     9:     0x55d9c7f27197 - std::panicking::default_hook::{{closure}}::hcce8cea212785a25
    10:     0x55d9c7f26ef9 - std::panicking::default_hook::hf5fcb0f213fe709a
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:292:9
    11:     0x55d9c7f27628 - std::panicking::rust_panic_with_hook::h095fccf1dc9379ee
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:779:13
    12:     0x55d9c7f27502 - std::panicking::begin_panic_handler::{{closure}}::h032ba12139b353db
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:657:13
    13:     0x55d9c7f26146 - std::sys_common::backtrace::__rust_end_short_backtrace::h9259bc2ff8fd0f76
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:171:18
    14:     0x55d9c7f27260 - rust_begin_unwind
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
    15:     0x55d9c7ea27e5 - core::panicking::panic_fmt::h784f20a50eaab275
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
    16:     0x55d9c7ea9f3a - build_script_build::execute::hbc4736f388b7b82a
    17:     0x55d9c7ea9976 - build_script_build::run::he8ae1f16b0712186
    18:     0x55d9c7ea8cd3 - build_script_build::main::hcfc9252a05fd2a7e
    19:     0x55d9c7eaaeb3 - core::ops::function::FnOnce::call_once::h69b966a051d1c3c4
    20:     0x55d9c7eaa696 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha21bc1e2f23e880e
    21:     0x55d9c7eaa939 - std::rt::lang_start::{{closure}}::h864902cc94152336
    22:     0x55d9c7f1ee91 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h37600b1e5eea4ecd
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284:13
    23:     0x55d9c7f1ee91 - std::panicking::try::do_call::hb4bda49fa13a0c2b
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
    24:     0x55d9c7f1ee91 - std::panicking::try::h8bbf75149211aaaa
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
    25:     0x55d9c7f1ee91 - std::panic::catch_unwind::h8c78ec68ebea34cb
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
    26:     0x55d9c7f1ee91 - std::rt::lang_start_internal::{{closure}}::hffdf44a19fd9e220
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:48
    27:     0x55d9c7f1ee91 - std::panicking::try::do_call::hcb3194972c74716d
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
    28:     0x55d9c7f1ee91 - std::panicking::try::hcdc6892c5f0dba4c
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
    29:     0x55d9c7f1ee91 - std::panic::catch_unwind::h4910beb4573f4776
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
    30:     0x55d9c7f1ee91 - std::rt::lang_start_internal::h6939038e2873596b
                                 at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:20
    31:     0x55d9c7eaa917 - std::rt::lang_start::h698ca701eec9f6fd
    32:     0x55d9c7eaa4a5 - main
    33:     0x7faeb41c010e - __libc_start_call_main
    34:     0x7faeb41c01c9 - __libc_start_main@@GLIBC_2.34
    35:     0x55d9c7ea3045 - _start
    36:                0x0 - <unknown>
warning: build failed, waiting for other jobs to finish...

and i see warnings (promoted to errors) that look like this:

  /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include/features.h:414:4: warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings]
    414 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)                                                                                                                                          
        |    ^                                                                                              
  1 warning generated.
  In file included from src/pac.c:1:
  In file included from include/jemalloc/internal/jemalloc_preamble.h:5:
  In file included from include/jemalloc/internal/jemalloc_internal_decls.h:4:
  In file included from /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include/math.h:27:
  In file included from /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include/bits/libc-header-start.h:33:
  /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include/features.h:414:4: warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings]
    414 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
        |    ^                                                                                                                                                                                                          
  1 warning generated.                                                                                                                                                                                                  
  In file included from src/peak_event.c:1:
  In file included from include/jemalloc/internal/jemalloc_preamble.h:5:
  In file included from include/jemalloc/internal/jemalloc_internal_decls.h:4:                
  In file included from /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include/math.h:27:                                                                                                                
  In file included from /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include/bits/libc-header-start.h:33:
  /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include/features.h:414:4: warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings]
    414 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)        
        |    ^                                                                                                                                                                                                          
  In file included from src/prof_data.c:1:                                                                                                                                                                              
  In file included from include/jemalloc/internal/jemalloc_preamble.h:5:                                                                                                                                                
  In file included from include/jemalloc/internal/jemalloc_internal_decls.h:4:
  In file included from /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include/math.h:27:                                                                                                                
  In file included from /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include/bits/libc-header-start.h:33:
  /nix/store/yp441ann6ch705yk708h61ywxn7ayhj3-glibc-2.39-52-dev/include/features.h:414:4: warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings]
    414 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
        |    ^                                                                     

these are observed with the following clang/llvm toolchain:

[nix-shell:~/linkerd/linkerd2-proxy]$ clang --version
clang version 17.0.6
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nix/store/95iw6rgr5fbmywa8cbpzqgyakfkjh0ka-clang-17.0.6/bin

however, i do not see this panic if i revert to an older version of clang,

[nix-shell:~/linkerd/linkerd2-proxy]$ clang --version
clang version 14.0.6
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nix/store/fx89cvsnz3wrx1ljsng8d54n6x4kq3cq-clang-14.0.6/bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions