From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pal Gloss Newsgroups: gmane.emacs.bugs Subject: bug#45303: #45303 [feature/native-comp] building error on Windows Date: Fri, 18 Dec 2020 12:13:40 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/html; charset=UTF-8 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9559"; mail-complaints-to="usenet@ciao.gmane.io" To: 45303@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 18 16:49:10 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1kqI0D-0002FF-AU for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Dec 2020 16:49:09 +0100 Original-Received: from localhost ([::1]:49006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kqI0C-0000HL-DB for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Dec 2020 10:49:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kqHsM-0002Tr-Jr for bug-gnu-emacs@gnu.org; Fri, 18 Dec 2020 10:41:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56370) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kqHsM-0006ht-9O for bug-gnu-emacs@gnu.org; Fri, 18 Dec 2020 10:41:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kqHsM-0004uw-6k for bug-gnu-emacs@gnu.org; Fri, 18 Dec 2020 10:41:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Pal Gloss Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Dec 2020 15:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45303 X-GNU-PR-Package: emacs Original-Received: via spool by 45303-submit@debbugs.gnu.org id=B45303.160830602918847 (code B ref 45303); Fri, 18 Dec 2020 15:41:02 +0000 Original-Received: (at 45303) by debbugs.gnu.org; 18 Dec 2020 15:40:29 +0000 Original-Received: from localhost ([127.0.0.1]:39677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kqHrn-0004ts-GA for submit@debbugs.gnu.org; Fri, 18 Dec 2020 10:40:29 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:38453) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kqDhi-0008Aa-SG for 45303@debbugs.gnu.org; Fri, 18 Dec 2020 06:13:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1608290020; bh=ENhY9mCGNHGsUJGhTlZUEuyoJZuzWpZgf1UZirqGAkk=; h=X-UI-Sender-Class:From:To:Subject:Date; b=LXpgTD9S6DtpE/hWTVnPzP9SdZewov7j/U6YIm1lF2cIyCifdT85035zQjwBSYuIp tdjOdRczuN12hMeDYrq74obZu2MiKSofO8AQeORuaT7LpqbXi7OHkCcGSdoP0pVxRl ABaIfT/EkPGQzMcMGQkKc4SEKPBogQfCOPhNv+5Q= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [185.84.24.1] ([185.84.24.1]) by web-mail.gmx.net (3c-app-mailcom-bs08.server.lan [172.19.170.176]) (via HTTP); Fri, 18 Dec 2020 12:13:40 +0100 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:ZFbj81L/8JM1UOMSBMuWsAKiMckOHm+rIFLmowkXK+jAiWbcbKxAwHodq/lzLogErU/dt 6Vyb55DEMki7ITY7UGdkiwYey6HQJEIvyOqtULX+RShiRpWIzyBDUoPAbdXwlfFZ9lj/oKDaFqNj +9OLunYkcVP/fmBXL3yB4u62ksaiJ22BIhTQH+VPXbZnvm5kia2srbGdX5ADIsEGg2pyjpRh4zoh oGO4SMqbm3o+72gLAogVjeW5f1eIQvTXi+Lg8aoOeAkWMkUinxMOsU9uYoM0Ph4cZrVWkCkWcpks zc= X-UI-Out-Filterresults: notjunk:1;V03:K0:1oatt7T584A=:Rkp6w+gZyEVsfMUP2WG4Kk oVZ6+Iz54yfjhWWnKTKzE8DOFJYRQEMwfSsQzPj+5Fv3ec+JZ0CaKffJNLcKCctZUVW2dnQmV tOlaOlDM2O5XapO52CQ15vUPbz0w/fPk0SUJekmpVP1Ww4vTsDGj1/aHxYdPtOzlK0+y41IMO WlbVvsfop8YhWobl4yzs3eWkzxnzG9Lv+U6VQRgldGeTAU4t43y+8wYR0DCOceRLH7NpK59Vn tku4i+AGmnAgHZfJuR6ohWvxXWmsAiEuhGOHloUixxNgHObNiVXphSOtF8A0pF100vYRLUBes Fww9OYSWFEc5zXAyb4ZOYOl0iMvJbiE9LaPuF08G8VOm79PNx+WYHrgZgHSpYUW5k90mJJEsf DNbwXvL19ys3e1r5fE6mkn89Fvd5wCrN3od2myeUsL5JEJs0PlBqtEVCC+6jEVVGwePVpYWNu UVJM8Jw37gXEwpdWtjfeSgUsNhnU+SymjU/66Cu3+DBiGQ2abqSxcDrxHtqQ2cnN0yehnJ5LV KYkIjw415/qJ+4hQeNDh0Y6FYzJ2Ca9FzZJmsJsom+Tvd+qPIt1mgskjkNdDcDQDg/nwNnu1N AhrYyqkuxE9FI= X-Mailman-Approved-At: Fri, 18 Dec 2020 10:40:26 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:196331 Archived-At:
Hi,
 
Just in case this helps (sorry I did not have time to split up this into separate bug reports, but it will help [I hope] fix the problems encountered): here are the notes/hacks/command lines I used to build a recent gccemacs on my Win10 machine with mingw64:
 
