ryanc
2021-4-11 09:55:01

Usually when loading fails but the file exists, it means that dlopen tried loading the file but it depended on other libraries that couldn’t be found. But I’m not sure why that would happen, unless your libblas.so.3 is different from the one on my system. You can run ldd on the copy of libblas.so.3 in your distribution’s lib directory (with LD_LIBRARY_PATH unset) to see if it complains about any dependencies not being found.


soegaard2
2021-4-11 10:00:07

@rajan.yadav I think, you are close to get it working.

Just checking: To load libblas the dependencies (in your case libgfortran, and liblapack) needs to be available too. That is, they also need to be copied into the lib folder.

Second: If loading libblas still fails, then you need to check the actual paths inside the shared libraries to see if the path is as you expect. I believe ldd is the command used on Linux:

ldd libblas.so.3


ryanc
2021-4-11 10:11:44

I just published a package of my random utility libraries, and I added a variant of cond, but with a different syntax from sorawee’s version above. See cond+ in scramble/cond from the scramble-lib package.


chansey97
2021-4-11 14:50:36

Hi, I’d like to learn logic programming. I plan to use The Reasoned Schemer 2ed because it looks very interesting. Question: If I want to run the examples in that book, which Racket library should I use? Thanks.


chansey97
2021-4-11 14:51:23

Also very appreciate if other books recommendations.




chansey97
2021-4-11 14:53:32

Thanks.


chansey97
2021-4-11 15:29:27

The (require minikanren) seemly only works in 1ed, not in 2ed. For example, 1ed and minikanren (run∗ (q) #u) 2ed, (run∗ q #u) ; no parentheses around q And no build-in #s and #u.


soegaard2
2021-4-11 15:32:20

I have the first edition. Does the book have anything to say on how to install minikanren?


chansey97
2021-4-11 15:32:56

No.


spdegabrielle
2021-4-11 15:33:49

I think there were some comments about 2nd Ed below the blog post @soegaard2 linked


soegaard2
2021-4-11 15:38:16

An alternative is to use the same style of development, that Byrds uses. Simply save “trs2-impl.scm” next to your file. Then use (load "trs2-impl.scm") and enter everything in the repl.


chansey97
2021-4-11 15:38:18

Yes, but they use Scheme… Anyway it would be nice if have Racket version.



chansey97
2021-4-11 15:43:01

@soegaard2 It works. Thanks!


rajan.yadav
2021-4-11 15:46:41

All needed libs are in /me/mypkg/lib/ . LD_LIBRARY_PATH when set manually, just points to that dir.


soegaard2
2021-4-11 15:47:53

There could be absolute paths inside libblas. It’s worth checking.


chansey97
2021-4-11 15:51:07

PS. Even in William Byrd’s solution, #u and #s doesn’t work out of the box and monolune’s readtable hack doesn’t work for me. Although it is not a big problem because we can use succeed and fail instead.


rajan.yadav
2021-4-11 15:51:35

$ ldd mypkg/lib/libblas.so.3             linux-vdso.so.1 (0x00007ffe205bd000)     libgfortran.so.4 => not found     libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f447fc69000)     libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f447f878000)     /lib64/ld-linux-x86-64.so.2 (0x00007f44805c9000) $ ls mypkg/lib/ libblas.so libblas.so.3 libffi.so.6 libgfortran.so.3 libgfortran.so.4 liblapack.so.3 plt


rajan.yadav
2021-4-11 15:51:47

Its not finding libgfortran, but its there


rajan.yadav
2021-4-11 15:52:12

Need to keep digging into it :slightly_smiling_face:


soegaard2
2021-4-11 15:52:27

To get #u and #s working the reader needs to change. I think, #u and #s are used in the book only.


soegaard2
2021-4-11 15:52:59

Hmm.


soegaard2
2021-4-11 15:55:18

rajan.yadav
2021-4-11 15:56:45

So I need to build a version of these libs that does look into current directory


rajan.yadav
2021-4-11 15:57:11

Or inject rpath into these libs using patchelf or similar tool


soegaard2
2021-4-11 15:57:19

Let’s try to change the order in which flomat loads the libraries.


rajan.yadav
2021-4-11 15:57:21

Right?


soegaard2
2021-4-11 15:57:44

If libgfortran is loaded first, perhaps libblas will load correctly?


rajan.yadav
2021-4-11 15:58:04

Okay yes. I can try that


soegaard2
2021-4-11 15:58:08

The code that loads libblas on Linux is:


soegaard2
2021-4-11 15:58:12

