jbclements / RSound

A cross-platform sound library for DrRacket
http://www.brinckerhoff.org/clements
Other
45 stars 11 forks source link

[CS] Wrong embedded lib path for buffer-add.so #46

Closed Metaxal closed 2 years ago

Metaxal commented 3 years ago

On linux with Racket CS, the lookup path is

> (system-library-subpath)
#<path:x86_64-linux/cs>

but the embedded library is only in the 3m path.

One possible fix is to make the path independent of the GC type:

> (system-library-subpath #f)
#<path:x86_64-linux>

and embed the libraries in the corresponding path.

The relevant line is here.

pmatos commented 2 years ago

I just hit this bug as well on 8.3 CS... For now I symlinked a cs folder to the existing 3m, but it still doesn't work.

Test program is the very trivial:

#lang racket
(require rsound)
(diagnose-sound-playing)
Assertion #<procedure:negative?> failed on 0.0
pmatos commented 2 years ago

In addition to what @Metaxal said, it doesn't seem that the file https://github.com/jbclements/RSound/tree/master/rsound/private/x86_64-linux/3m/buffer-ad.so should be committed to the repo. It should instead be compiled locally as part of raco setup.

pmatos commented 2 years ago

If I manually run the makefile locally I am getting:

✗ make -f makefile-linux all
raco ctool --cc buffer-add.c
raco ctool --ld buffer-add.so buffer-add.o
link-extension: 
/usr/bin/ld: cannot find /home/pmatos/installs/racket-8.3/lib/mzdyn.o: No such file or directory
collect2: error: ld returned 1 exit status
  context...:
   /home/pmatos/installs/racket-8.3/share/pkgs/dynext-lib/dynext/link-unit.rkt:336:8: unix/windows-link
   /home/pmatos/installs/racket-8.3/share/pkgs/cext-lib/compiler/commands/ctool.rkt:252:0
   body of "/home/pmatos/installs/racket-8.3/share/pkgs/cext-lib/compiler/commands/ctool.rkt"
   /home/pmatos/installs/racket-8.3/collects/raco/raco.rkt:41:0
   body of "/home/pmatos/installs/racket-8.3/collects/raco/raco.rkt"
   body of "/home/pmatos/installs/racket-8.3/collects/raco/main.rkt"
make: *** [makefile-linux:4: buffer-add.so] Error 1
jbclements commented 2 years ago

The linux makefile was old, there's no need to use ctool to compile this teeny tiny file. I abstracted the makefile generator a tiny bit to generate a makefile for linux as well as mac.

With this updated makefile, I can successfully build the libraries for linux. (Really, if you read the source code for buffer-add, you'll laugh. It's tiny tiny tiny.)

I've tested it as far as

raco test -m ./test-s16vector-add.rkt 
raco test: (submod "./test-s16vector-add.rkt" test)
10 success(es) 0 failure(s) 0 error(s) 10 test(s) run
0
10 tests passed

... which suggests that the library is compiled correctly at least on that (x86-64, debian 10, cs) platform.

I can't run all tests, because my machine is a VPS with no actual sound hardware.

However, I wouldn't expect this to solve your (@pmatos ) issue with negative numbers, that sounds like a separate issue?

pmatos commented 2 years ago

However, I wouldn't expect this to solve your (@pmatos ) issue with negative numbers, that sounds like a separate issue?

Yep - you're right. I still get the negative number abort.

jbclements commented 2 years ago

Oh, I see I also didn't address your comment about compiling it as part of installation; unless I'm missing something obvious, that would prevent its being used on systems without a C compiler, which I think is pretty common among students & teachers.