We study the Bishop-Phelps-Bollobàs property
$\left( \text{BPBp} \right)$ for compact operators. We present some abstract techniques that allow us to carry the
$\text{BPBp}$ for compact operators from sequence spaces to function spaces. As main applications, we prove the following results. Let
$X$ and
$Y$ be Banach spaces. If
$\left( {{c}_{0}},Y \right)$ has the
$\text{BPBp}$ for compact operators, then so do
$\left( {{C}_{0}}\left( L \right),Y \right)$ for every locally compact Hausdorff topological space
$L$ and
$\left( X,\,Y \right)$ whenever
${{X}^{*}}$ is isometrically isomorphic to
${{\ell }_{1}}$.
If
${{X}^{*}}$ has the Radon-Nikodým property and
$\left( {{\ell }_{1}}\left( X \right),\,Y \right)$ has the
$\text{BPBp}$ for compact operators, then so does
$\left( {{L}_{1}}\left( \mu ,X \right),\,\,Y \right)$ for every positive measure
$\mu $; as a consequence,
$\left( {{L}_{1}}\left( \mu ,X \right),\,\,Y \right)$ has the
$\text{BPBp}$ for compact operators when
$X$ and
$Y$ are finite-dimensional or
$Y$ is a Hilbert space and
$X={{c}_{0}}$ or
$X={{L}_{p}}\left( v \right)$ for any positive measure
$v$ and
$1\,<\,p\,<\,\infty $. For
$1\,\le p\,<\,\infty$, if
$\left( X,{{l}_{p}}(Y) \right)$ has the
$\text{BPBp}$ for compact operators, then so does
$\left( X,{{L}_{p}}\left( \mu ,\,Y \right) \right)$ for every positive measure
$\mu $ such that
${{L}_{1}}\left( \mu \right)$ is infinite-dimensional. If
$\left( X,\,Y \right)$ has the
$\text{BPBp}$ for compact operators, then so do
$\left( X,\,{{L}_{\infty }}\left( \mu ,\,\,Y \right) \right)$ for every
$\sigma $-finite positive measure
$\mu $ and
$\left( X,\,C\left( K,\,Y \right) \right)$ for every compact Hausdorff topological space
$K$.