From: Helmut Eller <eller.helmut@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rms@gnu.org, luangruo@yahoo.com, emacs-devel@gnu.org
Subject: Re: The 'cross' directory
Date: Wed, 16 Aug 2023 23:32:46 +0200 [thread overview]
Message-ID: <m25y5er7up.fsf@gmail.com> (raw)
In-Reply-To: <83r0o4a5sl.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 15 Aug 2023 14:44:42 +0300")
On Tue, Aug 15 2023, Eli Zaretskii wrote:
>> From: Helmut Eller <eller.helmut@gmail.com>
>> Is it possible/easy to cross-compile Emacs for Windows on a Unix
>> machine? Possibly with the help of Wine for dumping.
>
> Maybe, I don't know. I never tried, and neither I think has anyone
> else.
I tried it now. It kinda works, but it's not easy. What follows is a
summary of the steps that I did, for the unlikely case that somebody is
interested in these things:
1. Run configure with:
configure --host=x86_64-w64-mingw32 --without-gnutls
--without-libsystemd --without-xml2 --without-dbus
--prefix=/z/opt/emacs -C CFLAGS="-g -O1"
The crucial bit here is the --host argument. The --without-X
switches are only needed because the configure script incorrectly
detects those features. The --prefix option is probably not needed,
as I didn't actually call "make install".
2. This produced errors like:
./build-aux/msys-to-w32: line 79: pwd: -W: invalid option
The -W option seems to be a cygwin/msys specific option, for printing
Windows filenames in a form like c:/foo/bar. I tried to replace this
with "winepath -w" but that uses the form c:\foo\bar and so it didn't
work either. In the end I removed the -W option and edited the
src/epaths.h file manually. In particular
#define PATH_DUMPLOADSEARCH "Z:/emacs-mingw/lisp"
must be set correctly, otherwise temacs will abort in init_charset.
3. Executing "make" goes a bit further, but while building emacsclient
an error like
can't open icon file `icons\emacs.ico': No such file or directory
occurs. In emacsclient.rc.in, I replaced icons\emacs.ico with
icons/emacs.ico. This is probably safe, as emacs.rc.in also uses
forward slashes.
4. Executing "make" now wants to execute make-docfile.exe, but can't.
In autoconf terminology, make-docfile is executed on the build
machine and not on the host machine. However the Makefiles aren't
prepared for such a distinction. For a while I tried to introduce
CC_FOR_BUILD and CLFAGS_FOR_BUILD variables, patterned after the
configure scripts of the binutits. That kinda worked for
make-docfile, but not well enough make-fingerprint, which is needed a
bit later and has the same problem.
So I gave up on CC_FOR_BUILD and instead copied make-docfile and
make-fingerprint from a normal, non-cross build directory, like
cp ../emacs-git/lib-src/make-docfile lib-src/make-docfile.exe
cp ../emacs-git/lib-src/make-fingerprint lib-src/make-fingerprint.exe
5. After that, "make" continues until it wants to run temacs the first
time.
To pass this hurdle, I created a script, wine-temacs.sh, that
basically executes: wine $emacsdir/src/temacs.exe "$@"
It's a bit more complicated than that, because wine, mysteriously,
can't print to stderr and instead produces helpful messages of the
form:
Z:\emacs-mingw\src\emacs.exe: Write error to standard output: Success
Maybe my wine installation is just botched.
Anyway, running temacs with wine actually produces
bootstrap-emacs.pdmp.
6. Now "make RUN_TEMACS=$(pwd)/src/wine-temacs.sh" wants run bootstrap-emacs
to produce all the .elc files.
For that I wrote another script, wine-bootstrap-emacs.sh, that just
like wine-temacs.sh, runs bootstrap-emacs.exe in wine.
7. Now "make RUN_TEMACS=$(pwd)/src/wine-temacs.sh \
bootstrap_exe=$(pwd)/src/wine-bootstrap-emacs.sh"
wants to compile the .elc files.
This would be slow, so I aborted and instead copied all the .elc
files from the non-cross build and touched them like
find . -name '*.elc' -exec touch {} +
so that Make would consider them new.
8. Even with all the .elc files in place, make still wants to execute
bootstrap-emacs for things like
GEN ../lisp/leim/quail/CCDOSPY.el
or
GEN ../../lisp/cedet/semantic/bovine/c-by.el
or
ELC ../lisp/loaddefs.elc
I just waited and let it proceed, as I didn't know any shortcuts.
9. Eventually it creates the all important emacs.pdmp.
At that point make, still wants to continue, this time executing
emacs.exe. For which I wrote the thirt script, wine-emacs.sh, which
does again the usual.
10. Now "make RUN_TEMACS=$(pwd)/src/wine-temacs.sh \
bootstrap_exe=$(pwd)/src/wine-bootstrap-emacs.sh \
EMACS=$(pwd)/src/wine-emacs.sh"
still doesn't stop and produces things like
GEN autoloads
...
ELC cedet/semantic/grammar-wy.elc
...
GEN org.texi
...
11. Eventually it aborts with
*** "make all" succeeded, but Emacs is not functional.
The filename used in the sanity-check can't be easily overriden so I
stopped here.
Executing "wine src/emacs.exe" does however start an GUI Emacs and at
least the basic things seem to work. "wine src/emacs.exe -nw" mostly
works, but some keys like, C-c, '(' and ')' seem to get lost somewhere.
In "wineconsole src/emacs.exe -nw" all keys seem to work as expected,
but it's a "choppy" experience as wine (or emacs) seems to sleep for a
moment after every few keystrokes.
It also starts on a real Windows laptop. I used sshfs to mount the
build directory and executed emacs.exe there. So that wasn't a proper
installation as "make install" would, of course, not have worked on
Windows.
Helmut
next prev parent reply other threads:[~2023-08-16 21:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-07 17:09 The 'cross' directory Eli Zaretskii
2023-08-08 0:51 ` Po Lu
2023-08-09 3:47 ` Richard Stallman
2023-08-09 3:54 ` Po Lu
2023-08-13 1:43 ` Richard Stallman
2023-08-13 2:10 ` Po Lu
2023-08-13 2:14 ` Emanuel Berg
2023-08-13 5:39 ` Eli Zaretskii
2023-08-15 8:05 ` Helmut Eller
2023-08-15 11:44 ` Eli Zaretskii
2023-08-16 21:32 ` Helmut Eller [this message]
2023-08-17 7:44 ` Eli Zaretskii
2023-08-17 18:52 ` Helmut Eller
2023-08-15 9:45 ` Richard Stallman
2023-08-10 2:15 ` Richard Stallman
2023-08-10 16:37 ` Jose E. Marchesi
2023-08-10 17:01 ` [External] : " Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m25y5er7up.fsf@gmail.com \
--to=eller.helmut@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=luangruo@yahoo.com \
--cc=rms@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).