Skip to content

SIGSEGV when compiled with boost 1.88 and link-time optimization #1832

@bartlibert

Description

@bartlibert

When the library is built with boost 1.88 and link-time optimization, I get an immediate segfault in any program linked with cpprestsdk.

I have patched the library to be able to compile with boost 1.88.
I use the following patches:
boost-1.88.patch
warnings.patch
fix-clang-dll-import.patch

Minimal test case program

#include <iostream>
int main (int argc, char *argv[]) {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

Compile and link with cpprestsdk:
g++ test.cpp -lcpprest -lcrypto

Running the resulting binary results in an immediate segmentation fault. Backtrace:

#0  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<true> (this=0x7fffffffb7f0, __str=0x0, __n=0x0)
    at /usr/include/c++/15.2.1/bits/basic_string.tcc:298
#1  0x00007ffff7eb3721 in _sub_I_65535_0.0 () from /usr/lib/libcpprest.so.2.10
#2  0x00007ffff7fc82a7 in call_init (l=<optimized out>, argc=0x1, argv=0x7fffffffb978, env=0x7fffffffb988) at dl-init.c:74
#3  call_init (l=<optimized out>, argc=0x1, argv=0x7fffffffb978, env=0x7fffffffb988) at dl-init.c:26
#4  0x00007ffff7fc837d in _dl_init (main_map=0x7ffff7ffe2f0, argc=0x1, argv=0x7fffffffb978, env=0x7fffffffb988) at dl-init.c:121
#5  0x00007ffff7fe0ba0 in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#6  0x0000000000000001 in ?? ()
#7  0x00007fffffffbdf4 in ?? ()
#8  0x0000000000000000 in ?? ()

When disabling link-time optimization during compilation of cpprestsdk, the segfault is gone and everything works as expected.

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