[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] Creating a chroot for cross-building lmi
From: |
Greg Chicares |
Subject: |
[lmi] Creating a chroot for cross-building lmi |
Date: |
Fri, 2 Sep 2016 01:31:12 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.8.0 |
Here, between scissors lines, is a quasi-script that successfully
creates a debian-8 chroot and cross-builds lmi for msw there.
Some comments and questions follow the script. I call it only a
"quasi-script" because I've tested it by cutting and pasting each
line or block of lines; interaction is required at several points,
e.g., to enter passwords that I don't want to write in a script.
--------8<--------8<--------8<--------8<--------8<--------8<--------8<--------
# Create a chroot for cross-building lmi--with wine, which is
# required to run programs built in the chroot.
# Starting in a normal terminal, enter a root shell.
su
mkdir -p /srv/chroot/cross3
apt-get update
apt-get install schroot debootstrap
# If the connection hiccups, 'debootstrap' doesn't seem to resume,
# so keep trying until it succeeds.
debootstrap --arch=amd64 jessie /srv/chroot/cross3
http://httpredir.debian.org/debian
while [ $? -ne 0 ]; do !!; done
cat >/etc/schroot/chroot.d/cross3.conf <<\EOF
[cross3]
description=debian-8 cross build with wine
directory=/srv/chroot/cross3
users=greg
groups=greg
root-groups=root
EOF
# Exit root shell (return to normal shell).
exit
# This command--to start a root shell in the chroot--can be run as a
# normal user. It will prompt for the root password.
schroot --chroot=cross3 --user=root --directory=/
# enter password
# Add i386 before installing wine, so that wine can run 32-bit .exe's .
dpkg --add-architecture i386
apt-get update
apt-get install g++-mingw-w64-i686 automake libtool make pkg-config \
git zsh bzip2 unzip sudo wine
# Don't worry about messages like these:
# E: Can not write log (Is /dev/pts mounted?)
# [FAIL] Can't start system message bus - /proc is not mounted ... failed!
# It's okay that /dev/pts and /proc are not mounted in this chroot.
addgroup --gid=1000 greg
adduser --gid=1000 --uid=1000 greg
# enter user password, twice
# then just press Enter repeatedly to accept defaults
mkdir -p /opt/lmi
chown greg:greg /opt/lmi
mkdir -p /cache_for_lmi
chown greg:greg /cache_for_lmi
chsh -s /bin/zsh greg
touch /home/greg/.zshrc
chown greg:greg /home/greg/.zshrc
# Substitute your system's $DISPLAY below:
cat >/home/greg/.zshrc <<\EOF
export WINEPATH='Z:\\opt\\lmi\\local\\bin;Z:\\opt\\lmi\\local\\lib'
export LMI_HOST=i686-w64-mingw32
export PATH="/opt/lmi/local/bin:/opt/lmi/local/lib:$PATH"
# At a regular user prompt, outside the chroot, do this:
# $ echo $DISPLAY
# and replace :0.0 below with the string it returns:
export DISPLAY=":0.0"
export coefficiency='--jobs=32'
# export TZ=UCT
# export LANG=en_US.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE=C.UTF-8
# No--better to do this:
# update-locale LANG=en_US.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE=C.UTF-8
# bindkey "\e[3~" delete-char # Del
# bindkey '\e[H' beginning-of-line # Home
# bindkey '\e[F' end-of-line # End
bindkey "^[[1;5D" backward-word # Ctrl-left
bindkey "^[[1;5C" forward-word # Ctrl-right
bindkey '\e[1;3D' backward-word # Alt-left
bindkey '\e[1;3C' forward-word # Alt-right
prompt='%d[%?]%(!.#.$)'
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.history
setopt HIST_IGNORE_DUPS
autoload -U compinit
compinit -u
EOF
# Repair /usr/share/libtool/config/ltmain.sh as indicated here:
# http://lists.gnu.org/archive/html/libtool-patches/2011-06/msg00001.html
# Do this as root because root owns the file.
cat >/home/greg/ltmain.sh.patch <<\EOF
--- /usr/share/libtool/config/ltmain.sh.original 2016-01-25 03:43:07.768000000
+0000
+++ /usr/share/libtool/config/ltmain.sh 2016-01-25 03:44:17.100000000 +0000
@@ -4178,7 +4178,8 @@
/* declarations of non-ANSI functions */
#if defined(__MINGW32__)
# ifdef __STRICT_ANSI__
-int _putenv (const char *);
+ /* int _putenv (const char *); */
+_CRTIMP int _putenv (const char *);
# endif
#elif defined(__CYGWIN__)
# ifdef __STRICT_ANSI__
EOF
patch --dry-run --strip=0 </home/greg/ltmain.sh.patch \
&& patch --strip=0 </home/greg/ltmain.sh.patch
# Exit from the root shell in the chroot.
exit
# If cached lmi downloads are available elsewhere, copy them, e.g.:
# cp -a /srv/chroot/cross1/cache_for_lmi/* /srv/chroot/cross3/cache_for_lmi/
# This optional step merely conserves bandwidth.
# Enter the chroot as a normal user
schroot --chroot=cross3
wget -N 'http://git.savannah.gnu.org/cgit/lmi.git/plain/install_msw.sh'
chmod +x install_msw.sh
./install_msw.sh >log 2>&1
-------->8-------->8-------->8-------->8-------->8-------->8-------->8--------
I anticipate running this periodically, so I'd much prefer to cache
the 'debootstrap' step. I tried splitting it into these two steps:
debootstrap --arch=amd64 --download-only jessie /srv/cache
http://httpredir.debian.org/debian
debootstrap --arch=amd64 --second-stage
--second-stage-target=/srv/chroot/cross3 file:///srv/cache
but the '--second-stage' step failed with this message:
cat: /usr/share/debootstrap/suite: No such file or directory
What am I doing wrong?
And is there a way to cache downloads for this step:
apt-get update
apt-get install g++-mingw-w64-i686 automake libtool make pkg-config \
git zsh bzip2 unzip sudo wine
which I'm doing as root inside the chroot (which runs a later version
of debian than my real system)?
During 'debootstrap', I see messages like this:
# E: Can not write log (Is /dev/pts mounted?)
# [FAIL] Can't start system message bus - /proc is not mounted ... failed!
and I just ignore them, because the chroot seems to work perfectly.
What negative consequences could this have?
The '~/.zshrc' created by the quasi-script suggests running
update-locale LANG=en_US.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE=C.UTF-8
but I haven't installed 'update-locale' in the chroot. This doesn't
seem to matter: time is UTC, and text like
tn_range.hpp:/// This class's raison d'ĂȘtre is to
prints e-circonflexe correctly. BTW, `locale` shows all LC_* facets set
to "POSIX".
When the last step
./install_msw.sh >log 2>&1
finishes, I see a popup messagebox:
Wine could not find a Mono package...see http://wiki.winehq.org/Mono
I simply hit Cancel, and everything seems fine, and I never see it again.
'install_msw.sh' makes the lmi 'install' target, which does this:
@cd $(data_dir); $(PERFORM) $(bin_dir)/product_files$(EXEEXT)
where $PERFORM is 'wine'; this is the first time 'wine' is used in the
chroot, and apparently the first time it's run it checks for 'mono'.
This shouldn't matter, because 'mono' is some "dot-net" thing we don't
need. Debian is aware of it:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677094
so I guess we should just live with the nuisance for now.
- [lmi] Creating a chroot for cross-building lmi,
Greg Chicares <=
- Re: [lmi] Creating a chroot for cross-building lmi, Vadim Zeitlin, 2016/09/08
- [lmi] Missing system directories in chroot [Was: Creating a chroot for cross-building lmi], Greg Chicares, 2016/09/15
- Re: [lmi] Missing system directories in chroot [Was: Creating a chroot for cross-building lmi], Vadim Zeitlin, 2016/09/15
- Re: [lmi] Missing system directories in chroot [Was: Creating a chroot for cross-building lmi], Greg Chicares, 2016/09/15
- Re: [lmi] Missing system directories in chroot [Was: Creating a chroot for cross-building lmi], Vadim Zeitlin, 2016/09/16
- Re: [lmi] Missing system directories in chroot [Was: Creating a chroot for cross-building lmi], Greg Chicares, 2016/09/16
- Re: [lmi] Missing system directories in chroot [Was: Creating a chroot for cross-building lmi], Vadim Zeitlin, 2016/09/16
- Re: [lmi] Missing system directories in chroot [Was: Creating a chroot for cross-building lmi], Greg Chicares, 2016/09/16
- Re: [lmi] Missing system directories in chroot [Was: Creating a chroot for cross-building lmi], Vadim Zeitlin, 2016/09/16
- Re: [lmi] Missing system directories in chroot [Was: Creating a chroot for cross-building lmi], Greg Chicares, 2016/09/16