raphael.forment
2020-8-6 13:45:53

@raphael.forment has joined the channel


raphael.forment
2020-8-6 13:47:22

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] >


raphael.forment
2020-8-6 13:47:48

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?


soegaard2
2020-8-6 13:49:24

@raphael.forment Did you get the tar.gz file and extract that?



raphael.forment
2020-8-6 13:49:52

Yes. I extracted the tar.gz at the right location and runned make linux as instructed


raphael.forment
2020-8-6 13:50:22

Oh, btw, I’m running the latest Pop OS distro


soegaard2
2020-8-6 13:50:50

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.


raphael.forment
2020-8-6 13:51:51

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>


soegaard2
2020-8-6 13:52:40

Hmm.


raphael.forment
2020-8-6 13:52:50

The compiled shared library is definitely there. Could it be an issue related to the ffi?


soegaard2
2020-8-6 13:53:28

What does ls /home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so say?


raphael.forment
2020-8-6 13:53:56

/home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so


raphael.forment
2020-8-6 13:54:01

It’s just returning the same location


soegaard2
2020-8-6 13:54:49

It looks correct to me. I am macOS, so I hope there is a Linux user around that can help.


soegaard2
2020-8-6 13:55:57

Or … perhaps wrap-rtmidi.so relies on some other (missing) .so file?


raphael.forment
2020-8-6 13:56:35

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]


soegaard2
2020-8-6 13:57:21

The docs says, that you need to instal RtMidi first - then download and make the wrapper.


soegaard2
2020-8-6 13:58:08

So the wrapper looks to be in place. Did you install RtMidi first - and if so, is there a way to check it works?


raphael.forment
2020-8-6 13:58:50

Ok, I just installed the general rtmidi lib from the main repo, I’ll try to run the install again


soegaard2
2020-8-6 13:59:22

What main repo?


raphael.forment
2020-8-6 13:59:32

Ubuntu repository


soegaard2
2020-8-6 13:59:43

That’s what I would have done too.


raphael.forment
2020-8-6 13:59:48

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)


soegaard2
2020-8-6 14:00:05

@jbclements Thoughts?


raphael.forment
2020-8-6 14:01:43

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!


soegaard2
2020-8-6 14:08:53

The command ldd can show the dependencies of a shared library:

ldd /home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so


raphael.forment
2020-8-6 14:09:59

Should I install all the listed libraries? Some of them look pretty common. I guess they are already part of a base linux install


raphael.forment
2020-8-6 14:10:18

bubo@pop-os:~$ ldd /home/bubo/.racket/7.7/pkgs/rtmidi/rtmidi/wrap-rtmidi.so linux-vdso.so.1 (0x00007fff01bea000) libstdc++.so.6 =&gt; /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f41e1db0000) libgcc_s.so.1 =&gt; /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f41e1d95000) libc.so.6 =&gt; /lib/x86_64-linux-gnu/libc.so.6 (0x00007f41e1ba3000) libm.so.6 =&gt; /lib/x86_64-linux-gnu/libm.so.6 (0x00007f41e1a54000) /lib64/ld-linux-x86-64.so.2 (0x00007f41e1fce000)


soegaard2
2020-8-6 14:11:37

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).


raphael.forment
2020-8-6 14:12:24

I guess that the tar file to extract in the pkg folder is the whole rtmidi library


raphael.forment
2020-8-6 14:13:06

I just checked, it really looks like the main lib that you can get through the ubuntu repo


soegaard2
2020-8-6 14:13:18

If that’s the case John must have done that to ensure that the version of rtmidi and the bindings match.


raphael.forment
2020-8-6 14:13:59

Yes. It looks like the wrapper is building against a specific frozen version of rtmidi


soegaard2
2020-8-6 14:16:04

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.


raphael.forment
2020-8-6 14:17:28

It might just be better to wait for jbclements answer. Is he the package maintainer?


soegaard2
2020-8-6 14:17:47

Yes, he wrote it.


raphael.forment
2020-8-6 14:18:27

In the meantime, I wonder if there is some other alternatives to explore.


raphael.forment
2020-8-6 14:19:04

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.


raphael.forment
2020-8-6 14:19:13

Thanks for your help!


soegaard2
2020-8-6 14:19:58