soegaard2
2021-4-11 15:58:47

So try moving the (define gfortran-lib ...) above (define cblas-lib ...).


rajan.yadav
2021-4-11 15:58:57

I’ll play with it in a bit. Currently AFK. Thanks


thechairman
2021-4-11 17:03:23

@thechairman has joined the channel


josh803
2021-4-11 17:29:08

@josh803 has joined the channel


josh803
2021-4-11 17:37:23

Hi! Has anyone used the sdl2 package, particularly in the “pretty” mode? I can’t figure out how to specify a Rect struct with it…


rajan.yadav
2021-4-11 17:42:08

Looks like changing the order worked as you suggested @soegaard2


enyala9733
2021-4-11 18:06:40

hello ,I am trying build the racket from source code in https://github.com/racket/racket ,I executed build.bat in C:\Users\xx\Desktop\racket-master\racket\src\worksp ,and there is no error. but it get a runtime error like this: can anyone help?


enyala9733
2021-4-11 18:07:33

enyala9733
2021-4-11 18:08:46

It say"Failure: cannot load DLL", but obvious there has the correctly libracketxxxxxxx.dll


enyala9733
2021-4-11 18:09:20

I find “libracketxxxxxxx.dll” in github and find nothing


enyala9733
2021-4-11 18:14:38

that’s the last message in building process


mflatt
2021-4-11 18:33:00

Can you check “libracketxxxxxxx.dll” with something like “depends.exe” to see whether it depends on some other DLL that is missing? I could check if you upload “libracketxxxxxxx.dll” somewhere.


sschwarzer
2021-4-11 18:50:32

Is there a way to deactivate all contract checking in a part of the code? Some background: I had replaced car and cdr with first and rest in a time-critical function and noticed that this doubled the runtime of my program, not just the function. I reverted the change, but I’m also still wondering if I could save yet more time by deactivating contracts on vector-ref and vector-set!, for example. According to raco profile, the function at the moment contributes about 30 % of the program’s runtime.


samth
2021-4-11 18:56:06

