@raphael.forment has joined the channel
Hi everyone! I followed the rules to install and compile the rtmidi package (https://pkgs.racket-lang.org/package/rtmidi). When importing the lib from the Racket 7.7 REPL, got the following error: Welcome to Racket v7.7.
> (require rtmidi)
; ffi-lib: couldn't open
; "/home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so"
; (/home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so: undefined
; symbol: snd_seq_client_info_get_name) [,bt for context]
>
I’m a newcomer to Racket. I pretty much know nothing about the language or its environment. Is it a compilation error or something related to Racket?
@raphael.forment Did you get the tar.gz file and extract that?
Yes. I extracted the tar.gz at the right location and runned make linux
as instructed
Oh, btw, I’m running the latest Pop OS distro
The error: ffi-lib: couldn't open
; "/home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so"
simply means that ffi-lib
attempted to open the file, but it wasn’t there.
bubo@pop-os:~/.racket/7.7/pkgs/rtmidi/rtmidi$ ls
compiled main.rkt rtmidi-example.rkt wrap-rtmidi.o
doc Makefile rtmidi.scrbl wrap-rtmidi.so
info.rkt rtmidi-2.1.0 <http://wrap-rtmidi.cc\|wrap-rtmidi.cc>
Hmm.
The compiled shared library is definitely there. Could it be an issue related to the ffi?
What does ls /home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so
say?
/home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so
It’s just returning the same location
It looks correct to me. I am macOS, so I hope there is a Linux user around that can help.
Or … perhaps wrap-rtmidi.so
relies on some other (missing) .so file?
If that’s the case, I bet that the last error message is giving a clue about it: ; (/home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so: undefined
; symbol: snd_seq_client_info_get_name) [,bt for context]
The docs says, that you need to instal RtMidi first - then download and make the wrapper.
So the wrapper looks to be in place. Did you install RtMidi first - and if so, is there a way to check it works?
Ok, I just installed the general rtmidi lib from the main repo, I’ll try to run the install again
What main repo?
Ubuntu repository
That’s what I would have done too.
I just grabbed the following libs: librtmidi-dev: C++ library for realtime MIDI input/ouput (development files)
librtmidi-doc: C++ library for realtime MIDI input/ouput (documentation files)
@jbclements Thoughts?
Ok. I dynamited my /pkgs/
folder. Installed from the Ubuntu repo. Runned raco pkg install rtmidi
again. Extracted and compiled the rtmidi–2.1 lib. Still no luck!
The command ldd
can show the dependencies of a shared library:
ldd /home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so
Should I install all the listed libraries? Some of them look pretty common. I guess they are already part of a base linux install
bubo@pop-os:~$ ldd /home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so
linux-vdso.so.1 (0x00007fff01bea000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f41e1db0000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f41e1d95000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f41e1ba3000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f41e1a54000)
/lib64/ld-linux-x86-64.so.2 (0x00007f41e1fce000)
They look standard so that should be fine. I can’t see rtmidi in the list though (but I don’t know whether that is to be expected or not).
I guess that the tar file to extract in the pkg folder is the whole rtmidi library
I just checked, it really looks like the main lib that you can get through the ubuntu repo
If that’s the case John must have done that to ensure that the version of rtmidi and the bindings match.
Yes. It looks like the wrapper is building against a specific frozen version of rtmidi
I have officially run out of ideas to try. I have a feeling we have overlooked something though. The ffi usually just works - if the library is in the right place.
It might just be better to wait for jbclements answer. Is he the package maintainer?
Yes, he wrote it.
In the meantime, I wonder if there is some other alternatives to explore.
I would like to use Racket to work on something linked to musical patterns, so I guess I can just use the available Open Sound Control library to send MIDI through SuperCollider sclang.
Thanks for your help!
John is definitely the person to ask, if you are interested in that sort of thing.
@raphael.forment could it be a permission issue?
Can you ls -l
?
let me try
Here is the output: bubo@pop-os:~/.racket/7.7/pkgs/rtmidi/rtmidi$ ls -l
total 1796
drwxrwxr-x 2 bubo bubo 4096 août 6 15:59 compiled
drwxrwxr-x 3 bubo bubo 4096 août 6 15:59 doc
-rw-r--r-- 1 bubo bubo 281 août 6 14:55 info.rkt
-rw-r--r-- 1 bubo bubo 6705 août 6 14:55 main.rkt
-rw-r--r-- 1 bubo bubo 676 août 6 14:55 Makefile
drwxr-xr-x 6 bubo bubo 4096 août 6 16:00 rtmidi-2.1.0
-rw-rw-r-- 1 bubo bubo 242064 mars 31 2014 rtmidi-2.1.0.tar.gz
-rw-r--r-- 1 bubo bubo 841 août 6 14:55 rtmidi-example.rkt
-rw-r--r-- 1 bubo bubo 2561 août 6 14:55 rtmidi.scrbl
-rw-r--r-- 1 bubo bubo 5110 août 6 14:55 <http://wrap-rtmidi.cc\|wrap-rtmidi.cc>
-rw-rw-r-- 1 bubo bubo 635928 août 6 16:00 wrap-rtmidi.o
-rwxrwxr-x 1 bubo bubo 907664 août 6 16:00 wrap-rtmidi.so
looks… correct
Would it be more precise if I post the [,bf context]
of the error?
@raphael.forment I’m giving it a try on my xubuntu 20.04 system here
We should more or less have the same config
I am on Racket 7.8 but I doubt that should make a difference.
Well I can reproduce at least
Are you getting the same error?
yes
The missing symbol looks like it might be in asound
or removed from it
Recent alsa update that broke the lib?
not sure
trying something
I think something isn’t linked correctly
Something about the Makefile?
yeah, like ldd wrap-rtmidi.so
should list libpthread and libasound
Ok
I think I fixed it
Wow
yep
It may be a gcc vs. clang issue
Change line 16 of the Makefile to: $(CXX) -fPIC -shared -o $@ $^ $(LDFLAGS)
Move $(LDFLAGS)
from the front to the end
then make clean
and make linux
Mmhhh, Racket is not complaining so far
I’ll try to run an example file
All right! My synth just received a MIDI note. I guess it’s fixed now!
Nice!
Thanks a lot!
I’m sending John a PR for the package so hopefully no one else needs to feel this pain :slightly_smiling_face:
Makefiles are pain generators most of the time
at least for what I’ve experienced so far
This one is simple handwritten. It’s the big portable ones that automated tools spit out that are real scary.
But I’ve only been doing this for 22 years so I may be a bit biased
Musicology led me to programming, so every time I deep dive into something like that, I still clearly hear that internal screaming
But I’m really eager to learn how to deal with that stuff
Thanks a lot!
NP
Why is symbol->keyword
not in the racket standard library? Is there another name for the function?
I too think it should be in the standard library. For now, (string->keyword (symbol->string s))
is the alternative.
Thank you! I understand that not everything can be put into the standard library; but it does seem to be an odd omission.
@jcmdln425 has joined the channel