unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* 64-bit Guile on Windows
@ 2022-06-27 13:56 Thomas Thiriez via General Guile related discussions
  2022-06-27 17:28 ` Jan Nieuwenhuizen
  2022-06-28  8:38 ` Jean Abou Samra
  0 siblings, 2 replies; 11+ messages in thread
From: Thomas Thiriez via General Guile related discussions @ 2022-06-27 13:56 UTC (permalink / raw)
  To: guile-user

Hi,

I am currently porting a macOS application to Windows, and need to 
have libguile working.

I can see GnuCash works with Guile. I could borrow their 
libguile.dll, but it is a 32-bit build, and I am making a 64-bit 
application. I tried building Guile 3, but had more success with 
Guile 2.2, so I will keep that version.

I have cross compiled it on my mac with mingw, and it kind of 
works. The only thing is that if I compile my .scm files to .go, 
then my fixnums are not automatically converted to big nums, and I 
get things like that:

(* 999 999 999) -> -76738825

My fix is to keep the .scm files, and avoid compiling to .go.

I believe this has something to do with the fact that, on that 
platform, we have:

sizeof(SCM)  == 8
sizeof(long) == 4

Is there something to do about that problem? Is there something I 
can do to have a working 64-bit Guile on Windows?

Thanks a lot for any help you could provide.

Regards,
Thomas Thiriez



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

* Re: 64-bit Guile on Windows
  2022-06-27 13:56 64-bit Guile on Windows Thomas Thiriez via General Guile related discussions
@ 2022-06-27 17:28 ` Jan Nieuwenhuizen
  2022-06-27 19:33   ` Thomas Thiriez via General Guile related discussions
  2022-06-28  8:38 ` Jean Abou Samra
  1 sibling, 1 reply; 11+ messages in thread
From: Jan Nieuwenhuizen @ 2022-06-27 17:28 UTC (permalink / raw)
  To: Thomas Thiriez via General Guile related discussions; +Cc: Thomas Thiriez

Thomas Thiriez via General Guile related discussions writes:

Hello,

> I am currently porting a macOS application to Windows, and need to
> have libguile working.
[..]
> I tried building Guile 3, but had more success with Guile 2.2, so I will
> keep that version.

There is a 64-bit port on the wip-mingw branch

    https://git.savannah.gnu.org/cgit/guile.git/log/?h=wip-mingw

but that is based on guile-3.0.8.

> I believe this has something to do with the fact that, on that
> platform, we have:
>
> sizeof(SCM)  == 8
> sizeof(long) == 4

Yes, indeed.

> Is there something to do about that problem? Is there something I can
> do to have a working 64-bit Guile on Windows?

It shouldn't be too much work to backport the fixes to guile-2.2.

Greetings,
Janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org>  | GNU LilyPond https://lilypond.org
Freelance IT https://JoyOfSource.com | Avatar® https://AvatarAcademy.com



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

* Re: 64-bit Guile on Windows
  2022-06-27 17:28 ` Jan Nieuwenhuizen
@ 2022-06-27 19:33   ` Thomas Thiriez via General Guile related discussions
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Thiriez via General Guile related discussions @ 2022-06-27 19:33 UTC (permalink / raw)
  To: guile-user

Jan Nieuwenhuizen <janneke@gnu.org> writes:

> Thomas Thiriez via General Guile related discussions writes:
>
> Hello,
>
>> I am currently porting a macOS application to Windows, and need 
>> to
>> have libguile working.
> [..]
>> I tried building Guile 3, but had more success with Guile 2.2, 
>> so I will
>> keep that version.
>
> There is a 64-bit port on the wip-mingw branch
>
>     https://git.savannah.gnu.org/cgit/guile.git/log/?h=wip-mingw
>
> but that is based on guile-3.0.8.

Ah, that's good news. I have installed it with Cygwin, and it is 
working fine.

If I understand correctly, in order to use that version of 
libguile, I would have to redistribute the Cygwin libs with it, 
and the license would not work well with my proprietary 
application, am I right?

Regards,
Thomas Thiriez



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

* Re: 64-bit Guile on Windows
  2022-06-27 13:56 64-bit Guile on Windows Thomas Thiriez via General Guile related discussions
  2022-06-27 17:28 ` Jan Nieuwenhuizen