You can use (#%declare #:unsafe)


samth
2021-4-11 18:56:18

That is, of course, unsafe


enyala9733
2021-4-11 18:59:35

mflatt
2021-4-11 19:00:32

That looks right for “RacketCGC.exe”. What are the dependencies of “libracketxxxxxxx.dll”?


enyala9733
2021-4-11 19:01:09

I re-used the x64 Native Tools Command Prompt for vs2019 to compile with administrator privileges and did not solve any problems


sschwarzer
2021-4-11 19:01:14

As I understand the documentation, this affects the whole module, doesn’t it?


samth
2021-4-11 19:01:23

Yes


enyala9733
2021-4-11 19:01:41

samth
2021-4-11 19:01:49

If you want to do it for a smaller region I would make that into a submodule


sschwarzer
2021-4-11 19:01:53

So if I wanted to use it only on some specific part of the code, I’d have to move this code to a distinct module.


enyala9733
2021-4-11 19:01:58

sschwarzer
2021-4-11 19:01:59

Ok, thought that. :slightly_smiling_face:


samth
2021-4-11 19:02:26

You can also just use individual unsafe operations


sschwarzer
2021-4-11 19:03:04

Anyway, I added (#%declare #:unsafe) for the whole module and found it hardly made a difference. So it doesn’t make any (more) difference, which is an interesting insight as well.


mflatt
2021-4-11 19:05:07

That does look likely to be the problem. Does turning down the arrow there show which import is missing?


sschwarzer
2021-4-11 19:05:12

> You can also just use individual unsafe operations You mean from https://docs.racket-lang.org/reference/unsafe.html ? Are there more than these on the page? Just asking.

I had seen the page at some point, but hadn’t seen that there were so many of these functions. Good. :+1:


enyala9733
2021-4-11 19:06:59

I don’t know how to display all the problems at once, I found this


soegaard2
2021-4-11 19:10:40

@rajan.yadav That’s great. Can you paste the exact version of the code that worked for you?


enyala9733
2021-4-11 19:13:20

Should I download an ext-ms-win-she1132-shellcom-l1–1–0.dll To try to solve this problem?


mflatt
2021-4-11 19:14:10

Probably not. When I try (what appears to be) the same dependency walker that you’re using, I see the same result, so I guess it’s not the real problem.


mflatt
2021-4-11 19:14:31

Just to make sure, your get the same error dialog if you run racket\racketcgc.exe directly, right?


enyala9733
2021-4-11 19:15:21

yes


enyala9733
2021-4-11 19:15:47

mflatt
2021-4-11 19:16:45

Oh — looking again at your original dependency list for “libracketxxxxxxx.dll”, I see “libffi.dll”, which isn’t in my build’s dependencies.


enyala9733
2021-4-11 19:18:40

you mean this one?


mflatt
2021-4-11 19:18:46

Yes.


mflatt
2021-4-11 19:19:05

I’m not sure why libffi is dynamically linked instead of statically linked, but if you go to “racket\lib” and run “..\racketcgc.exe” from there, does it start? (By going to “racket\lib”, “libffi.dll” will be in the current directory.)


enyala9733
2021-4-11 19:20:40

I cannot input anything


mflatt
2021-4-11 19:21:44

Ok - it’s going to take a very long time, since “.rkt” files are not yet compiled, but that at least started up.


mflatt
2021-4-11 19:22:46

I can look more into how libffi got linked as a DLL. Can you tell me how you started the Racket build after checking out the repo?


enyala9733
2021-4-11 19:24:29

Ah, sorry, when the problem happened for the first time, I set the environment variable


enyala9733
2021-4-11 19:27:29

I directly executed C:\Users\mingy\Desktop\racket-master\racket\src\worksp\build.bat in x64 Native Tools Command Prompt for vs 2019. This is because I used to compile version 7.5 in the same way.


enyala9733
2021-4-11 19:28:33

This is because I used the same way when compiling racket7.5 a long time ago


enyala9733
2021-4-11 19:30:19

The result of executing ..\racketcgc.exe in the lib directory just now is that it exited directly. I went back to the directory where racketcgc.exe was located and double-clicked it. The previous problem still exists.


mflatt
2021-4-11 19:31:16

Maybe something has changed (maybe as part of the libffi upgrade) so that runing just “build.bat” doesn’t work right, but it’s supposed to build BC — but with a “BC” suffix. While I look into what happens when you run “build.bat” directly, you might have more success using just nmake (to get CS build) or nmake win-bc (to get a BC build) in the repo top-level directory.


enyala9733
2021-4-11 19:34:10

Should I re-extract the source code to maintain a clean environment, and then execute make?


mflatt
2021-4-11 19:36:18

Yes. If you used git, then I’d go with git clean -d -x -f, but re-extracting sounds right if you downloaded an archive


mflatt
2021-4-11 19:38:06

I think you’re still going to run into trouble, though, since “build.bat” still works for me.


enyala9733
2021-4-11 19:39:03

enyala9733
2021-4-11 19:39:19

:sob:


enyala9733
2021-4-11 19:40:52

I used the windows insider version. Could this be the reason for our different results?


mflatt
2021-4-11 19:41:14

That doesn’t seem too likely.


enyala9733
2021-4-11 19:41:30

mflatt
2021-4-11 19:41:52

Oh, I bet it’s VS 2019 versus 2017.


mflatt
2021-4-11 19:41:57

I haven’t yet tried 2019


enyala9733
2021-4-11 19:41:59

yes


enyala9733
2021-4-11 19:46:13

I noticed that loaded is null


mflatt
2021-4-11 19:48:22

If you open “racket\src\worksp\racket\racketX.sln” in Visual Studio, right-click on the “libffiX” subproject and select “Properties”, what does it show as the “Confoguration type”? Mine says “Static library (.lib)”


enyala9733
2021-4-11 19:48:54

do you mean this?


mflatt
2021-4-11 19:49:59

Yes, thanks


mflatt
2021-4-11 19:53:37

How about libracketX -> Properties -> Linker -> Command Line?


enyala9733
2021-4-11 19:54:20

/OUT:"......\lib\libracketxxxxxxx.dll" /MANIFEST /PDB:"......\lib\libracketxxxxxxx.pdb" /DYNAMICBASE:NO “WS2_32.lib” “Shell32.lib” “User32.lib” “Winmm.lib” “kernel32.lib” “user32.lib” “gdi32.lib” “winspool.lib” “comdlg32.lib” “advapi32.lib” “shell32.lib” “ole32.lib” “oleaut32.lib” “uuid.lib” “odbc32.lib” “odbccp32.lib” /IMPLIB:"......\lib\msvc\libracketxxxxxxx.lib" /DEBUG /DLL /BASE:"0x10400000" /MACHINE:X64 /PGD:"......\lib\libracketxxxxxxx.pgd" /MANIFESTUAC:"level=’asInvoker’ uiAccess=’false’" /ManifestFile:"x64\SDebug\libracketxxxxxxx.dll.intermediate.manifest" /LTCGOUT:"x64\SDebug\libracketxxxxxxx.iobj" /ERRORREPORT:PROMPT /NOLOGO /TLBID:1


enyala9733
2021-4-11 19:55:06

Sorry, I thought the text mode would make it easier for you to search


mflatt
2021-4-11 19:55:46

I expected to see “libffi.lib” in that list. I guess something has changed in the way Visual Studio treats project dependencies, so I’ll probably have to install 2019 or find an installation to sort it out.


mflatt
2021-4-11 19:56:18

Meanwhile, probably you can make progress by temporarily adding racket\lib to your PATH so that “libffi.dll” will be found.


enyala9733
2021-4-11 19:58:19

I read this, and its default state is like this


enyala9733
2021-4-11 19:58:54

Do you mean this? what name should I type?


enyala9733
2021-4-11 20:00:44

or like this?


enyala9733
2021-4-11 20:00:54

but it did not work。。


mflatt
2021-4-11 20:01:13

Did you start a fresh command prompt after changing that?


enyala9733
2021-4-11 20:01:46

I did it by double clicking it


enyala9733
2021-4-11 20:02:11

mflatt
2021-4-11 20:04:06

Just to make sure, if you start a new command prompt and use “set” to show environment variables, the new path is in PATH? And running racketcgc in that prompt still fails?


enyala9733
2021-4-11 20:04:33

yes


enyala9733
2021-4-11 20:05:51

mflatt
2021-4-11 20:11:01

I’m stumped for now, and I’ll probably just have to create a VS 2019 installation.


enyala9733
2021-4-11 20:11:55

I noticed that the loading of libmzgcxxxxxxx.dll was successful,


enyala9733
2021-4-11 20:12:04

But the second one failed


enyala9733
2021-4-11 20:12:44

enyala9733
2021-4-11 20:24:10

Sorry I have to go to bed first, I’m at UTC+08:00, and it’s been a night。


mflatt
2021-4-11 20:28:10

晚安. I’m installing VS 2019, so maybe things will just work tomorrow.


mflatt
2021-4-11 21:08:40

No… building with VS 2019 worked for me.

I’m configuring my environment by running the “racket\src\worksp\msvcpep.bat” script. Maybe there’s a difference in how our VS environments are set up?


mflatt
2021-4-11 21:22:02

Using x64 Native Tools Command Prompt made no difference, either


mflatt
2021-4-11 21:24:26

Maybe it really is something about the OS, somehow. I’m out of other ideas.


mflatt
2021-4-11 21:33:25

Ok, one more idea: maybe there’s something in the output of build.bat for the msbuild where it’s building libffi. Here’s the output I get.


mflatt
2021-4-11 21:39:08

rajan.yadav
2021-4-11 22:16:02

[(unix)                                                            ; Note: The library names are different on Debian, Ubuntu and Arch.                             (define uname (string-downcase (system-type 'machine)))                                   (define dist (cond [(regexp-match "arch"    uname) 'arch]                                          [(regexp-match "debian"   uname) 'debian]                                         [(regexp-match "ubuntu"   uname) 'ubuntu]                                         [(regexp-match #px"fc\\d\\d" uname) 'fedora]                                         [else                'other]))                                                                                            (define gfortran-lib (case dist                                                          [(fedora) (ffi-lib "libgfortran" '("5" #f))]                                        [else   (ffi-lib "libgfortran" '("3" #f))]))                            ; The lib order is important here.                                              (define cblas-lib  (case dist                                                          [(debian) (ffi-lib "libblas" '("3" #f))]                                          [(arch)  (ffi-lib "libcblas" '("3" #f))]                                          [(ubuntu) (ffi-lib "libblas" '("3" #f))]                                          [(fedora) (ffi-lib "libcblas" '("3" #f))]                                          [(other) (ffi-lib "libblas" '("3" #f))]))                                                                                            (define quadmath-lib (ffi-lib "libquadmath" '("0" #f)))                                   (define lapack-lib  (ffi-lib "liblapack"  '("3" #f)))                                   (values cblas-lib lapack-lib)] Here it is


alexharsanyi
2021-4-11 22:32:21

I don’t know why this happens, but it may be related on what mouse messages are or are not sent to the widget — I fixed similar issues on Windows. It would be good if you can write a short program that shows this behavior, so we can test if this is a problem on MacOS only or it affects other platforms…


soegaard2
2021-4-12 06:37:38

I’ll make a small example example later. FWIW I am using an Apple Magic Trackpad 2, so it is possible the messages differ from a normal mouse.