unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Fix for Cygwin/GSlice problem
@ 2009-12-08 19:24 Ken Brown
  2009-12-09  1:07 ` Chong Yidong
  2009-12-09  1:33 ` Stefan Monnier
  0 siblings, 2 replies; 18+ messages in thread
From: Ken Brown @ 2009-12-08 19:24 UTC (permalink / raw)
  To: emacs-devel

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

The attached patch fixes a longstanding problem with the Gtk+ build of 
emacs in Cygwin.  The problem is described in etc/PROBLEMS ("Emacs 
compiled with Gtk+ crashes on startup on Cygwin"), along with a 
workaround.  The patch simply incorporates that workaround into the 
emacs code.  I tried to do this so that the Cygwin-specific part is 
hidden in src/s/cygwin.h; it's conceivable that there are other systems 
where something similar would be useful.

The patch also removes the description of the problem from etc/PROBLEMS 
and removes a configuration warning.

Please apply the patch if it's OK, or tell me how to improve it.

Thanks.

Ken


[-- Attachment #2: gslice.patch --]
[-- Type: text/plain, Size: 2698 bytes --]

--- origsrc/emacs/src/s/cygwin.h	2009-11-20 23:50:36.000000000 -0500
+++ src/emacs/src/s/cygwin.h	2009-12-08 07:05:57.758985600 -0500
@@ -126,6 +126,12 @@ along with GNU Emacs.  If not, see <http
 /* Virtual addresses of pure and impure space can vary, as on Windows.  */
 #define VIRT_ADDR_VARIES
 
+/* Emacs supplies its own malloc, but glib (part of Gtk+) calls
+   memalign and on Cygwin, that becomes the Cygwin supplied memalign.
+   As malloc is not the Cygwin malloc, the Cygwin memalign always
+   returns ENOSYS.  A workaround is to set G_SLICE=always-malloc. */
+#define G_SLICE_ALWAYS_MALLOC
+
 /* the end */
 
 /* arch-tag: 5ae7ba00-83b0-4ab3-806a-3e845779191b
--- origsrc/emacs/src/emacs.c	2009-11-17 03:21:34.000000000 -0500
+++ src/emacs/src/emacs.c	2009-12-08 07:05:57.769000000 -0500
@@ -785,6 +785,9 @@ bug_reporting_address ()
 int
 main (int argc, char **argv)
 {
+# if defined (USE_GTK) && defined (G_SLICE_ALWAYS_MALLOC)
+  setenv("G_SLICE", "always-malloc", 1);
+#endif
 #if GC_MARK_STACK
   Lisp_Object dummy;
 #endif
--- origsrc/emacs/configure.in	2009-11-21 10:40:31.000000000 -0500
+++ src/emacs/configure.in	2009-12-08 07:05:57.809057600 -0500
@@ -3026,16 +3026,6 @@ fi
 
 echo
 
-if test "$USE_X_TOOLKIT" = GTK; then
-  case "$canonical" in
-  *cygwin*)
-    echo "There are known problems with Emacs and Gtk+ on cygwin, so you
-  will probably get a crash on startup.  If this happens, please use another
-  toolkit for Emacs.  See etc/PROBLEMS for more information."
-  ;;
-  esac
-fi
-
 if test "$HAVE_NS" = "yes"; then
    echo
    echo "You must run \"make install\" in order to test the built application.
--- origsrc/emacs/etc/PROBLEMS	2009-11-20 16:46:28.000000000 -0500
+++ src/emacs/etc/PROBLEMS	2009-12-08 07:08:07.655768000 -0500
@@ -244,28 +244,6 @@ frame on another X display, then a Gtk+ 
 server that results in an endless loop.  This is not fixed in any known
 Gtk+ version (2.14.4 being current).
 
-** Emacs compiled with Gtk+ crashes on startup on Cygwin.
-
-A typical error message is
-  ***MEMORY-ERROR***: emacs[5172]: GSlice: failed to allocate 504 bytes
-  (alignment: 512): Function not implemented
-
-Emacs supplies its own malloc, but glib (part of Gtk+) calls memalign and on
-Cygwin, that becomes the Cygwin supplied memalign.  As malloc is not the
-Cygwin malloc, the Cygwin memalign always returns ENOSYS.
-
-One workaround is to set G_SLICE=always-malloc before starting emacs.
-For example, in bash,
-
-  G_SLICE=always-malloc emacs
-
-or put
-
-  export G_SLICE=always-malloc
-
-in one of the bash startup files.  This also has to be done before
-building emacs on Cygwin with Gtk+.
-
 * General runtime problems
 
 ** Lisp problems

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: Fix for Cygwin/GSlice problem
@ 2009-12-09  0:43 Angelo Graziosi
  0 siblings, 0 replies; 18+ messages in thread
From: Angelo Graziosi @ 2009-12-09  0:43 UTC (permalink / raw)
  To: Emacs

Ken Brown wrote:
> The attached patch fixes a longstanding problem with the Gtk+ build of emacs in Cygwin.

+1

It works just fine!

Thanks,
Angelo




^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: Fix for Cygwin/GSlice problem
@ 2009-12-15 16:06 Angelo Graziosi
  2009-12-15 16:13 ` Chong Yidong
  0 siblings, 1 reply; 18+ messages in thread
From: Angelo Graziosi @ 2009-12-15 16:06 UTC (permalink / raw)
  To: Emacs

Ken Brown wrote[*]:
> Could someone please apply it?

Ping?

Thanks,
Angelo.


---
http://lists.gnu.org/archive/html/emacs-devel/2009-12/msg00493.html




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

end of thread, other threads:[~2009-12-16 22:47 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-08 19:24 Fix for Cygwin/GSlice problem Ken Brown
2009-12-09  1:07 ` Chong Yidong
2009-12-09  1:33 ` Stefan Monnier
2009-12-09  3:06   ` Ken Brown
2009-12-09  8:05     ` Jan D.
2009-12-09 14:31       ` Stefan Monnier
2009-12-09 15:00         ` Ken Brown
2009-12-09 16:30           ` Ken Brown
2009-12-09 18:53             ` Jan Djärv
2009-12-09 19:29               ` Ken Brown
2009-12-09 20:39                 ` Jan Djärv
2009-12-10 12:16               ` Ken Brown
2009-12-09 17:31         ` Jan Djärv
  -- strict thread matches above, loose matches on Subject: below --
2009-12-09  0:43 Angelo Graziosi
2009-12-15 16:06 Angelo Graziosi
2009-12-15 16:13 ` Chong Yidong
2009-12-15 16:18   ` Angelo Graziosi
2009-12-16 22:47   ` Angelo Graziosi

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