gambiteer on master
Make manual's TCP Client with T… Merge pull request #762 from ve… (compare)
feeley on master
Windows: Fix typo (compare)
feeley on master
Fix select abort for --enable-m… Windows: restrict event mask to… Avoid infinite loop on EPIPE er… and 1 more (compare)
FLAGS_DYN="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/.package_note-gambit-c-4.9.3-7.fc36.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -fmodulo-sched -freschedule-modulo-scheduled-loops -fomit-frame-pointer -fPIC -fno-common -mpc64 -rdynamic -shared"
FLAGS_LIB="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/.package_note-gambit-c-4.9.3-7.fc36.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -rdynamic -shared"
FLAGS_EXE="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/.package_note-gambit-c-4.9.3-7.fc36.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -fmodulo-sched -freschedule-modulo-scheduled-loops -fomit-frame-pointer -fPIC -fno-common -mpc64 -rdynamic"
FLAGS_DYN="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/home/tck42/rpmbuild/BUILD/gambit-4.9.4/.package_note-gambit-c-4.9.4-1.fc37.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fmodulo-sched -freschedule-modulo-scheduled-loops -fomit-frame-pointer -fPIC -fno-common -mpc64 -rdynamic -shared"
FLAGS_LIB="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/home/tck42/rpmbuild/BUILD/gambit-4.9.4/.package_note-gambit-c-4.9.4-1.fc37.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -rdynamic -shared"
FLAGS_EXE="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/home/tck42/rpmbuild/BUILD/gambit-4.9.4/.package_note-gambit-c-4.9.4-1.fc37.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fmodulo-sched -freschedule-modulo-scheduled-loops -fomit-frame-pointer -fPIC -fno-common -mpc64 -rdynamic"
I see the problem in configure.ac
:
if test "$ENABLE_CPLUSPLUS" = yes; then
CORCXXFLAGS="$CXXFLAGS"
else
CORCXXFLAGS="$CFLAGS"
fi
FLAGS_OBJ="$CORCXXFLAGS $FLAGS_OBJ $FLAGS_OBJ_DYN $FLAGS_OBJ_DYN_LIB_EXE"
FLAGS_DYN="$LDFLAGS $CORCXXFLAGS $FLAGS_DYN $FLAGS_OBJ_DYN $FLAGS_OBJ_DYN_LIB_EXE $FLAGS_DYN_LIB"
so I was wrong and CFLAGS
from the build environment is being captured in the generated gambuild-C
script...
LDFLAGS
at the time of the ./configure
is captured and used by the Gambit makefiles (to build libgambit.a
, gsi
and gsc
) and also by the gambuild-C
script which is used to compile the standard modules (SRFIs, etc) and also user modules. I propose to add a new option to configure
that allows capturing a different set of flags in the gambuild-C
script. So ./configure --enable-gambuild-ldflags="-foo -bar"
will only capture those flags in gambuild-C
(but the LDFLAGS
that exist when the gambuild-C
script is called will still be used by the C compiler, as this is normal behavior). A ./configure --enable-gambuild-ldflags="" …
will thus only use the late binding of LDFLAGS
and a ./configure --enable-gambuild-ldflags="$LDFLAGS" …
will cause the same behavior as now. The same can be done for CFLAGS
and CXXFLAGS
.
CFLAGS
and LDFLAGS
environment variables are always used implicitly by the C compiler, so putting them in the binding of FLAGS_
is redundant at build time (when doing ./configure …;make
). It is only relevant when a programmer is using the gsc
compiler after it is built and installed. Either to generate a .oN
file with gsc foo.scm
or an executable program with gsc -exe foo.scm
(both cases invoke the gambuild-C
script). I believe your problem will be solved if the gambuild-C
script does not capture the setting that LDFLAGS
had at build time by using ./configure --enable-gambuild-ldflags=""
.
@gambiteer The define-type
form is identical to define-structure
. It is also easy to map define-record-type
to define-type
. It is done with:
(define-runtime-macro (##define-record-type name constructor predicate . fields)
`(##define-type ,name
constructor: ,constructor
copier: #f
predicate: ,predicate
no-functional-setter:
,@fields))
Some documentation is here: https://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20090226/af2ee44c/attachment.txt
It would of course be good to define the form properly in the Gambit manual. I’ve added an issue for this on the github repo.
For fixes to bugs in the SMP support, 15x 100 EUR bounties are allocated. Feel tree to fix a bug and claim a bounty 👍
If one person intends to claim more than 2-3 bounties please discuss with donor in advance.
Bounty is due when validated that the bug was real and the solution is adopted by Gambit: ie an official Gambit function per the Gambit manual, that works in unicore Gambit and did not work in SMP Gambit, and with the claimant’s fix the bug is solved, and the particular PR offered is viewed as reference grade so much that it’s accepted for adoption to Gambit.
Method for transfer of the bounty eg paypal, bank, cash, crypto etc. discussed when bounty payment is due.
No particular expiry date on this offer eg 10 years (1 Jan 2032).
(Offer is nonbinding in the sense subject to current sanctions etc applicable regulations.)
Supposedly there are some easy to find and solve bounties in the SMP support now.
A bit down the line difficulty may go up and the bounty offer may be raised.
Question re: the FFI and C function pointers. If I have this in C,
int cfcn (int (*cb)()) {
cb();
}
and this in scheme,
(define call-cfcn
(c-lambda ((function () int)) int "cfcn"))
(c-define (scmcallback) () int "cname" ""
(display " ** scheme callback\n"))
(call-cfcn scmcallback)
I receive the message, 'ERROR (Argument 1) Can't convert to C function' upon executing instead of the ' ** scheme callback' message. What have I missed or mis-read?
$ gsc -v
v4.9.4-39-g9a887b80 20220503145411 x86_64-apple-darwin21.4.0 "./configure '--enable-single-host' 'CC=gcc-9'"
$ gsc cffi.scm
$ gsi cffi.o1
** scheme callback
42
$ cat cffi.scm
(c-declare "
int cfcn (int (*cb)()) {
return cb() * 7;
}
")
(define call-cfcn
(c-lambda ((function () int)) int "cfcn"))
(c-define (scmcallback) () int "cname" ""
(display " ** scheme callback\n")
6)
(pp (call-cfcn scmcallback))
If I compile the following:
(let loop ((i 0))
(when (< i 100000000)
(display i)
(newline)
(loop (+ i 1))))
and then pipe the output to head
like this
./x | head
the pipeline appears to hang. I'm not sure what ./x
is doing, since it has no place to write to, but it nevertheless consumes a lot of cpu time.
➜ flub cat foo.py
i = 0
while i < 10000:
print(i)
i+=1
➜ flub python3.10 foo.py | head
0
1
2
3
4
5
6
7
8
9
Traceback (most recent call last):
File "/tmp/flub/foo.py", line 3, in <module>
print(i)
BrokenPipeError: [Errno 32] Broken pipe
@cornett By default the interpreter uses stdin and stdout as the “REPL channel” to interact with the user. This can be changed with the -:dc
runtime option so that the REPL channel is connected to the controlling terminal. This allows observing the error:
$ cat head.scm
(let loop ((i 0))
(when (< i 100000000)
(display i)
(newline)
(loop (+ i 1))))
$ gsi -:dc head.scm | head
0
1
2
3
4
5
6
7
8
9
*** ERROR IN ##wr-substr -- Broken pipe
(write-substring "923" 0 3 '#<output-port #2 (stdout)>)
So when the -:dc
option is not used the runtime system will attempt to output this error message on the REPL channel which is stdout, but this generates a similar error that the runtime system tries to output to stdout, and an infinite error loop results.
In the past Gambit used the controlling terminal for the REPL channel, but this was changed because users found this to give surprizing behavior, in particular they expect echo "(+ 1 2) (exit)" | gsi
to feed the REPL with commands, which did not work when the controlling terminal is used as the REPL channel.
If you prefer the old behavior, you could set the GAMBOPT
environment variable with export GAMBOPT=dc
2
or 3
to the -:d
runtime option:$ gsi -:d2c head.scm | head
0
1
2
3
4
5
6
7
8
9
*** ERROR IN ##wr-substr -- Broken pipe
(write-substring "923" 0 3 '#<output-port #2 (stdout)>)
0 ##wr-substr
1 ##write-generic-to-character-port
2 ##display
3 loop "head.scm"@3:5 (display i)
4 (interaction) "head.scm"@1:1 ((letrec ((loop (lambda (...
5 ##load
6 ##load
7 ##main
$ gsi -:d3c head.scm | head
0
1
2
3
4
5
6
7
8
9
*** ERROR IN ##wr-substr -- Broken pipe
(write-substring "923" 0 3 '#<output-port #2 (stdout)>)
0 ##wr-substr
1 ##write-generic-to-character-port
2 ##display
3 loop "head.scm"@3:5 (display i)
i = 923
loop = (lambda (i) (if (< i 100000000) (begin (display i) (newlin... #3
4 (interaction) "head.scm"@1:1 ((letrec ((loop (lambda (...
5 ##load
6 ##load
7 ##main