Talk:DeveloperWiki:Building in a clean chroot

From ArchWiki
Jump to navigation Jump to search

mkarchroot reads from local pacman.conf

I just ran the mkarchroot without providing any custom confs and yet it started syncing the repos I have in my local pacman.conf. Is there anything I am missing? --Maevius (talk) 08:57, 6 December 2012 (UTC)

Can you still reproduce this? -- Alad (talk) 13:35, 19 July 2018 (UTC)

clean-chroot-manager

Would adding some information about clean-chroot-manager be appropriate here? I have been using clean-chroot-manager recently and it has made my life much easier for developing and testing PKGBUILDS. --Dmp1ce (talk) 01:13, 30 January 2019 (UTC)

The only officially supported scripts are devtools. There are other helpers mentioned on the AUR helpers page. -- Lahwaacz (talk) 08:00, 30 January 2019 (UTC)
I agree that this is best discussed on the AUR helpers page, furthermore, there are many such wrappers, including clean-chroot-manager, aurutils, and ch, so discussing which unofficial wrapper to use is a bit out of scope. Also my ideal wrapper would be to install a /usr/share/devtools/pacman-custom.conf and a symlink from /usr/bin/archbuild to /usr/bin/custom-x86_64-build. It's already pretty modular. -- Eschwartz (talk) 23:09, 30 January 2019 (UTC)
Such a "custom-x86_64-build" would not handle local repos, would it? In particular, I don't see where it bind-mounts the corresponding file:// paths to pull in dependencies. -- Alad (talk) 23:29, 30 January 2019 (UTC)
It should work fine with repositories served over http (it's been done in the past on https://pkgbuild.com, as I recall) and furthermore if the repository is listed as a CacheDir it will be bind-mounted by default. -- Eschwartz (talk) 00:57, 31 January 2019 (UTC)

Create a 32-bit chroot

To replace Building 32-bit packages on a 64-bit system, which is out of date and full of little quirks that contradict the standard method advised here--if this method is still of any use at all. This creates a chroot that will build natively 32-bit versions of packages; ie they will have the same names and use the same file locations as their native counterparts.

This is probably most of use for packages (if any still exist or and are used by anyone) that never compiled correctly as lib32- packages, or as an example of how the clean-chroot method can be used as a cross-compiler. quequotion (talk) 13:20, 14 March 2019 (UTC)

This is not relevant for official packages, so why don't you update Building 32-bit packages on a 64-bit system instead? -- Lahwaacz (talk) 16:49, 16 March 2019 (UTC)
Done, but again there's nothing to indicate that the instructions here apply only to official packages. It is often recommended to packagers and users alike to try the clean-chroot method to debug or more safely build packages without regard to their official or unofficial status. I'd rather not have two pages about clean chroot methods, but this definitely does not fit within the scope of the Makepkg page. If there's really no way to fit it in here I can make do with it having its own page. quequotion (talk) 16:07, 18 March 2019 (UTC)

Proposal: Setting up a 32-bit chroot

Making a clean, 32bit chroot, is much like #Setting up a chroot.

First, create a directory in which the chroot will reside. For example, $HOME/chroot32.

$ mkdir ~/chroot32

Copy /etc/pacman.conf and /etc/makepkg.conf into this directory and specify 32-bit options in them:

In ~/chroot32/pacman.conf, set: Architecture = i686

Note: Comment out any [multilib] repositories!

In ~/chroot32/makepkg.conf, set:

CARCH="i686"
CHOST="i686-unknown-linux-gnu"
CFLAGS="-march=i686 -mtune=generic -O2 -pipe"
CXXFLAGS="-march=i686 -mtune=generic -O2 -pipe"

Then create the chroot:

$ mkarchroot -C ~/chroot32/pacman.conf -M ~/chroot32/makepkg.conf ~/chroot32/root base-devel

Specify this chroot to makechrootpkg to build i686 packages:

$ makechrootpkg -c -r ~/chroot32/