unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Fabrice Popineau <fabrice.popineau@supelec.fr>
To: Eli Zaretskii <eliz@gnu.org>
Cc: cschol2112@googlemail.com, 9960@debbugs.gnu.org
Subject: bug#9960: Compiling Emacs trunk with MSVC
Date: Fri, 11 Nov 2011 20:28:21 +0100	[thread overview]
Message-ID: <CAFgFV9OaP0KcTjqAduEZ9bRtjgq3PSxL0HwaMBtHdkF6J=3zGQ@mail.gmail.com> (raw)
In-Reply-To: <8339dvgfpv.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 5914 bytes --]

>
> Yes, though if the changes are significant, they will probably not
> make it into Emacs 24.1.  Plus, I think you will need to sign legal
> papers to contribute more than what you already have.  (I can
> currently find on file your assignment only to Gnus.)
>
>
Ok, I'll do it if needed. Albeit it is almost only a matter of configuring
the right defines.


>  > I have added two other files : a 64bits manifest for emacs.exe and a
> > w32compat.h header file that is needed to compile the above mentioned
> > libraries. In my case, this w32compat.h is included while compiling
> image.c
> > for example.
>
> Is this for a 64-bit build, or is this needed for a 32-bit build as
> well?  If for a 32-bit built, then what exactly are the problems with
> image.c that requires w32compat.h?
>
>
The problem is that image.c includes png.h (for example) and png.h
may compile out of the box ... or not. In my case, I always try to compile
all the libraries with the same set of defines and options. So I included
this
file for completeness.

I have both the  7.1 MS SDK and VS2010 installed on my machine.
Using this w32compat.h plus the emacs/nt/inc and emacs/lib,
I was able to compile all the libraries
(32bits and 64 bits versions). And emacs too of course.



> > +#ifndef _MSC_VER
> >        extern char **environ;
> > +#endif
>
> Which MSVC header has the necessary declaration, and what is that
> declaration?
>

#include <stdlib.h>
is enough.

Extract :

#if !defined(_M_CEE_PURE)
#ifdef  _POSIX_
extern char ** environ;             /* pointer to environment table */
#else
_CRTIMP extern char ** _environ;    /* pointer to environment table */
_CRTIMP extern wchar_t ** _wenviron;    /* pointer to wide environment
table */
#endif  /* _POSIX_ */
#else

_CRTIMP char*** __cdecl __p__environ(void);
_CRTIMP wchar_t*** __cdecl __p__wenviron(void);
_CRT_INSECURE_DEPRECATE_GLOBALS(_get_pgmptr) _CRTIMP char** __cdecl
__p__pgmptr(void);
_CRT_INSECURE_DEPRECATE_GLOBALS(_get_wpgmptr) _CRTIMP wchar_t** __cdecl
__p__wpgmptr(void);

#define _environ   (*__p__environ())
#define _wenviron  (*__p__wenviron())
#define _pgmptr    (*__p__pgmptr())
#define _wpgmptr   (*__p__wpgmptr())

#endif /* !defined(_M_CEE_PURE) */


> > --- lib/strftime.c    2011-03-31 04:24:03 +0000
> > +++ lib/strftime.c    2011-11-10 17:39:37 +0000
> > @@ -36,9 +36,14 @@
> >  #include <ctype.h>
> >  #include <time.h>
> >
> > +#ifdef _MSC_VER
> > +#define tzname _tzname
> > +#else
> >  #if HAVE_TZNAME && !HAVE_DECL_TZNAME
> >  extern char *tzname[];
>
> Can we instead modify the #define on src/s/ms-w32.h so as to include
> versions of MSVC above 1400?  Or does that not work for some reason?


Ok, I removed the restriction on MSVC version below 1400 and that is
compiling.


> > --- lisp/bindings.el  2011-10-08 16:37:46 +0000