@ 2022-06-28  8:38 ` Jean Abou Samra
  2022-06-28 10:52   ` Maxime Devos
  2022-06-28 14:41   ` Thomas Thiriez via General Guile related discussions
  1 sibling, 2 replies; 11+ messages in thread
From: Jean Abou Samra @ 2022-06-28  8:38 UTC (permalink / raw)
  To: Thomas Thiriez, guile-user



Le 27/06/2022 à 15:56, Thomas Thiriez via General Guile related 
discussions a écrit :
> Hi,
>
> I am currently porting a macOS application to Windows, and need to 
> have libguile working.
>
> I can see GnuCash works with Guile. I could borrow their libguile.dll, 
> but it is a 32-bit build, and I am making a 64-bit application. I 
> tried building Guile 3, but had more success with Guile 2.2, so I will 
> keep that version.
>
> I have cross compiled it on my mac with mingw, and it kind of works. 
> The only thing is that if I compile my .scm files to .go, then my 
> fixnums are not automatically converted to big nums, and I get things 
> like that:
>
> (* 999 999 999) -> -76738825
>
> My fix is to keep the .scm files, and avoid compiling to .go.
>
> I believe this has something to do with the fact that, on that 
> platform, we have:
>
> sizeof(SCM)  == 8
> sizeof(long) == 4
>
> Is there something to do about that problem? Is there something I can 
> do to have a working 64-bit Guile on Windows?
>
> Thanks a lot for any help you could provide.


We had exactly the same problem at LilyPond, and this was the fix:

https://gitlab.com/lilypond/lilypond/-/blob/master/release/binaries/lib/dependencies.py#L721

Namely, you need to patch libguile/conv-integer.i.c and
conv-uinteger.i.c to replace "SIZEOF_TYPE < SIZEOF_SCM_T_BITS"
with "SIZEOF_TYPE < SIZEOF_LONG".

HTH,
Jean




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

* Re: 64-bit Guile on Windows
  2022-06-28  8:38 ` Jean Abou Samra
@ 2022-06-28 10:52   ` Maxime Devos
  2022-07-06 16:33     ` Jean Abou Samra
  2022-06-28 14:41   ` Thomas Thiriez via General Guile related discussions
  1 sibling, 1 reply; 11+ messages in thread
From: Maxime Devos @ 2022-06-28 10:52 UTC (permalink / raw)
  To: Jean Abou Samra, Thomas Thiriez, guile-user

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

Jean Abou Samra schreef op di 28-06-2022 om 10:38 [+0200]:
> We had exactly the same problem at LilyPond, and this was the fix:
> 
> https://gitlab.com/lilypond/lilypond/-/blob/master/release/binaries/lib/dependencies.py#L721
> 

For security, shouldn't this check the hash of the downloaded tarballls
and patches?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* Re: 64-bit Guile on Windows
  2022-06-28  8:38 ` Jean Abou Samra
  2022-06-28 10:52   ` Maxime Devos
@ 2022-06-28 14:41   ` Thomas Thiriez via General Guile related discussions
  2022-06-28 15:00     ` Thomas Thiriez via General Guile related discussions
  2022-06-28 16:14     ` Maxime Devos
  1 sibling, 2 replies; 11+ messages in thread
From: Thomas Thiriez via General Guile related discussions @ 2022-06-28 14:41 UTC (permalink / raw)
  To: guile-user


Jean Abou Samra <jean@abou-samra.fr> writes:

> Le 27/06/2022 à 15:56, Thomas Thiriez via General Guile related
> discussions a écrit :
[...]
>> (* 999 999 999) -> -76738825
[...]
>
> We had exactly the same problem at LilyPond, and this was the 
> fix:
>
> https://gitlab.com/lilypond/lilypond/-/blob/master/release/binaries/lib/dependencies.py#L721
>
> Namely, you need to patch libguile/conv-integer.i.c and
> conv-uinteger.i.c to replace "SIZEOF_TYPE < SIZEOF_SCM_T_BITS"
> with "SIZEOF_TYPE < SIZEOF_LONG".
>
> HTH,
> Jean

Thanks for the info. I have tried this, but it doesn't appear to 
be helping.

I did a few tests with lilypond, and here is what I found. I have 
a test.scm file containing:

(display (* 999)) (newline)
(display (* 999 999)) (newline)
(display (* 999 999 999)) (newline)

lilypond.exe -e '(load \"test.scm\")' test.ly
GNU LilyPond 2.23.10 (running Guile 2.2)
999
998001
997002999

That is fine. Now, if I try compiling test.scm to test.go, I get:

lilypond.exe -e '(use-modules (system base compile))(compile-file 
\"test.scm\" #:output-file \"test.go\")' test.ly
GNU LilyPond 2.23.10 (running Guile 2.2)
ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
In procedure bytevector-u64-set!: Value out of range: -149659645

That doesn't work, so I compile test.scm to test.go with guile on 
my Mac. If I then try loading the generated test.go with lilypond, 
I get:

lilypond.exe -e '(load \"test.go\")' test.ly
GNU LilyPond 2.23.10 (running Guile 2.2)
999
998001
-76738825

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.

