From cc128c788562d6d86c24cbcb784e1e8fca1f06a1 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 7 Nov 2019 14:22:07 +1300 Subject: [PATCH] lib/fuzzing/oss-fuzz: copy required libraries to the build target This is an alternative to static linking as we do not have static source libraries for all the things we depend on. Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall Reviewed-by: Uri Simchoni --- lib/fuzzing/oss-fuzz/build_samba.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/fuzzing/oss-fuzz/build_samba.sh b/lib/fuzzing/oss-fuzz/build_samba.sh index 481af28f9ed..aa8e223b0a1 100755 --- a/lib/fuzzing/oss-fuzz/build_samba.sh +++ b/lib/fuzzing/oss-fuzz/build_samba.sh @@ -30,4 +30,17 @@ export LD make -j -cp bin/fuzz_* $OUT/ +# Make a directory for the system shared libraries to be copied into +mkdir -p $OUT/lib + +# We can't static link to all the system libs with waf, so copy them +# to $OUT/lib and set the rpath to point there. This is similar to how +# firefox handles this. + +for x in bin/fuzz_* +do + cp $x $OUT/ + bin=`basename $x` + ldd $OUT/$bin | cut -f 2 -d '>' | cut -f 1 -d \( | cut -f 2 -d ' ' | xargs -i cp \{\} $OUT/lib/ + chrpath -r '$ORIGIN/lib' $OUT/$bin +done -- 2.47.3