#+begin_src shell :exports code
  git rev-parse HEAD feature/native-comp
#+end_src
: 682bd303470d4a0fcd2690aff6aa58fb720a8d41
: 682bd303470d4a0fcd2690aff6aa58fb720a8d41
 
#+begin_src shell :exports code
  pacman -S --needed base-devel \
    mingw-w64-x86_64-toolchain \
    mingw-w64-x86_64-xpm-nox \
    mingw-w64-x86_64-libtiff \
    mingw-w64-x86_64-giflib \
    mingw-w64-x86_64-libpng \
    mingw-w64-x86_64-libjpeg-turbo \
    mingw-w64-x86_64-librsvg \
    mingw-w64-x86_64-lcms2 \
    mingw-w64-x86_64-jansson \
    mingw-w64-x86_64-libxml2 \
    mingw-w64-x86_64-gnutls \
    mingw-w64-x86_64-zlib \
    mingw-w64-x86_64-harfbuzz \
    mingw-w64-x86_64-libgccjit
  PROCESSORS_TO_USE="3"
  EMACS_VERSION=emacs-native-comp
  ./autogen.sh
  # edit nt/epaths.nt to add PATH_REL_LOADSEARCH:
  grep -q PATH_REL_LOADSEARCH nt/epaths.nt || echo '#define PATH_REL_LOADSEARCH ""' >> nt/epaths.nt
  # patch to look for libgccjit-0.dll instead of libgcc.dll?  lisp/term/w32-win.el & src/emacs.c
  sed -i -e 's/libgccjit.dll/libgccjit-0.dll/' lisp/term/w32-win.el
  sed -i -e 's/libgccjit.dll/libgccjit-0.dll/' src/emacs.c
  # patch to avoid gcc_jit_global_set_initializer (crashes on my machine...; it
  # seems there is an interaction with the #pragma and the rest of the parsing
  # because the statement is incomplete?) and to adapt to (new) 5th parameter to
  # directory-files
  sed -i -e '/if (gcc_jit_global_set_initializer)/,/{/ {
               /#pragma GCC diagnostic pop/d
               /{/a #pragma GCC diagnostic pop
             }' \
         -e '/internal_condition_case_4/,/FOR_EACH/ {
               s/internal_condition_case_4/internal_condition_case_5/
               s/Qt, return_nil);/Qnil, Qt, return_nil);/
             }' \
         src/comp.c
  sed -i -e '/extern Lisp_Object internal_condition_case_4/a extern Lisp_Object internal_condition_case_5 (Lisp_Object (*) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object));' src/lisp.h
  sed -i -e '/Like internal_condition_case_1 but call BFUN with ARG1, ARG2, ARG3, ARG4 as/ {
               s/ARG4 as/ARG4, ARG5 as/
               a    its arguments.  */
               a Lisp_Object
               a internal_condition_case_5 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object,
               a                                                 Lisp_Object, Lisp_Object,
               a                                                 Lisp_Object),
               a                            Lisp_Object arg1, Lisp_Object arg2,
               a                            Lisp_Object arg3, Lisp_Object arg4,
               a                            Lisp_Object arg5,
               a                            Lisp_Object handlers,
               a                            Lisp_Object (*hfun) (Lisp_Object))
               a {
               a   struct handler *c = push_handler (handlers, CONDITION_CASE);
               a   if (sys_setjmp (c->jmp))
               a     {
               a       Lisp_Object val = handlerlist->val;
               a       clobbered_eassert (handlerlist == c);
               a       handlerlist = handlerlist->next;
               a       return hfun (val);
               a     }
               a   else
               a     {
               a       Lisp_Object val = bfun (arg1, arg2, arg3, arg4, arg5);
               a       eassert (handlerlist == c);
               a       handlerlist = c->next;
               a       return val;
               a     }
               a }
               a /* Like internal_condition_case_1 but call BFUN with ARG1, ARG2, ARG3, ARG4 as
             }' src/eval.c
  sed -i -e '/PATH_EXEC, 0);/ {
               s/.*/#ifdef WINDOWSNT/
               a /* On MS-Windows, PATH_EXEC normally starts with a literal
               a    "%emacs_dir%", so it will never work without some tweaking. */
               a w32_relocate (PATH_EXEC),
               a #else
               a PATH_EXEC,
               a #endif
               a 0);
             }' src/callproc.c
  mkdir -p ../build
  cd ../build
  ../emacs/configure \
        --with-xml2 \
        --without-pop \
        --prefix="/home/cramaph1/$EMACS_VERSION/dest" \
        --without-compress-install \
        --without-dbus \
        --with-nativecomp \
        --with-modules 'CFLAGS=-O2 -g3' 'LIBGCCJIT=-lz -lgccjit'
  sed -i -e 's/^LIBGCCJIT = *$/LIBGCCJIT = -lz -lgccjit/' src/Makefile
  make -j"$PROCESSORS_TO_USE"
  make install
#+end_src