From: Andrew Bartlett Date: Thu, 7 Nov 2019 01:22:07 +0000 (+1300) Subject: lib/fuzzing/oss-fuzz: copy required libraries to the build target X-Git-Tag: ldb-2.1.0~644 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cc128c788562d6d86c24cbcb784e1e8fca1f06a1;p=thirdparty%2Fsamba.git 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 --- 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