From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: The 'cross' directory Date: Wed, 16 Aug 2023 23:32:46 +0200 Message-ID: References: <83fs4uok3p.fsf@gnu.org> <877cq61hlq.fsf@yahoo.com> <87jzu4yioy.fsf@yahoo.com> <83pm3rcxh7.fsf@gnu.org> <83r0o4a5sl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39200"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: rms@gnu.org, luangruo@yahoo.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 16 23:34:04 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qWO9U-0009uJ-12 for ged-emacs-devel@m.gmane-mx.org; Wed, 16 Aug 2023 23:34:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWO8T-00057A-0u; Wed, 16 Aug 2023 17:33:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWO8P-000559-H7 for emacs-devel@gnu.org; Wed, 16 Aug 2023 17:32:57 -0400 Original-Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWO8L-0005kX-BH; Wed, 16 Aug 2023 17:32:56 -0400 Original-Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-3fe4ad22e36so66106365e9.2; Wed, 16 Aug 2023 14:32:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692221568; x=1692826368; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZJd1I25ehO6JbeWnp4GnFM6OFpouVFhN0A9KwkhzMXU=; b=M1FYsdyE6lBZW6SnCwikYvQ5iu0iyLQcOl4vdkEKD+x+Y9/0vrfKivPwdSgJaYCvhI tHvJYaWbOANXMofL5oJIaNzk/lkY+ANqlTe4hm6j8ieKT1jHzCkk3iLC0FOBXw86Fip9 MkAKZdUxj88b6lI94caNkKCa4VZBv/nFoFwbUOP3RekuWWVLiobYgQYC7TnrNYtUFhoJ ca1MCB+p2fqXS4nyXBeHdXB1OLspD1296KEyVYdxeAzjhroTLO0gOh1Rl0613pYuT2RG 7llJzN42KePx7uFcFPFzTBWNWAwuPcAQPQzLKknG2zLhgQPjt4qhDAST7takIl4TEWfD fkzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692221568; x=1692826368; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZJd1I25ehO6JbeWnp4GnFM6OFpouVFhN0A9KwkhzMXU=; b=llPvTcLIw3NfOtoA50NHJsj0F347XFUvyzAlJn9+SJAU0lM6RXqjGkgE2mf9OYelaJ eqNQw3BYl4MRL5ZfMFOr+rizMc0lmMvbdPZCETPa5lHD6FLNWueHk54XsHQslHdp3vyX oWsLioqCiYykbDy/QfEZMjZBgc/JEZcglAYV0UDhz6bEpXc4djUFytTLS1w5oV4eHT0m uFok9V2zyAvLVi9DwT40P+PP0b+dxG4X6LcRNZlPWzH9cBrPqIjoF/JHGvo/U5dFidFk XrvRo58O3TgyQAUzp965fycG6lTRhT6WkOdjZ+ZMMLY38NPzvOBa57CheswUlXu0r9S0 znkw== X-Gm-Message-State: AOJu0YyrIbK3vqAWnaPPv8LxhjBMDXcwizJD6bCjCH4C+z4nJTAbHUYL iceiemmklBOcAQN5FWkPMA52XLjx9as= X-Google-Smtp-Source: AGHT+IGkoQiPBltAz6mrX4DE27qXSIhNB1Hxgd7wPEYv/My/7GqgZ89Vip8dUAhl94DGy6NY0tDiTA== X-Received: by 2002:a7b:c3d4:0:b0:3f9:c82e:9d87 with SMTP id t20-20020a7bc3d4000000b003f9c82e9d87mr2434913wmj.13.1692221568105; Wed, 16 Aug 2023 14:32:48 -0700 (PDT) Original-Received: from caladan (dial-181023.pool.broadband44.net. [212.46.181.23]) by smtp.gmail.com with ESMTPSA id 4-20020a05600c228400b003fbbe41fd78sm634049wmf.10.2023.08.16.14.32.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Aug 2023 14:32:47 -0700 (PDT) In-Reply-To: <83r0o4a5sl.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 15 Aug 2023 14:44:42 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=eller.helmut@gmail.com; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308838 Archived-At: On Tue, Aug 15 2023, Eli Zaretskii wrote: >> From: Helmut Eller >> 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