nix based build system (was problem with configure and libGL on CentOS 6.5)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

nix based build system (was problem with configure and libGL on CentOS 6.5)

Ben Coman
 
On Thu, Apr 27, 2017 at 9:33 AM, Eliot Miranda <[hidden email]> wrote:
 
Hi All,

    I just tried to build 64-bit VMs in build.linux64x64 on CentOS 6.5, a system I've been building such VMs on for a long time now.  The configure step produced a config.h which specifies

#define HAVE_GL_GL_H 1
#define USE_X11_GLX 1

but -lGL was not added to the X_LIBS= line in the generated vm-display-X11/Makefile

Anyone know why this is or how to fix it?  It's frustrating not to be able to build out of the box on linux :-(

_,,,^..^,,,_
best, Eliot


Sorry this doesn't help right now (and I have a side question so I'll start a new thread)
 
and maybe its something changed recently in our build,
but the nix packaging system I recently tuned in on would seem to solve some of these problem. 

IIUC, you can rock up anywhere, and replicate the *exact* same build environment on *any* linux machine.  Good for setting up partners and new contributors.  
@Eliot, would this be something worthwhile for me to look into?

@Luke, how would you rate the feasibility of a binary built on nix 
being packaged for other linux distributions?

cheers -ben
Reply | Threaded
Open this post in threaded view
|

Re: nix based build system (was problem with configure and libGL on CentOS 6.5)

Luke Gorrie
 
On 27 April 2017 at 05:40, Ben Coman <[hidden email]> wrote:
@Luke, how would you rate the feasibility of a binary built on nix 
being packaged for other linux distributions?

Could be instructive to check out how nix itself is built and distributed. They have a nix expression that builds nix (a C++ application), creates binary tarball/deb/rpm packages for multiple architectures, and tests each one in a virtual machine running the appropriate Linux distro.

Code:

Products (via CI):

How to run the build including all tests in VMs (go for lunch the first time you run it...):

# Pin the exact same toolchain version as the Nix CI uses
$ pkgs=https://github.com/nixos/nixpkgs-channels/archive/05db33f79b8b012107bab29e47f27ce3b8aa4aca.tar.gz
$ nix-build -I nixpkgs=$pkgs nix/release.nix

Could work for Pharo too? Guessing there are a lot of potential pitfalls with the configure script reporting aspects of the build environment that don't match the target environment, but since you guys are already distributing binaries you have probably dealt with those already. The only extra step would be a 'patchelf' command to set the dynamic library paths the way you want them to point (as Alistair is doing for the Pharo "Snap" package.)

(My own experience is that distributing binaries for Linux is a hard problem, even getting glibc to link is fraught with symbol versioning leakage and so on, but guessing you guys know much more about this than I do and that Nix is one of the best tools for the job.)

P.S. Great nix paper: Automating System Tests using Declarative Virtual Machines. Explains their approach to CI. Seems to work well.


Reply | Threaded
Open this post in threaded view
|

Re: nix based build system (was problem with configure and libGL on CentOS 6.5)

Luke Gorrie
 
On 27 April 2017 at 09:22, Luke Gorrie <[hidden email]> wrote:
How to run the build including all tests in VMs (go for lunch the first time you run it...):

... if you really want to run this then it's probably worth giving e.g. '-j 10' to nix-build to parallelize downloads and execution, and also to test from the stable branch of nix instead of the master branch (git clone -b 1.11-maintenance ...).

Note: Nix CI is also able to distribute builds across many machines automatically. This can make the big multiplatform builds and tests fast. I usually work with a Nix CI that has ~ 20 build machines and this lets us do nice things like run a machine-week of benchmark regression tests overnight. But I digress... :-)


Reply | Threaded
Open this post in threaded view
|

Re: nix based build system (was problem with configure and libGL on CentOS 6.5)

Luke Gorrie
 
On 27 April 2017 at 09:41, Luke Gorrie <[hidden email]> wrote:
On 27 April 2017 at 09:22, Luke Gorrie <[hidden email]> wrote:
How to run the build including all tests in VMs (go for lunch the first time you run it...):

... if you really want to run this then it's probably worth giving e.g. '-j 10' to nix-build to parallelize downloads and execution, and also to test from the stable branch of nix instead of the master branch (git clone -b 1.11-maintenance ...).

I actually ran the nix build process now for the first time myself :).

Observations:

By default it builds for Linux-i386, Linux-x86-64, and Darwin-x86-64. These platforms are all available in the CI but probably not on your local machine. So could pick a specific attribute to build e.g. '-A deb_ubuntu1604i386' at the end of the nix-build command.

Interesting that to setup the VMs it actually _bootstraps_ nearly a dozen Linux distributions e.g. downloads the individual '.deb' files for an Ubuntu release and creates an image using 'debootstrap' with exactly the packages that the test suite wants. They could have otherwise taken a ready-made image from the vendor (with verified sha256 hash) but the bootstrapping seems to allow a lot of control over the build/runtime environment for a test case.

Interesting that my machine is actually performing the bootstrapping of these images. In principle it could just download the cached image from the Nix CI because the builds are referentially transparent. I suppose that those binaries are not available, probably because the stable version of nix was built a ways back and its intermediate build/test artefacts have been garbage collected on the CI server. So they are built locally on my machine instead (and then cached until I clear them out here with 'nix-collect-garbage'.)

After all the downloading and building it does work for me and produce packages:

$ nix-build -j 10 -I nixpkgs=$pkgs nix/release.nix -A deb_ubuntu1604i386
... lots of activity bootstrapping an ubuntu VM, etc...
$ ls result/debs/
nix_1.11.9pre1234-abcdef-1_i386.deb
$ file result/debs/nix_1.11.9pre1234-abcdef-1_i386.deb 
result/debs/nix_1.11.9pre1234-abcdef-1_i386.deb: Debian binary package (format 2.0)


Reply | Threaded
Open this post in threaded view
|

Re: nix based build system (was problem with configure and libGL on CentOS 6.5)

K K Subbu
In reply to this post by Luke Gorrie
 
On Thursday 27 April 2017 12:52 PM, Luke Gorrie wrote:
> How to run the build including all tests in VMs (go for lunch the first
> time you run it...):

If you have RAM to spare, have you tried mounting tmpfs on the build
directory?

Regards .. Subbu