Fix static archives stripping (#5905)
* Do not strip static archives Stripping static archives without more fine-grained options (e.g. `-g`) leads to failures such as ld: libfoo.a: error adding symbols: archive has no index; run ranlib to add one because GNU strip removes *every* symbol in a static archive by default. Given that static archives are not final build artifacts (unlike executables and shared libraries), stripping them gains little and only causes more edge case failures. * Gentoo's portage only strips debug information:pull/5906/head86f211e3a5/bin/estrip (L322)
* Fedora also only strips debug information:e9c13c6565/scripts/brp-strip-static-archive (L18)
* Debian also only does some very light stripping:72ed1d3261/dh_strip (L374)
Fixes #4138 * Add test case for static archive stripping
parent
c9042fc3ee
commit
e19a49b895
10 changed files with 91 additions and 1 deletions
@ -0,0 +1,4 @@ |
||||
#include <stdio.h> |
||||
#include <libA.h> |
||||
|
||||
int main() { printf("The answer is: %d\n", libA_func()); } |
@ -0,0 +1,4 @@ |
||||
#include <stdio.h> |
||||
#include <libB.h> |
||||
|
||||
int main() { printf("The answer is: %d\n", libB_func()); } |
@ -0,0 +1,7 @@ |
||||
project('app', ['c']) |
||||
|
||||
a = dependency('test-a') |
||||
b = dependency('test-b') |
||||
|
||||
executable('appA', files('appA.c'), dependencies : a) |
||||
executable('appB', files('appB.c'), dependencies : b) |
@ -0,0 +1,5 @@ |
||||
#include <libA.h> |
||||
|
||||
static int libA_func_impl(void) { return 0; } |
||||
|
||||
int libA_func(void) { return libA_func_impl(); } |
@ -0,0 +1 @@ |
||||
int libA_func(void); |
@ -0,0 +1,5 @@ |
||||
#include <libB.h> |
||||
|
||||
static int libB_func_impl(void) { return 0; } |
||||
|
||||
int libB_func(void) { return libB_func_impl(); } |
@ -0,0 +1 @@ |
||||
int libB_func(void); |
@ -0,0 +1,23 @@ |
||||
project('lib', ['c']) |
||||
|
||||
pkg = import('pkgconfig') |
||||
|
||||
a = library('test-a', files('libA.c'), install: true) |
||||
install_headers(files('libA.h'), subdir: 'libA') |
||||
pkg.generate( |
||||
a, |
||||
version: '0.0', |
||||
description: 'test library libA', |
||||
filebase: 'test-a', |
||||
name: 'test library libA', |
||||
subdirs: 'libA') |
||||
|
||||
b = static_library('test-b', files('libB.c'), install: true) |
||||
install_headers(files('libB.h'), subdir: 'libB') |
||||
pkg.generate( |
||||
b, |
||||
version: '0.0', |
||||
description: 'test library libB', |
||||
filebase: 'test-b', |
||||
name: 'test library libB', |
||||
subdirs: 'libB') |
Loading…
Reference in new issue