From: Ken Brown <kbrown@cornell.edu>
To: emacs-devel@gnu.org
Subject: Fix for Cygwin/GSlice problem
Date: Tue, 08 Dec 2009 14:24:38 -0500 [thread overview]
Message-ID: <4B1EA7F6.3090504@cornell.edu> (raw)
[-- 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
next reply other threads:[~2009-12-08 19:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-08 19:24 Ken Brown [this message]
2009-12-09 1:07 ` Fix for Cygwin/GSlice problem 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
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=4B1EA7F6.3090504@cornell.edu \
--to=kbrown@cornell.edu \
--cc=emacs-devel@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).