unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#32580: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
@ 2018-08-29 22:49 seamus phenetols
  2018-08-31  1:20 ` Maxim Cournoyer
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: seamus phenetols @ 2018-08-29 22:49 UTC (permalink / raw)
  To: 32580

I'm new to guile and scheme.  I compiled 2.2.4 from source yesterday.
I wish to silence the auto-compile chatter, other than real warnings and errors
while testing my programs.  There seems to be no way to do it, so I looked
for a way to disable auto-compile in ~/.guile configuration file.  No luck so far,
but the variables %load-should-autocompile and GUILE_AUTO_COMPILE
seem promising.  Sadly, they don't seem to prevent auto-compile when
set within ~/.guile.

Below is an excerpt of my shell session to demonstrate.  In case it may be
poorly formatted, I could make  a web paste for easy viewing.



$ rm -R $XDG_CACHE_HOME/guile/ccache
rm: cannot remove '/home/me/.cache/guile/ccache': No such file or directory
$ rm ~/.guile
rm: cannot remove '/home/me/.guile': No such file or directory
$
$ printf %s\\n '(display "Hello world!")' '(newline)' | tee ~/scheme/hello.scm
(display "Hello world!")
(newline)
$
$ guile ~/scheme/hello.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/me/scheme/hello.scm
;;; compiled /home/me/.cache/guile/ccache/2.2-LE-8-3.A/media/data/me/scheme/hello.scm.go
Hello world!
$
$ rm -R $XDG_CACHE_HOME/guile/ccache
$
$ printf %s\\n '(setenv "GUILE_AUTO_COMPILE" "0")' '(set! %load-should-autocompile #f)' | tee ~/.guile
(setenv "GUILE_AUTO_COMPILE" "0")
(set! %load-should-autocompile #f)
$
$ guile ~/scheme/hello.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/me/scheme/hello.scm
;;; compiled /home/me/.cache/guile/ccache/2.2-LE-8-3.A/media/data/me/scheme/hello.scm.go
Hello world!
$
$ guile --version
guile (GNU Guile) 2.2.4
Copyright (C) 2018 Free Software Foundation, Inc.

License LGPLv3+: GNU LGPL 3 or later <http://gnu.org/licenses/lgpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ ls --full-time -gGh ~/Downloads/src/guile-2.2.4.tar.gz
-rw-r--r-- 1 18M 2018-08-24 17:37:08.405232060 -0400 /home/me/Downloads/src/guile-2.2.4.tar.gz
$






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

* bug#32580: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
  2018-08-29 22:49 bug#32580: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling seamus phenetols
@ 2018-08-31  1:20 ` Maxim Cournoyer
  2018-08-31 14:00   ` seamus phenetols
  2018-09-02 19:22 ` Daniel Llorens
  2021-05-18 16:30 ` Taylan Kammer
  2 siblings, 1 reply; 7+ messages in thread
From: Maxim Cournoyer @ 2018-08-31  1:20 UTC (permalink / raw)
  To: seamus phenetols; +Cc: 32580

Hello,

seamus phenetols <seamusphenetols@yandex.com> writes:

> I'm new to guile and scheme.  I compiled 2.2.4 from source yesterday.
> I wish to silence the auto-compile chatter, other than real warnings and errors
> while testing my programs.  There seems to be no way to do it, so I looked
> for a way to disable auto-compile in ~/.guile configuration file.  No luck so far,
> but the variables %load-should-autocompile and GUILE_AUTO_COMPILE
> seem promising.  Sadly, they don't seem to prevent auto-compile when
> set within ~/.guile.
>
> Below is an excerpt of my shell session to demonstrate.  In case it may be
> poorly formatted, I could make  a web paste for easy viewing.

My guess is that setting GUILE_AUTO_COMPILE dynamically in your ~/.guile
is too late; the Guile process would have already been fire-up without
it set early enough to take effect (just a guess).

Try exporting the GUILE_AUTO_COMPILE variable before running your
program, or setting it inline in front of your guile command:

--8<---------------cut here---------------start------------->8---
guile hello.scm 
;;; note: source file /home/maxim/hello.scm
;;;       newer than compiled /home/maxim/.cache/guile/ccache/2.2-LE-8-3.A/home/maxim/hello.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/maxim/hello.scm
;;; compiled /home/maxim/.cache/guile/ccache/2.2-LE-8-3.A/home/maxim/hello.scm.go
Hello World
maxim@apteryx ~$ rm .cache/guile/ccache/2.2-LE-8-3.A/home/maxim/hello.scm.go
maxim@apteryx ~$ GUILE_AUTO_COMPILE=0 guile hello.scm
Hello World
--8<---------------cut here---------------end--------------->8---

Where have you seen that %load-should-autocompile variable documented?
It doesn't appear in the Guile Reference info manual.

This doesn't seem to be a bug :)

Thank you,

Maxim





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

* bug#32580: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
  2018-08-31  1:20 ` Maxim Cournoyer