> +++ lisp/bindings.el  2011-11-10 17:49:35 +0000
> > @@ -824,13 +824,13 @@
> >  ;; Define control-digits.
> >  (let ((i ?0))
> >    (while (<= i ?9)
> > -    (define-key global-map (read (format "[?\\C-%c]" i))
> 'digit-argument)
> > +;    (define-key global-map (read (format "[?\\C-%c]" i))
> 'digit-argument)
> >      (setq i (1+ i))))
> >  (define-key global-map [?\C--] 'negative-argument)
> >  ;; Define control-meta-digits.
> >  (let ((i ?0))
> >    (while (<= i ?9)
> > -    (define-key esc-map (read (format "[?\\C-%c]" i)) 'digit-argument)
> > +;    (define-key esc-map (read (format "[?\\C-%c]" i)) 'digit-argument)
> >      (setq i (1+ i))))
> >  (define-key global-map [?\C-\M--] 'negative-argument)
>
> Why is this part needed?
>

I would like to know. I get an error when bootstrapping at these lines :
invalid read syntax.
If someone has a suggestion on how to investigate it, I'd like to hear it:

Loading bindings (source)...
Invalid read syntax: "?"
NMAKE : fatal error U1077:
'C:\Source\XEmTeX\mirror\emacs\src/obj-spd/i386/temacs.exe' : return code
'0xffffffff'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio
10.0\VC\Bin\nmake.exe"' : return code '0x2'
Stop.

It is failing only while bootstrapping, not during  the regular build.


> === modified file 'src/makefile.w32-in'
> > --- src/makefile.w32-in       2011-11-05 22:55:08 +0000
> > +++ src/makefile.w32-in       2011-11-10 02:16:49 +0000
> > @@ -177,7 +177,7 @@
> >  $(TEMACS):      $(TLIB0) $(TLIB1) $(TLIB2) $(TLASTLIB) $(TOBJ) $(TRES) \
> >                 ../nt/$(BLD)/addsection.exe $(GNULIB)
> >       $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ)
> $(TRES) $(LIBS)
> > -     "$(THISDIR)/../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)"
> EMHEAP 21
> > +     "$(THISDIR)/../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)"
> EMHEAP 42
>
> Is such a large heap really needed for a 32-bit MSVC build?  Or is it
> for the 64-bit build?


I tried to double it for the 64 bits build in the hope it will let me go a
bit further.
Maybe that size is not needed even in this case. So forget it for the
moment.

Also, it seems that it is possible to declare segments using #pragma
and that they can even be resized using the editbin tool (available with
the sdk). That may make addsection useless, and wrt to a 64bits build,
I would be more confident in using the sdk tools if possible.

I'll try to remove the use of addsection if possible. Well, if someone has
a good reason
for which it is not possible, let me know.



> -#if (defined(_MSC_VER) && defined(emacs)) || defined(USE_CRT_DLL)
> > +#if (defined(_MSC_VER) && defined(emacs))
> >  #define malloc e_malloc
> >  #define free   e_free
> >  #define realloc e_realloc
>
> What was the problem that required this change?


Linking all other programs except emacs.
For the other programs, you surely don't want to define malloc to be
e_malloc  ?

Being able to link against libc or msvcrt is confusing.
Wouldn't it be better if only MSVCRT was supported ?
Does the build work with the static libc ?

Best regards,

Fabrice

[-- Attachment #2: Type: text/html, Size: 8653 bytes --]

  reply	other threads:[~2011-11-11 19:28 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <loom.20101206T214649-301@post.gmane.org>
     [not found] ` <83sjy5279e.fsf@gnu.org>
     [not found]   ` <AANLkTikmhiNmd5gz8wkpqbgHni2LKkjhTtnPizaOEz7T@mail.gmail.com>
2011-11-05 11:19     ` bug#9960: Compiling Emacs trunk with MSVC Eli Zaretskii
2011-11-05 11:39       ` Eli Zaretskii
2011-11-05 12:54         ` Christoph Scholtes
2011-11-05 13:22           ` Eli Zaretskii
2011-11-05 13:58             ` Christoph Scholtes
2011-11-05 14:16               ` Eli Zaretskii
2011-11-05 14:53                 ` Eli Zaretskii
2011-11-05 15:51                   ` Óscar Fuentes
2011-11-05 16:10                     ` Eli Zaretskii
2011-11-05 16:27                 ` Christoph Scholtes
2011-11-05 16:50                   ` Eli Zaretskii
2011-11-05 16:57                     ` Eli Zaretskii
2011-11-05 17:22                     ` Christoph Scholtes
2011-11-05 18:20                       ` Christoph Scholtes
2011-11-05 19:33                         ` Eli Zaretskii
2011-11-05 20:38                           ` Christoph Scholtes
2011-11-05 21:11                             ` Eli Zaretskii
2011-11-05 22:07                               ` Christoph Scholtes
2011-11-05 22:15                                 ` Christoph Scholtes
2011-11-05 22:22                                   ` Christoph Scholtes
2011-11-06  4:03                                     ` Eli Zaretskii
2011-11-05 20:32                         ` Christoph Scholtes
2011-11-05 21:27                           ` Eli Zaretskii
2011-11-05 22:23                             ` Christoph Scholtes
2011-11-06  1:50                               ` Christoph Scholtes
2011-11-06  5:47                                 ` Eli Zaretskii
2011-11-06  5:37                               ` Eli Zaretskii
2011-11-07 16:13                             ` Fabrice Popineau
2011-11-07 16:57                               ` Eli Zaretskii
     [not found]                                 ` <CAFgFV9N4w+wi4J84BhoEZrgAuwJdFZtWzOAkdb_T9+B7L+Ftfg@mail.gmail.com>
2011-11-08 16:51                                   ` Eli Zaretskii
2011-11-07 17:03                               ` Eli Zaretskii
2011-11-10 19:56                                 ` Fabrice Popineau
2011-11-10 20:28                                   ` Lennart Borgman
2011-11-10 20:31                                     ` Juanma Barranquero
2011-11-10 20:29                                   ` Juanma Barranquero
2011-11-20 20:59                                     ` Fabrice Popineau
2011-11-20 21:15                                       ` Juanma Barranquero
2011-11-20 21:35                                         ` Dan Nicolaescu
2011-11-20 21:40                                           ` Juanma Barranquero
2011-11-21  2:30                                         ` Stefan Monnier
2011-11-21  2:45                                           ` Juanma Barranquero
2011-11-21  3:51                                             ` Eli Zaretskii
2011-11-21  8:21                                               ` Andreas Schwab
2011-11-21  9:54                                                 ` Eli Zaretskii
2011-11-21 12:14                                               ` Juanma Barranquero
2011-11-21 13:56                                                 ` Eli Zaretskii
2011-12-04  8:06                                                   ` Fabrice Popineau
2011-12-05  5:11                                                     ` Eli Zaretskii
2011-11-21 15:55                                       ` Richard Stallman
2011-11-11  9:39                                   ` Eli Zaretskii
2011-11-11 19:28                                     ` Fabrice Popineau [this message]
2011-11-11 19:53                                       ` Eli Zaretskii
2011-11-11 21:55                                         ` Fabrice Popineau
2011-11-12 13:50                                           ` Eli Zaretskii
2011-11-12 14:34                                             ` Fabrice Popineau
2011-11-12 15:59                                               ` Óscar Fuentes
2011-11-12 23:32                                                 ` Richard Stallman
2011-11-12 14:27                                       ` Eli Zaretskii
2011-11-12 17:55                                         ` Fabrice Popineau
2011-11-12 20:48                                           ` Eli Zaretskii
2011-11-12 22:27                                             ` Fabrice Popineau
2011-11-12 22:44                                               ` Fabrice Popineau
2011-11-12 23:08                                                 ` Fabrice Popineau
2011-11-13 14:45                                                   ` Christoph Scholtes
2011-11-27 19:05                                       ` Eli Zaretskii
2011-11-28  9:18                                         ` YAMAMOTO Mitsuharu
2011-11-28 11:51                                           ` Eli Zaretskii
2011-11-28 19:07                                         ` Fabrice Popineau
2012-03-24 13:46                                           ` Eli Zaretskii
2012-03-24 16:10                                             ` Fabrice Popineau
2012-03-24 18:42                                               ` Eli Zaretskii
2011-11-12 17:10                                   ` Christoph Scholtes
2011-11-12 20:37                                     ` Eli Zaretskii
2011-11-05 23:44         ` Fabrice Popineau
2011-11-06  3:42           ` Christoph Scholtes
2011-11-06  4:02           ` Eli Zaretskii
2011-11-08  6:43       ` bug#9960: fix for Bug#9772 should also help fix Bug#9960 Paul Eggert
2011-11-28  9:34       ` bug#9960: "emacsclient.c (main) <environ>: Remove declaration, " breaks build on Mac OS X David Caldwell
2011-11-28 17:29       ` bug#9960: : " Leon Zhang
2011-11-30 15:48       ` bug#9960: Compiling Emacs trunk with MSVC Tim Crews
2011-11-30 16:30         ` Tim Crews
2011-11-30 18:04         ` Eli Zaretskii
2011-11-30 18:22           ` Tim Crews
2011-11-30 19:17             ` Eli Zaretskii
2011-11-30 19:42               ` Tim Crews

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='CAFgFV9OaP0KcTjqAduEZ9bRtjgq3PSxL0HwaMBtHdkF6J=3zGQ@mail.gmail.com' \
    --to=fabrice.popineau@supelec.fr \
    --cc=9960@debbugs.gnu.org \
    --cc=cschol2112@googlemail.com \
    --cc=eliz@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).