John is definitely the person to ask, if you are interested in that sort of thing.


sorawee
2020-8-6 15:42:48

@raphael.forment could it be a permission issue?


sorawee
2020-8-6 15:42:53

Can you ls -l?


raphael.forment
2020-8-6 15:43:09

let me try


raphael.forment
2020-8-6 15:43:46

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


sorawee
2020-8-6 15:45:28

looks… correct


raphael.forment
2020-8-6 15:47:33

Would it be more precise if I post the [,bf context] of the error?


samdphillips
2020-8-6 17:40:04

@raphael.forment I’m giving it a try on my xubuntu 20.04 system here


raphael.forment
2020-8-6 17:41:24

We should more or less have the same config


samdphillips
2020-8-6 17:43:15

I am on Racket 7.8 but I doubt that should make a difference.


samdphillips
2020-8-6 17:45:33

Well I can reproduce at least


raphael.forment
2020-8-6 17:45:57

Are you getting the same error?


samdphillips
2020-8-6 17:46:17

yes


samdphillips
2020-8-6 17:46:47

The missing symbol looks like it might be in asound


samdphillips
2020-8-6 17:46:51

or removed from it


raphael.forment
2020-8-6 17:47:44

Recent alsa update that broke the lib?


samdphillips
2020-8-6 17:47:51

not sure


samdphillips
2020-8-6 17:47:58

trying something


samdphillips
2020-8-6 17:50:10

I think something isn’t linked correctly


raphael.forment
2020-8-6 17:51:44

Something about the Makefile?


samdphillips
2020-8-6 17:53:02

yeah, like ldd wrap-rtmidi.so should list libpthread and libasound


samdphillips
2020-8-6 17:54:03

Ok


samdphillips
2020-8-6 17:54:07

I think I fixed it


raphael.forment
2020-8-6 17:54:16

Wow


samdphillips
2020-8-6 17:54:36

yep


samdphillips
2020-8-6 17:54:45

It may be a gcc vs. clang issue


samdphillips
2020-8-6 17:55:20

Change line 16 of the Makefile to: $(CXX) -fPIC -shared -o $@ $^ $(LDFLAGS)


samdphillips
2020-8-6 17:55:33

Move $(LDFLAGS) from the front to the end


samdphillips
2020-8-6 17:55:46

then make clean and make linux


raphael.forment
2020-8-6 17:56:40

Mmhhh, Racket is not complaining so far


raphael.forment
2020-8-6 17:56:56

I’ll try to run an example file


raphael.forment
2020-8-6 17:57:54

All right! My synth just received a MIDI note. I guess it’s fixed now!


samdphillips
2020-8-6 17:58:01

Nice!


raphael.forment
2020-8-6 17:58:01

Thanks a lot!


samdphillips
2020-8-6 17:58:24

I’m sending John a PR for the package so hopefully no one else needs to feel this pain :slightly_smiling_face:


raphael.forment
2020-8-6 17:59:06

Makefiles are pain generators most of the time


raphael.forment
2020-8-6 17:59:19

at least for what I’ve experienced so far


samdphillips
2020-8-6 18:00:06

This one is simple handwritten. It’s the big portable ones that automated tools spit out that are real scary.


samdphillips
2020-8-6 18:00:30

But I’ve only been doing this for 22 years so I may be a bit biased


raphael.forment
2020-8-6 18:01:12

Musicology led me to programming, so every time I deep dive into something like that, I still clearly hear that internal screaming


raphael.forment
2020-8-6 18:01:28

But I’m really eager to learn how to deal with that stuff


samdphillips
2020-8-6 18:12:08

raphael.forment
2020-8-6 18:12:38

Thanks a lot!


samdphillips
2020-8-6 18:13:25

NP


yilin.wei10
2020-8-6 22:44:05

Why is symbol-&gt;keyword not in the racket standard library? Is there another name for the function?


notjack
2020-8-6 22:45:45

I too think it should be in the standard library. For now, (string-&gt;keyword (symbol-&gt;string s)) is the alternative.


yilin.wei10
2020-8-6 22:48:42

Thank you! I understand that not everything can be put into the standard library; but it does seem to be an odd omission.



jcmdln425
2020-8-7 03:18:10

@jcmdln425 has joined the channel