@ 2018-08-31 14:00   ` seamus phenetols
  2018-09-01 18:59     ` Maxim Cournoyer
  0 siblings, 1 reply; 7+ messages in thread
From: seamus phenetols @ 2018-08-31 14:00 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 32580


Hello MC,

> My guess is that setting GUILE_AUTO_COMPILE dynamically in your ~/.guile
> is too late; the Guile process would have already been fire-up without
> it set early enough to take effect (just a guess).

I assumed ~/.guile would be evaluated before any script.  Perhaps I am mistaken.

> Try exporting the GUILE_AUTO_COMPILE variable before running your
> program, or setting it inline in front of your guile command:

Yes, that does work.  Now every time I want to disable autocompile I must:

GUILE_AUTO_COMPILE=0 guile ~/scheme/hello.scm

If there is a hello.go under $XDG_CACHE_HOME/guile then it will be used
anyway unless it is considered out of date.  I would very much prefer to:

eliminate the unnecessary chatter when no warnings or errors occur
OR disable the auto-compile feature in ~/.guile.  

If these aren't possible, then I suppose I can make a shell alias or function
for:

 GUILE_AUTO_COMPILE=0 guile

> Where have you seen that %load-should-autocompile variable documented?
> It doesn't appear in the Guile Reference info manual.
>
> This doesn't seem to be a bug :)

%load-should-autocompile was mentioned in IRC by the person who asked
me to report this as a bug.  It's also present in some commit messages I 
found by a general web search.  

Thanks.





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

* bug#32580: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
  2018-08-31 14:00   ` seamus phenetols
@ 2018-09-01 18:59     ` Maxim Cournoyer
       [not found]       ` <2474841539446639@myt2-cd7fa496c4f7.qloud-c.yandex.net>
  0 siblings, 1 reply; 7+ messages in thread
From: Maxim Cournoyer @ 2018-09-01 18:59 UTC (permalink / raw)
  To: seamus phenetols; +Cc: 32580

Hello Seamus,

seamus phenetols <seamusphenetols@yandex.com> writes:

> Hello MC,
>
>> My guess is that setting GUILE_AUTO_COMPILE dynamically in your ~/.guile
>> is too late; the Guile process would have already been fire-up without
>> it set early enough to take effect (just a guess).
>
> I assumed ~/.guile would be evaluated before any script.  Perhaps I am mistaken.
>
>> Try exporting the GUILE_AUTO_COMPILE variable before running your
>> program, or setting it inline in front of your guile command:
>
> Yes, that does work.  Now every time I want to disable autocompile I must:
>
> GUILE_AUTO_COMPILE=0 guile ~/scheme/hello.scm

As I wrote, you can also export the variable:
--8<---------------cut here---------------start------------->8---
export GUILE_AUTO_COMPILE=0
--8<---------------cut here---------------end--------------->8---

To make it permanent you can define such a line in your ~/.profile or
~/.bash_profile, and logout/login into your session to have it effective.

The Guile reference manual only defines two means to control
auto-compilation:

1. Setting the GUILE_AUTO_COMPILE environment variables (which, being an
environment variable, should be defined as such, as explained above)

2. Using the --no-auto-compile option passed directly to the guile
interpreter.

Let me know if this addresses your issue.

Thank you,

Maxim





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

* bug#32580: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
  2018-08-29 22:49 bug#32580: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling seamus phenetols
  2018-08-31  1:20 ` Maxim Cournoyer
@ 2018-09-02 19:22 ` Daniel Llorens
  2021-05-18 16:30 ` Taylan Kammer
  2 siblings, 0 replies; 7+ messages in thread
From: Daniel Llorens @ 2018-09-02 19:22 UTC (permalink / raw)
  To: 32580


I think, regardless of whether GUILE_AUTO_COMPILE works correctly or not (and public variables should all be documented, so if %load-should-autocompile isn't, I'd call that its own bug), I agree with the substance of the complaint. The autocompilation messages aren't warnings and shouldn't be sent to the warning port. Maybe they should be sent to a logging port instead.






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

* bug#32580: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
       [not found]       ` <2474841539446639@myt2-cd7fa496c4f7.qloud-c.yandex.net>
@ 2018-10-15  0:21         ` Maxim Cournoyer
  0 siblings, 0 replies; 7+ messages in thread
From: Maxim Cournoyer @ 2018-10-15  0:21 UTC (permalink / raw)
  To: seamus phenetols; +Cc: 32580

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

Hello Seamus,

seamus phenetols <seamusphenetols@yandex.com> writes:

> Setting GUILE_AUTO_COMPILE in ~/.profile and in ~/.bash_profile
> doesn't seem to have any effect.  I'm giving up on guile for now.
> Thank you very much for helping.

I'm sorry it hasn't worked for you! Let's see if we can find out why.

