libera/#commonlisp - IRC Chatlog
Search
14:04:42
artchad
interesting is that asdf:*central-registry* doesn't include ~/.local/share/common-lisp/source nor ~/common-lisp by default.
14:06:38
Bike
the asdf central registry is only a backwards compatibility thing. you're supposed to use the newer config mechanism now, and that's what asdf uses for those directories probably
14:53:29
White_Flame
artchad: most people use quicklisp nowadays, and symlink their project trees from ~/quicklisp/local-projects/ to make them visible
14:54:09
White_Flame
(well most people use quicklisp. not that necessarily most people use its local-projects dir over asdf)
14:54:45
White_Flame
but it uses that filesystem artifact to maintain their default visibly loadable projects
14:58:05
artchad
it's a waste to time to try and figure out why something failed, just to realize that a system in local-projects contains a system with the same name, as the one pulled from quicklisp prior.
14:58:25
artchad
that's why I'm making sure all the things I clone go into a separate directory, which is not visible by default
14:58:55
artchad
only when I start a repl and explicitly want to play around with someone elses code, then I make sure quicklisp can find it.
15:00:02
frgo
Hi guys. I have been away a bit - so please excuse me jumping right to an issue I couldn't resolve for the last couple of days: c2ffi on ARM64. I am trying to build cl-sdl2 and it fails misrably on my NVIDIA Jetson Xavier NX (being an ARM64 6-core CPU). Anybody here with experience c2ffi on ARM64?
15:03:46
White_Flame
artchad: ah, ok. I have some loader scripts in my .sbclrc as well, for pulling in things with their own static libraries
15:06:30
frgo
If anyone wants to see the issue: https://gist.github.com/dg1sbg/2f997df6bd4183578aae24b02663bd73#file-c2ffi-failing-on-arm64-when-building-cl-sdl2
15:21:58
phoe
like, the real error seems to be in /usr/lib/llvm-12/lib/clang/12.0.0/include/arm_neon.h:1730:47 and not anything that includes that file
15:54:15
_death
frgo: I don't use this architecture, but vector operations table at https://clang.llvm.org/docs/LanguageExtensions.html seems to suggest that clang does not support C-style cast for neon vector types
15:57:26
SAL9000
phoe: regarding l-t-v and static-let ( https://github.com/phoe/articles/blob/main/2022-01-30-load-time-value/README.md ) -- could you fall back to implementing load-time-value via let-over-lambda in implementations where eval semantics != compile semantics?
15:58:35
phoe
SAL9000: I can't, the LET would need to be hoisted all the way up and above the LAMBDA
15:59:06
phoe
one way to fix it would be to make an external hashtable from some sorta symbols to values, but that would be kinda ugly
16:01:28
SAL9000
what if, at macroexpand time, (let ((v (make-thing))) (lambda () v)) and pass the return value of that into the macroexpansion?
16:02:37
_death
frgo: SDL includes this header in SDL_cpuinfo.h .. you can try to define SDL_DISABLE_ARM_NEON_H and see what happens
16:20:19
Bike
i don't think dumping functions works on any implementation. i would be interested if one could do it
16:20:42
phoe
again, you could try to (load-time-value (lambda () v)) to work around this problem, but, sike, we are using load-time-value
16:23:17
Bike
phoe: translating a runtime function object into a description of a function object is nontrivial
16:25:22
SAL9000
but hey at least we aren't in bizarro C++ land, where const doesn't always mean constant (i.e. const qualifier on pointers)
16:26:04
Bike
constants could also influence dumpability in weird ways. like, if you have (lambda () (if t 0 #.(non-externalizable-object))), whether that could hypothetically be dumped depends on how much optimization the compiler does.
16:30:01
scymtym
http://web.archive.org/web/20170331132917/http://www.discontinuity.info/~pkhuong/common-cold/ may be interesting in this context
16:47:20
Bike
yes. symbol-value is sort of orthogonal to whether a variable has been proclaimed/declared special.
16:56:28
jasom
You could use #. instead of load-time-value; that should only get evaluated at read time, right?
16:59:06
jasom
I was thinking #.(let ((x gensym)) (setf symbol-value x 0) x) and then using the result in a macrolet
16:59:50
phoe
the symbol-value is only set in the compiler environment, it won't get dumped into the FASL
17:02:39
borodust
frgo: if you are fine with sdl2 bindings only and don't care about c2ffi working you can steal bindings from https://github.com/borodust/aw-sdl/blob/master/bindings/aarch64-linux-android.lisp
17:03:21
borodust
frgo: generally speaking though, most of SDL2 is fairly portable, so you can take any bindings and use them
17:05:03
borodust
so, what i mean, you can take cl-sdl2, rename one of the .json (linux one to be more or less safe) to the architecture of yours and be done with it
17:08:46
frgo
So, for the record: _death 's advice worked. I will compare results with the android output.
17:11:48
borodust
ahh, i guess, i need to read better next time, i thought there's a problem with c2ffi
17:34:04
jasom
biggest downside is you can't declare the type of it; some magic with cl:the might let you get around it
17:40:26
sm2n
alpine doesn't make all the dependencies for ecl necessary for building as necessary dependencies by default
17:41:56
sm2n
(Also, the only reason I used ecl is because I was running it on a very old raspberry pi short on ram, feel free to try another implementation, everything but the build scripts should be portable, and I developed on sbcl)
17:47:16
sm2n
something like (progn (ql:quickload :scanner) (save-lisp-and-die "scanner" :toplevel #'scanner:main :executable t)) I think
17:50:45
yottabyte
how can I check if every element in a list is in another list? I know I can iterate over the list and do find, but I imagine there's a simpler way
17:52:49
sm2n
yeah, try replacing the #'scanner:main with (lambda () (scanner:main) (mapcar #'bt:join-thread (bt:all-threads)))
17:56:48
artchad
"Unhandled SB-THREAD:JOIN-THREAD-ERROR in thread #<SB-THREAD:THREAD "main thread" RUNNING"
18:01:03
Bike
besides the fact that trying to join all threads might be weird if some library you don't expect made threads, this isn't totally safe, since it's possible another thread gets created just after all-threads returns.
18:02:45
phoe
attempting to join threads that you don't manage yourself sounds like a recipe for hanging forever
18:12:41
sm2n
the directory is changed in the scan command usually, but that failed because you didn't have scanimage
18:19:51
artchad
now I just need to get sane working in the terminal and then everything should be great.
18:37:28
artchad
ok, getting the correct driver is apparently non-trivial on Alpine. On Devuan it worked.
18:57:39
fe[nl]ix
sm2n: see the note in https://sionescu.github.io/bordeaux-threads/threads/join-thread/
18:59:18
sm2n
fe[nl]ix: What would you suggest? (It does seem to work in this case, but hunchentoot uses bordeaux-threads under the hood and it's the only thing running, so that may be why)
19:02:42
sm2n
yeah, the usecase is that an executable is produced, and it only has hunchentoot in it, but the hunchentoot event loop isn't on the main thread, so without some way of blocking, the application just immediately closes
19:05:06
lisp123
Is there a standard function to write association lists like this: (make-alist key datum key datum key datum)?
19:06:43
White_Flame
lisp123: there is (mapcar #'cons '(k1 k2 k3) '(v1 v2 v3)) => ((K1 . V1) (K2 . V2) (K3 . V3))
19:08:39
Josh_2
sm2n: there is also a means for exiting correctly, on sbcl I believe its a list @ sb-ext:*exit-hooks*
19:12:13
sm2n
I'm not saying it doesn't work, I'm just saying I don't think that's theoretically clean in all cases either
19:13:07
Josh_2
the executable shutting down immediately is solved by searching for a thread named hunchentoot and joining it
19:15:13
White_Flame
I noticed that plist-alist does nreverse at the end. I like how COLLECT avoids that
19:15:49
White_Flame
right, for (k v) traverses 2 elements in, and then by #'cddr re-traverses 2 elements redundantly
19:15:52
lisp123
I'm anti-alexandria, everyone should write their own functions (or copy from others on IRC :D)
19:24:25
dlowe[x]
I have a question about lparallel on sbcl - let's say I set up a bunch of tasks (> number of workes) each calling cl:read-line on a socket stream. Can it successfully negotiate all the I/O or is it going to block weirdly?
19:35:24
jasom
phoe: A new static-let that I *think* is more efficient, and also lets you specify the type. Modifying it to instead parse declarations for the &body form to set the type is an exercise left up to the reader: https://plaster.tymoon.eu/view/2908#2908
19:53:20
yottabyte
suddenly, I'm getting these errors in emacs: Debugger entered--Lisp error: (void-function ql:quickload), any idea what's going on?
19:55:00
Bike
yottabyte: that is the error you would get if you tried to evaluate (ql:quickload whatever) in elisp.
19:56:05
yottabyte
up until now, whenever I opened a .lisp file, it was using slime-mode and sbcl, etc.
20:03:32
Guest74
EdLangley[m]: That doesn't work for me. I don't want to load every colour library in existence just to provide support for the one colour library the user is using.
20:10:06
Guest74
hm, all the scanner talk has reminded me I haven't submitted my networked sane lib to quicklisp.
20:11:34
EdLangley[m]
Guest74: none of my suggestions were “load every colour library in existence”
20:12:00
Guest74
Xach: What's the procedure to submit a library? The quicklisp.org website's front page hasn't been updated since 2016.
20:13:35
EdLangley[m]
Guest74: yes, and my suggestions all involved defining multiple systems, each of which only depends on one colour library
20:14:11
Guest74
lagash: sm2n: it's a backend for scanning over the network. I use it to scan on my local scanner so I don't have to touch foreign stuff, it's all lisp.
20:15:03
Xach
EdLangley[m]: asdf-system-connections introduces problems also, at least for quicklisp
20:15:05
Guest74
Ed: you said so that one library would load them all, Perhaps I misinterpreted. Anyways, I hate slashes in package names.
20:19:01
Guest74
sm2n: I should mention it's only the implementation of the protocol. My frontend for it isn't in a finished state. Works fine at the repl though.
20:22:07
Guest74
https://github.com/JMC-design/nsane I should probably add links to how to actually get sane to serve a scanner over the network. I swear that was the hardest part of writing it.
20:25:25
Guest74
Xach: so issue under quicklisp-client? I ask because I don't see any such issues, i guess you delete them? I wonder why this isn't written anywhere.
20:26:02
Bike
i linked you where you should file the issue: https://github.com/quicklisp/quicklisp-projects/issues
20:51:10
_death
etimmons: I guess because it uses asdf to load the system, rather than quicklisp, so if the project is not yet installed you'd get an error
20:56:30
_death
etimmons: thinking about it some more, I think the case could be that you have A and B that are installed (as well as their dependencies), and you load project C.. C notices A and B are loaded and tries to load C-AB, but then C-AB depends on D which may not be installed.. if that's the issue quicklisp could probably know about C-AB and install the dependencies, but then it assumes A, B, and C-AB will be used, which is not certain
20:57:24
phoe
quicklisp could work around it by assuming that A, B, and C-AB *might* be used, and downloading all of them
20:59:19
etimmons
That all makes sense. I'd also be interested if there any any specific issues that crop up when building the dist (i.e., figuring out what triggers C-AB to be loaded)
20:59:48
phoe
I don't think Quicklisp has that sort of information, or can easily get it without also parsing system-connections stuff
21:00:45
etimmons
I ask partly because this issue comes up fairly regularly and the existing solution is rather nasty. So I wonder what a nice way of doing it would look like
21:00:47
phoe
so that it automatically augments the loaded systems' depends-on? or uses ASDF's kinda-deprecated :weakly-depends-on?
21:01:29
EdLangley[m]
Asdf-system-connections works, iirc, by adding a system and an :after method to operate
21:02:14
EdLangley[m]
When a system is loaded, the after method checks if the prerequisites of any connections are met and then loads the system in the connection.
21:02:32
Guest74
Which all makes it so much easier to tell the user if you want to use colours from some-library just load mylibrary-some-library first. Just kick that responsibility down the road.
21:05:38
EdLangley[m]
I sort of prototyped a solution that involved adding an emacs-like hook feature to ASDF
21:06:31
EdLangley[m]
ASDF, in general, is annoyingly opaque when it comes to introspection: a lot of the classes and operations it defines contain no information about the operation being performed.
21:09:16
jeosol
Could use some brainstorming and get some advice. I have e functions I call in sequence fa() - prepare input file, fb() - run simulation, fb() - read results. fa() and fb() are very fast, but fb() is compute intensive can take 3 seconds, 30mins, 1 hour depend on input.
21:10:08
jeosol
I am trying to run everything on remote machine when need to get some progress back. If I run everything in blocking mode, it works fine, but I don't know what stage fb() is at.
21:11:07
jeosol
I have now instrumented the code to run fb() in background and then I send request to check the status of the log file which reports back the progress of the computation (e.g., time step in finite difference simulation)
21:12:28
jeosol
My setup up works, then craps out for long jobs (socket closed, etc) - trying to rethink if there is a less problematic and cleaner way to set this up.
21:34:27
phoe
welp, yes! (mapcar #'bt:thread-name (bt:all-threads)) ;=> (SI:SIGNAL-SERVICING SI:TOP-LEVEL)
21:39:06
jeosol
It's a mess, I got a setup that works but it seems connection closing seems to be the issue
21:40:03
Josh_2
jeosol: You are connecting to the remote image with slime or some other means? There is a key arg :dont-close to create-server?
21:41:16
jeosol
I have a mix of problems, small one (runs in 3 seconds) and large ones (1 min, 10 mins)
21:42:42
jeosol
I am trying to make it fault tolerant with variant inputs, sometimes changing equality to >= due to round off errors -- real pain
21:43:32
jeosol
I try to run from other clients - python notebook making request to remote CL worker
21:48:22
Bike
search looks for a subsequence. :test #'string= only makes sense if you're dealing with sequences of string designators.
21:57:57
Josh_2
(find "hunchentoot.." (bt:all-threads) :key #'bt:thread-name :test #'string=) .. something like that
22:29:31
Josh_2
I dont know how to help you with your problem :( Sounds like a lot of information about the system is required to find the solution
22:51:04
fe[nl]ix
sm2n: thanks, I committed https://github.com/sionescu/bordeaux-threads/commit/d5692d93ab8185fa74a378360276c996186273bb