From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thomas Thiriez via General Guile related discussions Newsgroups: gmane.lisp.guile.user Subject: Re: 64-bit Guile on Windows Date: Fri, 24 Mar 2023 00:14:56 +0100 Message-ID: References: Reply-To: Thomas Thiriez Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13217"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.14; emacs 28.2 Cc: guile-user@gnu.org To: Mike Gran Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Mar 24 00:16:29 2023 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pfUAV-00033q-Ps for guile-user@m.gmane-mx.org; Fri, 24 Mar 2023 00:16:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfUA6-000109-R0; Thu, 23 Mar 2023 19:16:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfUA2-0000ug-JE for guile-user@gnu.org; Thu, 23 Mar 2023 19:16:01 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfU9z-0003FD-B7 for guile-user@gnu.org; Thu, 23 Mar 2023 19:15:58 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 64FFD5C0174; Thu, 23 Mar 2023 19:15:33 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 23 Mar 2023 19:15:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=twistedwave.com; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1679613333; x= 1679699733; bh=XHx2hfhBiyLBmDIr7q3+Ez6dsRl1SX/2zA4zChxfS+Q=; b=t 3KSEW8yyv0ZqZkoV/2n6dFfAbfaP+NfIMl6/ywU7kCrE1W4+LDcqXzh24xOiZ5UP lNO+F+k7zZiLzlQrLMWMwebSfNi7y01uwmecH0VxwjSPZe+wHP6g9mwq0FgOeWs2 66UXZDiP7q4w4jy0/2Tyd2nylFP2uPX+abJ45vdN2ngnlZ8N0LW3QkOTgK7rfPVi u0vsdub7LhetT9yr9YtOO0/HN1qF+ilDIZTg+fQpTrJEOOE7trLlVDvmZoGZsE+L h6p5CVrQu0SWGX+zBSCa3VDdqs+8OW0H5L9vYMQoqVhwgukzhVrR7EZxQM9W5JOX S47BC1gMC4Mx82pkOUf/w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1679613333; x=1679699733; bh=XHx2hfhBiyLBm DIr7q3+Ez6dsRl1SX/2zA4zChxfS+Q=; b=kyPtMsTH6T07OPsn/YzO7kd4TiBoJ aCIHpyL3WvHAfImZ26BeUa9KPLiqaAH4VZTHVDGc0+Xxhd5DbTgB53LjMbQGEvzb qxhM25HqsgPRId9+yw5LOKJKCEJpfGUxRXrReKzUIgTNs/saoqA5nX9UFbC8FlF5 5wrbEikQBwNzmFRqaF5hyXXhbXj71ogo7uS46TrLAu3hAMQQUfaHchJHPqc5wGqs BiWWGCOUlBV8omyUbA0yKCQkoeS1Gago23zaaEoj2aGJlWqR6Dp5SjZ/GlbDNoSM yA0ZhwHwJHOwFGHEds8wWJqxCWp1fHR14zETWu3nPIluH+y+rs8ihzLqw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeghedgtdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpehffgfhvfevufffjgfkgggtsehttd ertddtredtnecuhfhrohhmpefvhhhomhgrshcuvfhhihhrihgviicuoehthhhomhgrshes thifihhsthgvugifrghvvgdrtghomheqnecuggftrfgrthhtvghrnheptdfgffeffeetje ehjeeuffejuedtteefheejvedvieduueevvdefteehhfeukefhnecuffhomhgrihhnpehg ihhtlhgrsgdrtghomhdpghhithhhuhgsrdgtohhmpdhgnhhurdhorhhgnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehtfihi shhtvggufigrvhgvrdgtohhm X-ME-Proxy: Feedback-ID: i65b94586:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Mar 2023 19:15:32 -0400 (EDT) In-reply-to: Received-SPF: pass client-ip=66.111.4.25; envelope-from=thomas@twistedwave.com; helo=out1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18953 Archived-At: Hi Mike, I was able to build a 64-bit libguile 3 based on the branch wip-mingw. It appears to be working fine so far, and I am grateful for your work. The only glitch I have found is that (gettimeofday) does not return correct values. It should return a pair (seconds . microseconds). The seconds part is correct, but the microseconds are often greater than 1000000, and can even be negative. I am not sure how to fix it, but I believe I have found the root cause of the problem. The mingw implementation of the timeval struct is: struct timeval { long tv_sec; long tv_usec; }; But the file guile/lib/sys/time.h replaces it with that: struct timeval { time_t tv_sec; long int tv_usec; }; long is 32-bit on Windows, and time_t is 64-bit. When scm_gettimeofday calls gettimeofday(), that function expects a timeval with two longs, and the seconds and microseconds end up in the low and high parts of tv_sec. When scm_from_long is called on tv_sec, the 64-bit value is truncated, and the seconds are correctly converted. When converting the tv_usec member, however, we only get what happend to be there on the stack. I have found a test in guile/m4/sys_time_h.m4 that enables the timeval replacement mentioned above when sizeof(tv_sec) is smaller than sizeof(time_t), with this accompanying comment: On native Windows with a 64-bit 'time_t', 'struct timeval' is defined (in and for mingw64, in only for MSVC) with a tv_sec field of type 'long' (32-bit!), which is smaller than the 'time_t' type mandated by POSIX. On OpenBSD 5.1 amd64, tv_sec is 64 bits and time_t 32 bits, but that is good enough. So I am left wondering how it is supposed to work if the timeval is replaced with members of a different size. Is scm_gettimeofday not calling the correct version of gettimeofday? Another question. Are there more issues I can expect, while working with this wip-mingw branch? The name suggests it is not finished yet. Regards, Thomas Thiriez Mike Gran writes: > On Tue, Nov 22, 2022 at 01:44:47PM +0100, Jean Abou Samra wrote: >> >>> > Now, it is possible that the problem is that I am trying to >>> > run a >> > .go file compiled on macOS on a Windows machine, and that the >> > two >> > platforms are different enough that the .go file can't be >> > reused. >> > And because I get that "Value out of range" error when >> > compiling >> > on Windows, I am probably stuck with .scm files instead of >> > compiled .go files. >> >> >> This bug is now hitting us too, we're investigating it here: >> >> https://gitlab.com/lilypond/lilypond/-/issues/6474 >> >> Best, >> Jean >> > > > For what it is worth, I do have functional 64-bit Guile 3.0.x > for > Windows at the link below, but that tree is still full of > missteps and > experiments and needs to made into a cleaner patchset. And I'm > still > actively hacking there because I'm trying to a Guile that, once > installed, lives in a single directory like most Windows > applications > so I can make an MSIX installer. So it is a bit of a mess, but, > I'm fairly confident the integers are fixed. > > https://github.com/spk121/guile/commits/wip-mingw-bleh > > That tree was based on, and will eventually contribute > back to > > https://git.savannah.gnu.org/cgit/guile.git/log/?h=wip-mingw > > Both of these trees require that you --enable-mini-gmp > --enable-jit=no and --disable-lto at configure time. > > Regards, > Mike Gran