What exactly did you put in your ~/.profile or ~/.bash_profile? What
version of Guile are you using? When launching a new pseudo terminal
(i.e. xterm, gnome-terminal, etc.) and typing 'echo
$GUILE_AUTO_COMPILE', does it return the expected value defined in your
~/.profile or ~/.bash_profile?

Note that you would need to logout then login of your session for new
variable definition to take effect; otherwise you can test it in your
current shell by sourcing it:

--8<---------------cut here---------------start------------->8---
source ~/.bash_profile # or source ~/.profile
--8<---------------cut here---------------start------------->8---

I've put the following Scheme code in a file named
'test-auto-compile.scm' (attached for your convenience):

--8<---------------cut here---------------start------------->8---
#!/usr/bin/env guile
!#

(define (main)
  "Print whether auto-compilation is enabled or not and exit with an
exit status of 1 if it is enabled, 0 otherwise."
  (let ((guile-auto-compile-value (getenv "GUILE_AUTO_COMPILE")))
    (display (format #f "The value of GUILE_AUTO_COMPILE is ~s\n"
		     guile-auto-compile-value))
    (when (and guile-auto-compile-value
	       (string=? guile-auto-compile-value "0"))
	(display "Auto-compilation is disabled.\n")
	(exit 0))
    (display "Auto-compilation is enabled.\n")
    (exit 1)))

(main)
--8<---------------cut here---------------start------------->8---

Here's a small demonstration of what the above script gives on my system
(guile --version is 2.2.4, but this should work for any Guile version >=
2.0):

--8<---------------cut here---------------start------------->8---
echo $GUILE_AUTO_COMPILE

maxim@apteryx ~/Documents$ guile test-auto-compile.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/maxim/Documents/test-auto-compile.scm
;;; compiled /home/maxim/.cache/guile/ccache/2.2-LE-8-3.A/home/maxim/Documents/test-auto-compile.scm.go
The value of GUILE_AUTO_COMPILE is #f
Auto-compilation is enabled.
maxim@apteryx ~/Documents$ 
maxim@apteryx ~/Documents$ rm /home/maxim/.cache/guile/ccache/2.2-LE-8-3.A/home/maxim/Documents/test-auto-compile.scm.go
maxim@apteryx ~/Documents$ export GUILE_AUTO_COMPILE=0
maxim@apteryx ~/Documents$ guile test-auto-compile.scm
The value of GUILE_AUTO_COMPILE is "0"
Auto-compilation is disabled.
--8<---------------cut here---------------end--------------->8---

I hope this helps,

Maxim


[-- Attachment #2: Short program demonstrating GUILE_AUTO_COMPILE --]
[-- Type: text/plain, Size: 539 bytes --]

#!/usr/bin/env guile
!#

(define (main)
  "Print whether auto-compilation is enabled or not and exit with an
exit status of 1 if it is enabled, 0 otherwise."
  (let ((guile-auto-compile-value (getenv "GUILE_AUTO_COMPILE")))
    (display (format #f "The value of GUILE_AUTO_COMPILE is ~s\n"
		     guile-auto-compile-value))
    (when (and guile-auto-compile-value
	       (string=? guile-auto-compile-value "0"))
	(display "Auto-compilation is disabled.\n")
	(exit 0))
    (display "Auto-compilation is enabled.\n")
    (exit 1)))

(main)

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

* bug#32580: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling
  2018-08-29 22:49 bug#32580: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling seamus phenetols
  2018-08-31  1:20 ` Maxim Cournoyer
  2018-09-02 19:22 ` Daniel Llorens
@ 2021-05-18 16:30 ` Taylan Kammer
  2 siblings, 0 replies; 7+ messages in thread
From: Taylan Kammer @ 2021-05-18 16:30 UTC (permalink / raw)
  To: 32580-done

Closing as this was not a bug.

Exporting GUILE_AUTO_COMPILE=0 works as intended; must be done before start.

The variable %load-should-autocompile is for internal use by Guile only.

-- 
Taylan





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

end of thread, other threads:[~2021-05-18 16:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-29 22:49 bug#32580: Setting variables %load-should-autocompile and GUILE_AUTO_COMPILE in ~/.guile doesn't prevent compiling seamus phenetols
2018-08-31  1:20 ` Maxim Cournoyer
2018-08-31 14:00   ` seamus phenetols
2018-09-01 18:59     ` Maxim Cournoyer
     [not found]       ` <2474841539446639@myt2-cd7fa496c4f7.qloud-c.yandex.net>
2018-10-15  0:21         ` Maxim Cournoyer
2018-09-02 19:22 ` Daniel Llorens
2021-05-18 16:30 ` Taylan Kammer

unofficial mirror of bug-guile@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-bugs/0 guile-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-bugs guile-bugs/ https://yhetil.org/guile-bugs \
		bug-guile@gnu.org
	public-inbox-index guile-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.bugs
	nntp://news.gmane.io/gmane.lisp.guile.bugs


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git