IRC channel logs

2023-07-05.log

back to list of logs

<rlb>...nothing's using them yet, but sparse utf-8 indexes are now included in the new series. I think that might be just about "everything", but there's still a lot of optimization to do, i.e. reworking ref/set! and the bulk offset computation to use the index, rewriting various functions that use set! to do something else, etc. But for the most part, might "just" be cleanup and optmization now.
<rlb>Once I get a bit further, I'll put up a branch so people can poke at it.
<dalepsmith>As Guile is moving more and more of its implementation from C to Scheme, the Scheme FFI is somewhat preferred.
<dalepsmith>It might have some more overhead now, but eventually, it might be way better.
<dalepsmith>Like if Guile compiles directly to native machine code, FFI calls might eventually be "direct".
<wmedrano>What's the best practice for error reporting? In the procedure I made below, the error is always "Wrong type argument in position 1". Is it a good practice to validate the arguments some more or should I depend on something else like tests and documentation?
<wmedrano>scheme@(guile-user)> (make-track #:plugin-id '(1 2))
<wmedrano>ice-9/boot-9.scm:1685:16: In procedure raise-exception:
<wmedrano>In procedure symbol->string: Wrong type argument in position 1 (expecting symbol): 1
<wmedrano>Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
<wmedrano>scheme@(guile-user) [1]> (make-track #:plugin-id '(lv2 2))
<wmedrano>ice-9/boot-9.scm:1685:16: In procedure raise-exception:
<wmedrano>In procedure scm_to_utf8_stringn: Wrong type argument in position 1 (expecting string): 2
<spk121>RhodiumToad: I'm trying to build Guile from git on a FreeBSD VM. during the autogen.sh, I get "m4: illegal option -- -". Any advice?
<dokma>How does one get sha-256 in Guile?
<dokma>I see this: https://gitlab.com/weinholt/hashing
<dokma>Is that the one I'm supposed to use?
<dokma>I can see it's not the regular configure, make, make install stuff. How do I install that?
<flatwhatson>dokma: https://notabug.org/cwebber/guile-gcrypt
<dokma>That's the proper one? flatwhatson
<flatwhatson>i'm not sure about "proper", but gcrypt is a production-grade library and guile-gcrypt is what guix uses internally for hashing needs
<flatwhatson>the weinholt one looks like a pure scheme implementation, which might be fine, but probably won't perform as well and is definitely not as widely used
<dokma>flatwhatson: running bootstrap.sh gives me configure.ac:14: error: possibly undefined macro: GUILE_PKG
<flatwhatson>the easiest way to manage guile dependencies is with guix
<dokma>I have guile 3.0.9 in /usr/local/bin and it is in PATH
<dokma>flatwhatson: I do have guix installed but it is not obvious to me what is missing
<flatwhatson>if you have guix, then use that to install stuff instead of building it yourself
<dokma>Oh, install guile-gcrypt via guix
<dokma>gotcha
<flatwhatson>yes, and also for guile - that /usr/local/bin/guile is unnecessary and might cause you problems
<dokma>got it
<dokma>So install everything guile related via guix
<mfiano>i learned this the hard way. i was stubborn and tried guix twice and gave up. this last time i am convinced guix is definitely the way to go.
<mfiano>I like the simple direnv with `guix shell`. I don't need any elaborate profile or package metadata written for my personal experiments yet
<mfiano>it's easy and it's 1 line to add to a file to get a properly configured load path with everything on it. i couldn't ask for more, really
<dokma>I've been messing with guile for almost half a year and nobody neither mentioned this nor is it somewhere in the manual in a way that got my attention.
<mfiano>i have been messing with it for about as long and that was the first thing that was recommended to me in this channel :)
<mfiano>it's also quite common in most guile repositories to have a guix package
<mfiano>The manual briefly mentions Guix when talking about code distribution using Hall.
<mfiano>I think it was written at a time when Guix was primarily GuixSD
<dokma>So in this project I'm working on I depend on guile-sqlite3 and now I need guile-gcrypt. I suppose all of that can be managed via guix?
<mfiano>Yes do
<dokma>All I need to do is sudo make uninstall on guile and guile-sqlite3 ?
<mfiano>eval $(guix shell guile guile-sqlite3 guile-gcrypt --search-paths)
<mfiano>in your .envrc if you're using direnv for automatically switching the env var
<dokma>Ok, I did sudo make uninstall on guile, guile-sqlite3, guile-json, guile-websocket
<dokma>
<dokma>guix is installed so now just guix install guile ?
<mfiano>`guix install` will install things into your global user profile
<mfiano>That is probably not what you want
<mfiano>Or it could be, who knows
<mfiano>I would use guix shell like the above example for per project dependencies
<dokma>I don't know anything about guix. So go into my project folder and run guix shell there?
<mfiano>you can automate this to run when you change into the directory with direnv (or change to the project in emacs with envrc.el).
<mfiano>That command is all you need
<mfiano>You just add the packages you want to depend on in that comamnd and run it when you want to switch to this project
<mfiano>With direnv, it does this when you cd into the directory with a special .envrc file
<mfiano>direnv is a separate tool
<dokma>What happens with: eval $(guix shell guile guile-sqlite3 guile-gcrypt --search-paths)
<mfiano>you can run guix shell anywhere. it just modifies a few environment variables
<mfiano>you dont have to run it yourself though with direnv
<dokma>I got the direnv part. I don't understand what the command does.
<dokma>I know literally nothing about guix
<mfiano>any environment variable guix needs to find the dependencies installed in the gnu store are set to point to the versions that were installed
<mfiano>for guile code, this is mostly GUILE_LOAD_PATH and related
<dokma>Oh, I see
<dokma>But I do need to install the packages first.
<mfiano>guix shell does that
<dokma>That's where I'm at right now.
<dokma>Oh, I see
<mfiano>it does everything and only does what is needed lazily
<dokma>So on first run it will install and later only set the environ?
<mfiano>the first time it will download and compile (or install if a substitute (binary package) is avaqilable)
<mfiano>but after that it will be instant
<dokma>sudo not needed?
<dokma>Where will the packages get installed?
<mfiano>if you want to upgrade any versions, you can do that too on a per project basis
<mfiano>using `guix install` puts things into your global user profile, available in all sub environments
<dokma>Don't get that at all. global user profile? sub environments?
<mfiano>sudo is not needed, or shouldn't be if guix was installed correctly
<mfiano>i would never run a command as root that downloads anything or something like that
<mfiano>If you installed guix it will tell you what your profile is
<mfiano>right in the installation. it will tell you what to add to your shell startup files to activate your profile
<mfiano>you do have to follow the instructions, and you will learn about all this. for everything else, i found the guix manual to be very good
<dokma>mfiano: I installed guix via sudo apt install guix. Was that at least correct?
<mfiano>No. You want to install from the install script. debian is notorious for very old software and I fear you will run into the usual debian problems searching for help with everyone else
<mfiano>Also, installing with your operating system's package manager is actually pointless
<mfiano>guix will update itself and install new files over time
<dokma>Ok, so guix via git clone, configure and the friends and the rest via guix
<mfiano>your os will not know how to remove it
<dokma>Got it
<dokma>Thanks a bunch for your time
<mfiano>no
<mfiano>the guix-installer.sh
<mfiano>it is a single wget away and the invokable with sh
<dokma>Oh, ok
<mfiano>(or curl, fetch or what have you)
<mfiano>No problem. Good luck
<dokma>Can someone tell me which user is a member of _guixbuild on your system?
<dokma>I'm having issues with my guix install.
<dokma>Stupid nonsense. guix barfed because my main user was in more than 10 user groups...
<dokma> supplementaryGIDs.resize(10);
<dokma> int ngroups = supplementaryGIDs.size();
<dokma> int err = getgrouplist(pw->pw_name, pw->pw_gid,
<dokma> supplementaryGIDs.data(), &ngroups);
<dokma>
<dokma>So basically if your user is in more than 10 user groups guix will barf here...
<dokma>My user is in 25 groups...
<rekado>dokma: wrong channel. But the code you’re quoting is about the *build user*, not your main user account.
<dokma>rekado: I had to manually create _guixbuild group cause I was getting an error.
<dokma>Then I got an error that it had no users so I added my main user.
<dokma>Which users are in your _guixbuild group?
<dokma>flatwhatson: are you using guix?
<dokma>mfiano: which users are in your _guixbuild group?
<jpoiret>dokma: can you move this discussion to #guix? i'd be happy to answer there
<dokma>sure
<dokma>Magically, after installing guile via guix my own project just works.
<kitzman>is there a minimum linux kernel version required to run guile?
<RhodiumToad>guile doesn't only run on linux :-)
<kitzman>i guess anything that has POSIX syscalls should work, right? (such as BSDs)
<RhodiumToad>fsvo "work". I get the impression that the developers don't test on other platforms much
<RhodiumToad>as evidenced by the botch in 3.0.9 release that broke almost everywhere
<kitzman>i can't configure guile on plan9 with the POSIX environment. there's also a linux emulation layer which i'll try later. it comes with gcc 3.3.5 apparently, hmm
<RhodiumToad>3.3.5????
<RhodiumToad>that's a bit old
<RhodiumToad>my freebsd port build includes a gcc 4.8 because some old UEFI CSM firmware needs it to build, and it always whines at me about the fact that it's been EOLed for about 8 years
<RhodiumToad>how did it fail, btw?
<kitzman>mainly, they're not GNU tools. no gnu ls (removed that part), no printf, and now it's not able to substitute variables as desired
<kitzman>this is, with the assumption that i can disable most dependencies
<Arsen>how does it fail to build?
<kitzman>i can't get to that step. i'm trying to configure it
<Arsen>guile certainly doesn't require linux nor is very linux specific
<Arsen>that's part of the build in my book :P
<Arsen>what error do you see
<kitzman>so after ,s/printf/echo/g and removed the 'ls -di' parts, it fails on a shell substitution, probably ${MAKE-make}. i'll actually try creating plan9 mkfiles, it will probably look for pkg-config and similar stuff
<kitzman>yeah i think writing mkfiles should work; afaik, jit requires dynamic loading, so i'll disable that and most features;
<kitzman>either that or i port my code to another scheme implementation
<Arsen>why not just fix the unportabilities in the configure?
<Arsen>IIUC, that's the problem (but I'd like to see a config.log)
<kitzman>well, 'configure' is a big file to patch, and there's no autotools for plan9. the ANSI/POSIX C compiler also lacks a lot of features found in GCC
<kitzman>it lacks pkg-config and most of the stuff you'd find on BSDs and Linux
<Arsen>IIRC, guile doesn't use many or any GCC extensions, and you can patch autoconf files before rebuilding them on other machines
<Arsen>patching configure is, indeed, frivolous :)
<kitzman>i'll stay around here, as the attempt will take a while
<kitzman>plan9 has a scheme implementation, s9fes, but would prefer guile any day
<kitzman>(which doesn't have most srfis, ice-9, etc)
<Arsen>ls -di is POSIX it'd seem
<Arsen>I thought plan 9 had some POSIX implementation?
<kitzman>it only contains a C compiler, a shell, grep, no ls though...
<Arsen>heh.. fun
<ArneBab>I’ve just hit something that has been feeling strange for a while: there’s no vector-map. I know that I can simply create it with (define (vector-map fun . args) (apply map fun (map vector->list args))) but it still feels weird not to have that. It keeps me from using vectors as first-class datastructure …
<ArneBab>more precisely: (define (vector-map fun . args) (list->vector (apply map fun (map vector->list args))))
<Zambyte>ArneBab: R7RS (and probably others) has vector-map. You can (import (only (scheme base) vector-map)) if you want it
<ArneBab>Zambyte: oh — thank you!
<ArneBab>I wonder why we don’t have that in Guile without import — is there a specific reason or is it historical (no one added it)?
<Zambyte>SRFI-43 also has it
<flatwhatson>srfi-43 - yeah.
<Zambyte>It's probably expected that you would import that srfi
<lloda>guile-user should have less stuff rather than more
<lloda>also vector-map in srfi-43 isn't the same as in r7rs - it takes indices
<Zambyte>Oops, then yeah it seems like ArneBab wants the R7RS vector-map
<kitzman>JumpNetwork OFTC
<kitzman>sorry
<graywolf>Is it possible to modify how often the GC runs? I would like to force it to run as often as possible.
<ArneBab>Zambyte: yes: when in doubt I prefer moving closer to the standard.
<Zambyte>graywolf: There is the (gc) procedure that will invoke garbage collection
<dthompson>graywolf: gc runs when there's no space left on the heap for allocation but you can manually run it with the 'gc' procedure.
<dthompson>I don't know your reasons for doing so, but it may not achieve the result you want.
<Zambyte>If you want it to run as often as possible you could run (let loop () (gc) (loop)) :D
<graywolf>I plan to experiment with (system foreign), so I wanted to have gc run after every line/instruction/whatever the granularity is) during tests to make sure I keep everything reachable
<graywolf>The loop, executed in secondary thread, might suffice, thanks
<dthompson>I think for that you'd want to hook into guile's vm interrupts
<graywolf>dthompson: Oh, that looks like something I could misuse for my goals :) Thanks, I missed that part of the documentation.
<dthompson>have fun :)