Skip to content

Commit 6ef20c3

Browse files
authored
Simplify has_addr2line check to not link with C++ Standard Library (#216)
Fixes: #209
1 parent cec5700 commit 6ef20c3

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
- toolset: gcc-9
2828
cxxstd: "03,11,14,17,2a"
2929
os: ubuntu-22.04
30+
install: g++-9
3031
- toolset: clang-15
3132
cxxstd: "03,11,14,17,2a"
3233
os: ubuntu-22.04

build/has_addr2line.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
// Copyright Antony Polukhin, 2016-2020.
1+
// Copyright Antony Polukhin, 2016-2025.
22
//
33
// Distributed under the Boost Software License, Version 1.0. (See
44
// accompanying file LICENSE_1_0.txt or copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

77
#include <cstdlib>
8-
#include <string>
98

109
#include <boost/config.hpp>
1110
#include <unwind.h>
@@ -15,11 +14,10 @@
1514
int main() {
1615

1716
#ifdef BOOST_STACKTRACE_ADDR2LINE_LOCATION
18-
std::string s = BOOST_STRINGIZE( BOOST_STACKTRACE_ADDR2LINE_LOCATION );
19-
s += " -h";
17+
const char* s = BOOST_STRINGIZE( BOOST_STACKTRACE_ADDR2LINE_LOCATION ) " -h";
2018
#else
21-
std::string s = "/usr/bin/addr2line -h";
19+
const char* s = "/usr/bin/addr2line -h";
2220
#endif
2321

24-
return std::system(s.c_str());
22+
return std::system(s);
2523
}

0 commit comments

Comments
 (0)