unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17176: 24.3.50; Problem with manifests on cygw32 build with new binutils
@ 2014-04-02 19:07 Ken Brown
  2014-04-02 19:38 ` Daniel Colascione
  2014-04-02 20:29 ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Ken Brown @ 2014-04-02 19:07 UTC (permalink / raw)
  To: 17176

binutils has changed so that, on Cygwin, executables have a manifest 
built in by default.  A consequence is that the cygw32 build of emacs 
produces an emacs.exe which, after it is stripped, won't run:

$ ./emacs-stripped.exe
-bash: ./emacs-stripped.exe: cannot execute binary file

This is presumably caused by the fact that the cygw32 build already 
incorporates a manifest via nt/emacs.res.  The following patch fixes 
this and does some related manifest-related cleanup:

=== modified file 'configure.ac'
--- configure.ac        2014-03-27 21:29:32 +0000
+++ configure.ac        2014-04-02 17:47:41 +0000
@@ -1834,11 +1834,6 @@
    W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o"
    W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o"
    EMACSRES="emacs.res"
-  case "$canonical" in
-    x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;;
-    *) EMACS_MANIFEST="emacs-x86.manifest" ;;
-  esac
-  UPDATE_MANIFEST=update-game-score.exe.manifest
    if test "${opsys}" = "cygwin"; then
      W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32"
      W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool"
@@ -1846,6 +1841,11 @@
      # the rc file), not a linker script.
      W32_RES_LINK="-Wl,emacs.res"
    else
+    case "$canonical" in
+      x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;;
+      *) EMACS_MANIFEST="emacs-x86.manifest" ;;
+    esac
+    UPDATE_MANIFEST=update-game-score.exe.manifest
      W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o"
      W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32"
      W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32 -lusp10"

=== modified file 'nt/emacs.rc'
--- nt/emacs.rc 2014-03-21 10:12:53 +0000
+++ nt/emacs.rc 2014-04-02 18:30:53 +0000
@@ -1,10 +1,12 @@
  Emacs ICON   icons/emacs.ico
  32649 CURSOR icons/hand.cur
-#if defined (WIN64) || defined (__x86_64__)
+#ifndef __CYGWIN__
+#ifdef WIN64
  1 24 "emacs-x64.manifest"
  #else
  1 24 "emacs-x86.manifest"
  #endif
+#endif

  #ifndef VS_VERSION_INFO
  #define VS_VERSION_INFO 1

=== modified file 'src/Makefile.in'
--- src/Makefile.in     2014-01-12 17:27:17 +0000
+++ src/Makefile.in     2014-04-02 18:29:50 +0000
@@ -259,7 +259,7 @@

  ## emacs.res if HAVE_W32
  EMACSRES = @EMACSRES@
-## emacs-*.manifest if HAVE_W32
+## emacs-*.manifest if WINDOWSNT
  EMACS_MANIFEST = @EMACS_MANIFEST@
  ## If HAVE_W32, compiler arguments for including
  ## the resource file in the binary.


OK to apply to the emacs-24 branch?

Ken





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#17176: 24.3.50; Problem with manifests on cygw32 build with new binutils
  2014-04-02 19:07 bug#17176: 24.3.50; Problem with manifests on cygw32 build with new binutils Ken Brown
@ 2014-04-02 19:38 ` Daniel Colascione
  2014-04-02 20:29 ` Eli Zaretskii
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Colascione @ 2014-04-02 19:38 UTC (permalink / raw)
  To: Ken Brown, 17176

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

On 04/02/2014 12:07 PM, Ken Brown wrote:
> binutils has changed so that, on Cygwin, executables have a manifest
> built in by default.  A consequence is that the cygw32 build of emacs
> produces an emacs.exe which, after it is stripped, won't run:
> 
> $ ./emacs-stripped.exe
> -bash: ./emacs-stripped.exe: cannot execute binary file
> 
> This is presumably caused by the fact that the cygw32 build already
> incorporates a manifest via nt/emacs.res.  The following patch fixes
> this and does some related manifest-related cleanup:

Looks good to me. Thanks.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#17176: 24.3.50; Problem with manifests on cygw32 build with new binutils
  2014-04-02 19:07 bug#17176: 24.3.50; Problem with manifests on cygw32 build with new binutils Ken Brown
  2014-04-02 19:38 ` Daniel Colascione
