Open jake-arkinstall opened 3 years ago
It is assumed that the system has libgfortran
available.
That isn't the case. You can try that out on the docker image by running apt install gfortran
and/or apt install libgfortran5
before bazel build
. It still can't link with libgfortran because gfortran isn't in path provided to the runtime. I've also tried providing it with libgfortran within bazel, but to no avail - not that this would solve the issue, because the developer needs to start adding dependencies that depend on whether X, Y or Z is available on the target system.
The underlying issue is that the runtime environment is hermetic but the setup environment is leaky - as far as I can tell, vpip is given access to system libraries, so any setup process that searches for available resources in the path that it has access to is prone to creating dependencies that aren't be available at runtime.
The underlying issue is that the runtime environment is hermetic but the setup environment is leaky - as far as I can tell, vpip is given access to system libraries, so any setup process that searches for available resources in the path that it has access to is prone to creating dependencies that aren't be available at runtime.
Yes, that's a well-known Bazel sandboxing hole: https://github.com/bazelbuild/bazel/issues/7313
This being the case, I'm wondering two things:
In Numpy, at least, a configuration can be provided using a site.cfg
file. Is there a chance of a mid-step before download and installation that allows for swapping out configuration files before the installation?
If setup can't be hermetic, then it's likely that other packages are also impacted - and their respective solutions may be very different. How about a wiki page which users can post approaches that they've found for setting up packages successfully?
We use a site.cfg
to point scipy
to our copy of OpenBLAS.
We avoid the hermeticity problem by building everything with a minimal sandbox root fs. https://github.com/bazelbuild/bazel/issues/6994#issuecomment-457438551
The underlying issue is that the runtime environment is hermetic but the setup environment is leaky - as far as I can tell, vpip is given access to system libraries, so any setup process that searches for available resources in the path that it has access to is prone to creating dependencies that aren't be available at runtime.
Yes, that's a well-known Bazel sandboxing hole: bazelbuild/bazel#7313
The upstream issue has been resolved, can this be closed?
When trying to install numpy, I found that it failed to import because it depended on libraries that it could not access - CBLAS and LAPACK - resulting in
undefined symbol
errors (sometimescblas_dot
, sometimessaxpy_
, sometimes_gfortran_concat_string
, depending on what you have installed, and what you have tried to provide via Bazel dependencies). The numpy wheel comes bundled with the necessary libraries but bypasses their installation if it finds implementations on the host system - allowing users to utilise alternative implementations suited to their needs.A minimal reproduction in a docker image showed no problem - numpy worked fine - so the same code worked or borked depending on the host - indicative of a hermeticity issue. To verify, I installed openblas to the docker image before the numpy package is installed, and this gives it
undefined symbol
errors when trying to import numpy.I've attached a MWE. Inside is a simple project that simply imports numpy, prints hello world, and outputs a simple mean to demonstrate numpy doing something. This is done within a docker environment to isolate the build from the host machine.
There are two dockerfiles:
working.Dockerfile
andbroken.Dockerfile
. The only difference between the two is thatbroken.Dockerfile
installslibopenblas-dev
before runningbazel build
.To reproduce, download dbx_build_tools_bug.tar.gz and:
Running the working docker image outputs:
And running the 'broken' docker image outputs: