unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Pal Gloss <pcfeb0009@gmx.com>
Cc: 45303@debbugs.gnu.org
Subject: bug#45303: #45303 [feature/native-comp] building error on Windows
Date: Sat, 19 Dec 2020 07:57:10 +0000	[thread overview]
Message-ID: <xjfh7oiw7mx.fsf@sdf.org> (raw)
In-Reply-To: <trinity-42fc7e60-66a7-4df6-9988-a496892c39a4-1608330104357@3c-app-mailcom-bs01> (Pal Gloss's message of "Fri, 18 Dec 2020 23:21:44 +0100")

Pal Gloss <pcfeb0009@gmx.com> writes:

> I retried building with the most recent feature/native-comp branch and if you
> skip to the last code block, you can see how I managed to build emacs with it
> and use it (I've been using a similar build on Win10 for about 2 days).  I can
> confirm that my previous hack for =nt/epaths.nt= is not needed anymore.
>  
> #+begin_src shell :exports code
>   git rev-parse HEAD feature/native-comp
> #+end_src
> : 87f6e937995c433825173fb0473a801791d5beac
> : 87f6e937995c433825173fb0473a801791d5beac

[...]

>   # patch to look for libgccjit-0.dll instead of libgcc.dll in 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

Okay this should be fixed by now.

>   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'
>   # fix linker errors by making sure the correct libraries are added to the linker command
>   sed -i -e 's/^LIBGCCJIT = *$/LIBGCCJIT = -lz -lgccjit/' src/Makefile
>   make -j"$PROCESSORS_TO_USE"
> #+end_src
>  
> Now I get a crash with a backtrace:
> #+begin_example
>   Backtrace:
>   00000004001afb22
>   00000004000b40a6
>   00000004000ccc64
>   000000040020a4ca
>   00007ff9e5f58040
>   00007ff9e6181847
>   00007ff9e614a881
>   00007ff9e61804b6
>   make[2]: *** [Makefile:297: ../../emacs/lisp/term/w32-win.elc] Error 3
>   make[1]: *** [Makefile:797: ../../emacs/lisp/term/w32-win.elc] Error 2
>   make[1]: Leaving directory '/home/cramaph1/emacs-native-comp/build/src'
>   make: *** [Makefile:434: src] Error 2
> #+end_example
>  
> This crash is due to the =#pragma GCC diagnostic= around a =if
> (gcc_jit_global_set_initializer)=: see this example program where the
> =#pragma= around the =if(...)= makes it into a separate statement from the
> ={...}= body.  Apparently, on my machine, =gcc_jit_global_set_initializer= is
> NULL but the body gets executed anyway.
> #+begin_src c :exports code
>   /* save as /tmp/t.c, then run (cd /tmp && gcc t.c && ./a.exe) */
>   /* It should print nothing at all, but on my machine, it prints
>   This should not be printed, but will be printed anyway (2).
>   This is gcc.exe (Rev6, Built by MSYS2 project) 10.2.0 */
>   #include <stdio.h>
>   int main() {
>     if (0)
>       {
>         printf("This will not be printed (1).\n");
>       }
>   #pragma GCC diagnostic ignored "-Waddress"
>     if (0)
>   #pragma GCC diagnostic pop
>       {
>         printf("This should not be printed, but will be printed anyway (2).\n");
>       }
>   #pragma GCC diagnostic ignored "-Waddress"
>     if (0)
>       {
>   #pragma GCC diagnostic pop
>         printf("This should not be printed (3).\n");
>       }
>     return 0;
>   }
> #+end_src
>
> So I try again, this time inverting the =#pragma GCC diagnostic pop= and the ={= lines, too:
> #+begin_src shell :exports code
>   cd ../emacs
>   rm -rf ../build
>   git restore .
>   # 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

Nice :)

While reporting the bug in GCC I've found this previous bugzilla report.

<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92696>

Interesting... should work now.

>   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

Should be fixed too.

[...]

> And now emacs 28.0.50 seems to work (there are some compilation issues with
> hyperbole, but my config is usable). If I do =M-: (apropos-value
> ’("%emacs_dir%") nil)=, I still see these directories that look fishy, but
> <F1> i works for me at the moment.
> #+begin_example
>   Info-default-directory-list
>      ("%emacs_dir%/share/info/")
>   ----------------
>   configure-info-directory
>      "%emacs_dir%/share/info"
> #+end_example

Right so (unless I'm forgetting something) just the zlib linker error
should be remaining, correct?

I'll have a look later in the weekend or Monday.

> Sorry for the wall of text, I am just trying to show that I built up my
> hacks/patches step by step and make sure they are still needed.

Thanks for the precise analysis this is very helpful.

The Windows port is a bit rusty, I believe nobody compiled it since 6+
months, is good we resurrect it and keep it running.

  Andrea





  reply	other threads:[~2020-12-19  7:57 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 20:20 bug#45303: 28.0.50; [feature/native-comp] comp.c compilation error on Windows 10 =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-17 20:31 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-17 20:33 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-17 20:41   ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-17 20:57     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-17 21:02       ` Eli Zaretskii
2020-12-17 21:10         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-17 21:27           ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-17 21:41             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-18 13:28               ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-18 16:06                 ` Eli Zaretskii
2020-12-18 16:37                   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-18 19:35                     ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-18 21:26                       ` Eli Zaretskii
2020-12-19  0:57                         ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-19  5:38                           ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-19  8:04                           ` Eli Zaretskii
2020-12-18 19:40                     ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-18 20:49                     ` Eli Zaretskii
2020-12-21  9:48                       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-19 17:56           ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-18 11:13 ` bug#45303: #45303 [feature/native-comp] building error on Windows Pal Gloss
2020-12-18 16:02   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-18 21:22     ` Eli Zaretskii
2020-12-18 22:21       ` Pal Gloss
2020-12-19  7:57         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2020-12-19 14:35           ` Andy Moreton
2020-12-19 16:15             ` Eli Zaretskii
2020-12-19 17:15               ` Andy Moreton
2020-12-19 17:37                 ` Eli Zaretskii
2020-12-19 21:39                   ` Andy Moreton
2020-12-19 18:07           ` Pal Gloss
2020-12-19 20:40             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-20 11:22               ` Andy Moreton
2020-12-20 18:58                 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-20 19:11                   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-21  0:53                     ` Andy Moreton
2020-12-21  8:02                       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-21  8:09                         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-21 17:41                           ` Andy Moreton
2020-12-20 16:23               ` Pal Gloss
2020-12-20 19:07                 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-21 10:10                   ` Pal Gloss
2020-12-21 12:08                     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-21 22:46                       ` Andy Moreton
2020-12-22  8:47                         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-22 19:41                           ` Andy Moreton
2020-12-21 16:21                     ` Eli Zaretskii
2020-12-18 22:25       ` Pal Gloss
2020-12-19 19:08 ` bug#45303: #45303 [feature/native-comp] building error on Windows ... strsignal in msys2/mingw64 Pal Gloss
2020-12-19 19:29   ` Eli Zaretskii
2020-12-20 16:15     ` Pal Gloss
2020-12-19 23:04 ` bug#45303: 28.0.50; [feature/native-comp] comp.c compilation error on Windows 10 =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-20  2:31   ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-20  8:38   ` Michael Albinus
2020-12-20  9:49     ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-20 19:10     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-20 19:46       ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-20 20:04         ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-20 16:32 ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-21 18:02 ` =?UTF-8?Q?Li=C4=81u, _?= Kiong-Gē 廖宮毅
2020-12-22 15:47 ` bug#45303: #45303 [feature/native-comp] building error on Windows gliao.tw--- via 
2020-12-22 19:15   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-22 19:48     ` gliao.tw--- via 
2020-12-22 20:09       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-22 20:15         ` gliao.tw--- via 
2020-12-22 20:21           ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-22 20:39             ` Eli Zaretskii
2020-12-23  7:01               ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-26 14:02                 ` edouard debry
2020-12-26 14:24                   ` Eli Zaretskii
2020-12-26 14:58                     ` edouard debry
2020-12-26 15:12                       ` Eli Zaretskii
2021-01-06 20:37             ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-12-22 19:46   ` Andy Moreton

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=xjfh7oiw7mx.fsf@sdf.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=45303@debbugs.gnu.org \
    --cc=akrl@sdf.org \
    --cc=pcfeb0009@gmx.com \
    /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).