@ 2014-04-02 20:29 ` Eli Zaretskii
  2014-04-02 20:59   ` Eli Zaretskii
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2014-04-02 20:29 UTC (permalink / raw)
  To: Ken Brown; +Cc: 17176

> Date: Wed, 02 Apr 2014 15:07:23 -0400
> From: Ken Brown <kbrown@cornell.edu>
> 
> binutils has changed so that, on Cygwin, executables have a manifest 
> built in by default.  A consequence is that the cygw32 build of emacs 
> produces an emacs.exe which, after it is stripped, won't run:
> 
> $ ./emacs-stripped.exe
> -bash: ./emacs-stripped.exe: cannot execute binary file
> 
> This is presumably caused by the fact that the cygw32 build already 
> incorporates a manifest via nt/emacs.res.

Are you sure this is the cause?  If so, can you explain how stripping
makes this problem rear its head?  What do you see in the .rsrc
section in the unstripped and in stripped emacs.exe?





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#17176: 24.3.50; Problem with manifests on cygw32 build with new binutils
  2014-04-02 20:29 ` Eli Zaretskii
@ 2014-04-02 20:59   ` Eli Zaretskii
  2014-04-02 22:19     ` Ken Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2014-04-02 20:59 UTC (permalink / raw)
  To: kbrown; +Cc: 17176

> Date: Wed, 02 Apr 2014 23:29:35 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 17176@debbugs.gnu.org
> 
> > Date: Wed, 02 Apr 2014 15:07:23 -0400
> > From: Ken Brown <kbrown@cornell.edu>
> > 
> > binutils has changed so that, on Cygwin, executables have a manifest 
> > built in by default.  A consequence is that the cygw32 build of emacs 
> > produces an emacs.exe which, after it is stripped, won't run:
> > 
> > $ ./emacs-stripped.exe
> > -bash: ./emacs-stripped.exe: cannot execute binary file
> > 
> > This is presumably caused by the fact that the cygw32 build already 
> > incorporates a manifest via nt/emacs.res.
> 
> Are you sure this is the cause?  If so, can you explain how stripping
> makes this problem rear its head?  What do you see in the .rsrc
> section in the unstripped and in stripped emacs.exe?

Also, what about those Cygwin users who didn't yet upgrade to this new
version of Binutils? they will be left with no manifest.

And are you sure the Cygwin manifest does everything our manifest
does?

If there's a linker switch to disable this automatic embedding of
Cygwin manifest, I'd suggest to use it, at least for emacs-24 branch.
That sounds like a better short-run solution.

Failing that, a configure-time test for this version of Binutils will
be needed, I think.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#17176: 24.3.50; Problem with manifests on cygw32 build with new binutils
  2014-04-02 20:59   ` Eli Zaretskii
@ 2014-04-02 22:19     ` Ken Brown
  2014-04-03  2:48       ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Ken Brown @ 2014-04-02 22:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 17176

On 4/2/2014 4:59 PM, Eli Zaretskii wrote:
>> Date: Wed, 02 Apr 2014 23:29:35 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>> Cc: 17176@debbugs.gnu.org
>>
>>> Date: Wed, 02 Apr 2014 15:07:23 -0400
>>> From: Ken Brown <kbrown@cornell.edu>
>>>
>>> binutils has changed so that, on Cygwin, executables have a manifest
>>> built in by default.  A consequence is that the cygw32 build of emacs
>>> produces an emacs.exe which, after it is stripped, won't run:
>>>
>>> $ ./emacs-stripped.exe
>>> -bash: ./emacs-stripped.exe: cannot execute binary file
>>>
>>> This is presumably caused by the fact that the cygw32 build already
>>> incorporates a manifest via nt/emacs.res.
>>
>> Are you sure this is the cause?

No, but I don't think it matters.  I think the patch is correct anyway, 
for reasons I'll explain below.

> Also, what about those Cygwin users who didn't yet upgrade to this new
> version of Binutils? they will be left with no manifest.

They don't need one.  Cygwin binaries generally have no manifest (prior 
to the Binutils change).  The only exceptions are for programs that need 
a manifest to avoid UAC problems because their names happen to contain 
"update" or "patch", for instance.  Not that Binutils has changed, 
people doing builds on Cygwin never have to think about manifests even 
in these exceptional cases.

The fact that the cygw32 build of emacs uses a manifest is a consequence 
(probably unintended, but only Daniel could say for sure) of the fact 
that emacs.res is linked in.  And the only reason for linking in 
emacs.res is to get the emacs icon into the cygw32 build.

> Failing that, a configure-time test for this version of Binutils will
> be needed, I think.

This isn't necessary.  The old Binutils works fine after the patch.  The 
only difference is that there's no manifest but, as I said above, none 
is needed.

Ken






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#17176: 24.3.50; Problem with manifests on cygw32 build with new binutils
  2014-04-02 22:19     ` Ken Brown