Regards,
Thomas Thiriez



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

* Re: 64-bit Guile on Windows
  2022-06-28 14:41   ` Thomas Thiriez via General Guile related discussions
@ 2022-06-28 15:00     ` Thomas Thiriez via General Guile related discussions
  2022-06-28 16:14     ` Maxime Devos
  1 sibling, 0 replies; 11+ messages in thread
From: Thomas Thiriez via General Guile related discussions @ 2022-06-28 15:00 UTC (permalink / raw)
  To: guile-user


Thomas Thiriez via General Guile related discussions 
<guile-user@gnu.org> writes:

> That doesn't work, so I compile test.scm to test.go with guile 
> on my
> Mac.

I have also tried compiling with this command on my Mac to 
generate bytecode for the right architecture, but the result is 
the same:

guild compile test.scm -T x86_64-w64-mingw32 -o test.go



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

* Re: 64-bit Guile on Windows
  2022-06-28 14:41   ` Thomas Thiriez via General Guile related discussions
  2022-06-28 15:00     ` Thomas Thiriez via General Guile related discussions
@ 2022-06-28 16:14     ` Maxime Devos
  2022-06-28 22:07       ` Dr. Arne Babenhauserheide
  1 sibling, 1 reply; 11+ messages in thread
From: Maxime Devos @ 2022-06-28 16:14 UTC (permalink / raw)
  To: Thomas Thiriez, guile-user

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

Thomas Thiriez via General Guile related discussions schreef op di 28-
06-2022 om 16:41 [+0200]:
> Jean Abou Samra <jean@abou-samra.fr> writes:
> 
> > Le 27/06/2022 à 15:56, Thomas Thiriez via General Guile related
> > discussions a écrit :
> [...]
> > > (* 999 999 999) -> -76738825
> [...]
> > 
> > We had exactly the same problem at LilyPond, and this was the 
> > fix:
> > 
> > https://gitlab.com/lilypond/lilypond/-/blob/master/release/binaries/lib/dependencies.py#L721
> > 
> > Namely, you need to patch libguile/conv-integer.i.c and
> > conv-uinteger.i.c to replace "SIZEOF_TYPE < SIZEOF_SCM_T_BITS"
> > with "SIZEOF_TYPE < SIZEOF_LONG".
> > 
> > HTH,
> > Jean
> 
> Thanks for the info. I have tried this, but it doesn't appear to 
> be helping.
> 
> I did a few tests with lilypond, and here is what I found. I have 
> a test.scm file containing:
> 
> (display (* 999)) (newline)
> (display (* 999 999)) (newline)
> (display (* 999 999 999)) (newline)
> 
> lilypond.exe -e '(load \"test.scm\")' test.ly
> GNU LilyPond 2.23.10 (running Guile 2.2)
> 999
> 998001
> 997002999
> 
> That is fine. Now, if I try compiling test.scm to test.go, I get:
> 
> lilypond.exe -e '(use-modules (system base compile))(compile-file 
> \"test.scm\" #:output-file \"test.go\")' test.ly
> GNU LilyPond 2.23.10 (running Guile 2.2)
> ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
> In procedure bytevector-u64-set!: Value out of range: -149659645

You can find some possibly related bugs on debbugs:

Possibly fixnum-related, so maybe:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42060

Maybe 32-bit <-> 64-bit related, so maybe:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28920

Also, guile@2.2 is not developed anymore AFAICT.

Greetings,
Maixme.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

* Re: 64-bit Guile on Windows
  2022-06-28 16:14     ` Maxime Devos
@ 2022-06-28 22:07       ` Dr. Arne Babenhauserheide
  2022-06-29  9:07         ` Thomas Thiriez via General Guile related discussions
  0 siblings, 1 reply; 11+ messages in thread
From: Dr. Arne Babenhauserheide @ 2022-06-28 22:07 UTC (permalink / raw)
  To: Maxime Devos; +Cc: Thomas Thiriez, guile-user

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


Maxime Devos <maximedevos@telenet.be> writes:

