From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: Fix for Cygwin/GSlice problem Date: Wed, 09 Dec 2009 19:53:33 +0100 Message-ID: <4B1FF22D.8080800@swipnet.se> References: <4B1EA7F6.3090504@cornell.edu> <4B1F1424.9020105@cornell.edu> <4B1F5A63.3030509@swipnet.se> <4B1FBB8C.5090909@cornell.edu> <4B1FD098.4040400@cornell.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1260384833 15926 80.91.229.12 (9 Dec 2009 18:53:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Dec 2009 18:53:53 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Ken Brown Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 09 19:53:46 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NIRfV-00021f-C6 for ged-emacs-devel@m.gmane.org; Wed, 09 Dec 2009 19:53:45 +0100 Original-Received: from localhost ([127.0.0.1]:41441 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIRfU-0000dN-Vc for ged-emacs-devel@m.gmane.org; Wed, 09 Dec 2009 13:53:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIRfQ-0000cy-Ek for emacs-devel@gnu.org; Wed, 09 Dec 2009 13:53:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIRfM-0000bm-PY for emacs-devel@gnu.org; Wed, 09 Dec 2009 13:53:40 -0500 Original-Received: from [199.232.76.173] (port=37825 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIRfM-0000bg-L0 for emacs-devel@gnu.org; Wed, 09 Dec 2009 13:53:36 -0500 Original-Received: from proxy1.bredband.net ([195.54.101.71]:41155) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NIRfM-00077H-3s for emacs-devel@gnu.org; Wed, 09 Dec 2009 13:53:36 -0500 Original-Received: from ipb2.telenor.se (195.54.127.165) by proxy1.bredband.net (7.3.140.3) id 4AD3E1C00195D40B for emacs-devel@gnu.org; Wed, 9 Dec 2009 19:53:34 +0100 X-SMTPAUTH-B2: X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgxTAFKBH0tV4S1uPGdsb2JhbACBTJc3glMBAQEBN7tUhCwEgWKLPw X-IronPort-AV: E=Sophos;i="4.47,369,1257116400"; d="scan'208";a="13460029" Original-Received: from c-6e2de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.110]) by ipb2.telenor.se with ESMTP; 09 Dec 2009 19:53:34 +0100 Original-Received: from [172.20.199.2] (gaffa [172.20.199.2]) by coolsville.localdomain (Postfix) with ESMTP id E84B27FA07B; Wed, 9 Dec 2009 19:53:33 +0100 (CET) User-Agent: Thunderbird 2.0.0.23 (X11/20090817) In-Reply-To: <4B1FD098.4040400@cornell.edu> X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:118470 Archived-At: Ken Brown skrev: > On 12/9/2009 10:00 AM, Ken Brown wrote: >> On 12/9/2009 9:31 AM, Stefan Monnier wrote: >>>>>>> +/* 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 >>>>>> Why does Cygwin-Emacs use its own malloc rather than the system >>>>>> malloc? >>>> Emacs prefers its own malloc when the system malloc doesn't have the >>>> required hooks. If this is critical or not I don't know. >>> >>> I'd suggest we try to use Cygwin's system malloc, with a clear comment >>> about why we don't use our own, and what kind of workaround could be >>> used (the G_SLICE_ALWAYS_MALLOC) if we wanted to use our own. >> >> OK, I'll give it a try and report back. I assume the way to do this >> is to remove '#define G_SLICE_ALWAYS_MALLOC' from src/s/cygwin.h and >> instead #define SYSTEM_MALLOC. [You don't need to respond unless this >> is wrong.] > > I tried this, and the build fails with > > gcc -o temacs ecrt0.o dispnew.o frame.o scroll.o xdisp.o menu.o > window.o charset.o coding.o category.o ccl.o character.o chartab.o cm.o > term.o terminal.o xfaces.o emacs.o keyboard.o macros.o keymap.o > sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o > dired.o filemode.o cmds.o casetab.o casefiddle.o indent.o search.o > regex.o undo.o alloc.o data.o doc.o editfns.o callint.o eval.o > floatfns.o fns.o font.o print.o lread.o syntax.o unexcw.o bytecode.o > process.o callproc.o region-cache.o sound.o atimer.o doprnt.o strftime.o > intervals.o textprop.o composite.o md5.o sheap.o terminfo.o > lastfile.o vm-limit.o getloadavg.o -lcurses -lg `gcc > -print-libgcc-file-name` -lm -lc `gcc -print-libgcc-file-name` > vm-limit.o:vm-limit.c:(.text+0x17): undefined reference to > `___after_morecore_hook' > vm-limit.o:vm-limit.c:(.text+0x6c): undefined reference to `___morecore' > > I looked at the source code, and I can't see any place where Cygwin's > malloc.h is getting included. I don't know if that's the (only) problem. > > I also asked for help on the Cygwin list and got the following two > responses: > >> ...cygwin doesn't provide something >> that linux does. It's possible that you may be able to work around >> the problem by using a -D__morecore=sbrk (or maybe one more underscore >> is needed) on the compile line for vm-limit.c. > >> why are you bothering to specify the system libs at all? You're using >> the gcc driver to link, it'll do all that for you automatically (and >> correctly) if you just leave them out; you shouldn't need anything but >> -lcurses out of that lot. You'll definitely break linking against the >> shared >> libgcc by putting the static archive in the list of user libraries >> like that. > > I'm really in over my head at this point. If someone sees something I > can do to fix this, I'll give it a try. Otherwise, maybe we should just > stick with the G_SLICE workaround for now. > You should be able to just comment out the lines in vm-limit.c, i.e. just put void memory_warnings (start, warnfun) POINTER start; void (*warnfun) (); { #ifndef CYGWIN ... #endif } so you can test it. The comments about static and dynamic libraries are in principle correct, but Emacs whats to do it like that for the sake of dumping. But my guess is that it may be redundant now, but since it works, nobody has tried to change it. There are a few platforms to test it on so why bother? Jan D.