@ 2014-04-03  2:48       ` Eli Zaretskii
  2014-04-03 12:50         ` Ken Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2014-04-03  2:48 UTC (permalink / raw)
  To: Ken Brown; +Cc: 17176

> Date: Wed, 02 Apr 2014 18:19:34 -0400
> From: Ken Brown <kbrown@cornell.edu>
> CC: 17176@debbugs.gnu.org, Daniel Colascione <dancol@dancol.org>
> 
> > Also, what about those Cygwin users who didn't yet upgrade to this new
> > version of Binutils? they will be left with no manifest.
> 
> They don't need one.  Cygwin binaries generally have no manifest (prior 
> to the Binutils change).  The only exceptions are for programs that need 
> a manifest to avoid UAC problems because their names happen to contain 
> "update" or "patch", for instance.

The set of names that trigger UAC prompts is not documented anywhere.
We only know some names that people discovered and reported, but not
the whole list.

Besides, the Emacs manifest has recently got an addition that is
important on Windows 8.1 and later, which has nothing to do with UAC.

> The fact that the cygw32 build of emacs uses a manifest is a consequence 
> (probably unintended, but only Daniel could say for sure) of the fact 
> that emacs.res is linked in.  And the only reason for linking in 
> emacs.res is to get the emacs icon into the cygw32 build.

Having a manifest is a system recommendation, not an Emacs invention.

> This isn't necessary.  The old Binutils works fine after the patch.  The 
> only difference is that there's no manifest but, as I said above, none 
> is needed.

I think this is a mistake, but I don't use Cygwin, so it's your call.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#17176: 24.3.50; Problem with manifests on cygw32 build with new binutils
  2014-04-03  2:48       ` Eli Zaretskii
@ 2014-04-03 12:50         ` Ken Brown
  2014-04-03 19:12           ` Ken Brown
  0 siblings, 1 reply; 8+ messages in thread
From: Ken Brown @ 2014-04-03 12:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 17176

On 4/2/2014 10:48 PM, Eli Zaretskii wrote:
> Having a manifest is a system recommendation, not an Emacs invention.

I understand that, but I see no reason for the cygw32 build of emacs to 
be treated specially (and even differently from the X11 and noX builds 
on Cygwin).  With my patch, Cygwin users who build emacs with an old 
Binutils will have no manifest, like almost all other Cygwin 
applications, while those who use the new Binutils will get the new 
"standard" Cygwin manifest (which includes compatibility with Windows 8.1).

Ken





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#17176: 24.3.50; Problem with manifests on cygw32 build with new binutils
  2014-04-03 12:50         ` Ken Brown
@ 2014-04-03 19:12           ` Ken Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Ken Brown @ 2014-04-03 19:12 UTC (permalink / raw)
  To: 17176-done

Version: 24.4

Patch applied as rev 116901 on the emacs-24 branch.





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-03 19:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-02 19:07 bug#17176: 24.3.50; Problem with manifests on cygw32 build with new binutils Ken Brown
2014-04-02 19:38 ` Daniel Colascione
2014-04-02 20:29 ` Eli Zaretskii
2014-04-02 20:59   ` Eli Zaretskii
2014-04-02 22:19     ` Ken Brown
2014-04-03  2:48       ` Eli Zaretskii
2014-04-03 12:50         ` Ken Brown
2014-04-03 19:12           ` Ken Brown

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).