> [[PGP Signed Part:No public key for 49E3EE22191725EE created at 2022-06-28T18:14:22+0200 using EDDSA]]
> Thomas Thiriez via General Guile related discussions schreef op di 28-
> 06-2022 om 16:41 [+0200]:
>> Jean Abou Samra <jean@abou-samra.fr> writes:
>> 
>> > Le 27/06/2022 à 15:56, Thomas Thiriez via General Guile related
>> > discussions a écrit :
>> [...]
>> > > (* 999 999 999) -> -76738825
>> [...]
>> > 
>> > We had exactly the same problem at LilyPond, and this was the 
>> > fix:
>> > 
>> > https://gitlab.com/lilypond/lilypond/-/blob/master/release/binaries/lib/dependencies.py#L721
>> > 
>> > Namely, you need to patch libguile/conv-integer.i.c and
>> > conv-uinteger.i.c to replace "SIZEOF_TYPE < SIZEOF_SCM_T_BITS"
>> > with "SIZEOF_TYPE < SIZEOF_LONG".
>> > 
>> > HTH,
>> > Jean
>> 
>> Thanks for the info. I have tried this, but it doesn't appear to 
>> be helping.
>> 
>> I did a few tests with lilypond, and here is what I found. I have 
>> a test.scm file containing:
>> 
>> (display (* 999)) (newline)
>> (display (* 999 999)) (newline)
>> (display (* 999 999 999)) (newline)
>> 
>> lilypond.exe -e '(load \"test.scm\")' test.ly
>> GNU LilyPond 2.23.10 (running Guile 2.2)
>> 999
>> 998001
>> 997002999
>> 
>> That is fine. Now, if I try compiling test.scm to test.go, I get:
>> 
>> lilypond.exe -e '(use-modules (system base compile))(compile-file 
>> \"test.scm\" #:output-file \"test.go\")' test.ly
>> GNU LilyPond 2.23.10 (running Guile 2.2)
>> ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
>> In procedure bytevector-u64-set!: Value out of range: -149659645
>
> Possibly fixnum-related, so maybe:
>
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42060
>
> Maybe 32-bit <-> 64-bit related, so maybe:
>
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28920
>
> Also, guile@2.2 is not developed anymore AFAICT.

From what I see, Guile 2.2 does still get fixes, but no larger changes.
See https://git.savannah.gnu.org/cgit/guile.git/log/?h=stable-2.2

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 1125 bytes --]

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

* Re: 64-bit Guile on Windows
  2022-06-28 22:07       ` Dr. Arne Babenhauserheide
@ 2022-06-29  9:07         ` Thomas Thiriez via General Guile related discussions
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Thiriez via General Guile related discussions @ 2022-06-29  9:07 UTC (permalink / raw)
  To: guile-user


"Dr. Arne Babenhauserheide" <arne_bab@web.de> writes:

[...]
>> Possibly fixnum-related, so maybe:
>>
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42060
>>
>> Maybe 32-bit <-> 64-bit related, so maybe:
>>
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28920

Thanks a lot. I will check those out.

>> Also, guile@2.2 is not developed anymore AFAICT.
>
> From what I see, Guile 2.2 does still get fixes, but no larger 
> changes.
> See 
> https://git.savannah.gnu.org/cgit/guile.git/log/?h=stable-2.2

I was able to have something at least partially working with Guile 
2.2, but if I could have a working Guile 3 on Windows, that would 
be even better!

Regards,
Thomas Thiriez



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

* Re: 64-bit Guile on Windows
  2022-06-28 10:52   ` Maxime Devos
@ 2022-07-06 16:33     ` Jean Abou Samra
  0 siblings, 0 replies; 11+ messages in thread
From: Jean Abou Samra @ 2022-07-06 16:33 UTC (permalink / raw)
  To: Maxime Devos, guile-user; +Cc: Jonas Hahnfeld

On 6/28/22 12:52, Maxime Devos wrote:
> Jean Abou Samra schreef op di 28-06-2022 om 10:38 [+0200]:
>> We had exactly the same problem at LilyPond, and this was the fix:
>>
>> https://gitlab.com/lilypond/lilypond/-/blob/master/release/binaries/lib/dependencies.py#L721
>>
> For security, shouldn't this check the hash of the downloaded tarballls
> and patches?


Sorry, I forgot to reply to this. Yes, it likely should. On the other
hand, LilyPond has a lot of much more pressing security issues to care 
about…

Jean




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

end of thread, other threads:[~2022-07-06 16:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 13:56 64-bit Guile on Windows Thomas Thiriez via General Guile related discussions
2022-06-27 17:28 ` Jan Nieuwenhuizen
2022-06-27 19:33   ` Thomas Thiriez via General Guile related discussions
2022-06-28  8:38 ` Jean Abou Samra
2022-06-28 10:52   ` Maxime Devos
2022-07-06 16:33     ` Jean Abou Samra
2022-06-28 14:41   ` Thomas Thiriez via General Guile related discussions
2022-06-28 15:00     ` Thomas Thiriez via General Guile related discussions
2022-06-28 16:14     ` Maxime Devos
2022-06-28 22:07       ` Dr. Arne Babenhauserheide
2022-06-29  9:07         ` Thomas Thiriez via General Guile related discussions

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