Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Racket requires a nonexistent library version, causing macOS crashes #3279

Closed
dustypomerleau opened this issue Jun 30, 2020 · 4 comments
Closed

Comments

@dustypomerleau
Copy link

I had originally posted this issue on Magic Racket as Eugleo/magic-racket#19, but I've come to realize that the issue is with Racket itself.

The initial issue was a crash after attempting to launch the language server, due to a missing libintl.9.dylib library:

Setup:
macOS 10.15.5
VS Code 1.46.1
Racket 7.7 installed via asdf
Magic Racket 0.5.6

Output after language server fails:

[Info  - 3:15:36 PM] Connection to server got closed. Server will restart.
ffi-lib: couldn't open "libintl.9.dylib" (dlopen(libintl.9.dylib, 6): image not found)
  context...:
   /Users/dustinpomerleau/.asdf/installs/racket/7.7/collects/ffi/unsafe.rkt:131:0: get-ffi-lib
   "/Users/dustinpomerleau/.asdf/installs/racket/7.7/share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt": [running body]
   temp35_0
   for-loop
   run-module-instance!
...

On macOS, libintl is not preinstalled, and is usually added by installing gettext. However, brew install gettext installs libintl.8.dylib, and Racket 7.7 appears to mandate libintl.9. When I discovered this, I wasn't sure how to proceed, as I'm on the latest version of gettext, and I didn't see any way of installing libintl.9.dylib as a standalone library.

So I continued to dig, and found this comment on a conda issue:

The crux of all of these libintl.9.dylib-on-macOS problems dates back to early this year when the GNU gettext project distributed a broken source release which built a shared library called libintl.9.dylib when it should have been libintl.8.dylib. Rather than just saying "oops, it's too late now" they made the (IMHO unfortunate) decision to undo that change in a patch release.

During that broken window (before I was aware it was broken) I rebuilt all of our R packages on all platforms against the latest version of R at the time.

Then, for the AD 5 release we rebuilt everything based on the latest versions available at the time (very recently) so we are back to providing libintl.8.dylib instead. These new R packages on rdonnellyr are part of this mass-rebuild.

So it appears that libintl.8 is really the latest version, and Racket is caught up in the same situation, requiring libintl.9 when no such library exists. Is this as simple as changing the listed dependency? I'm happy to submit a PR if that's the case.

@dustypomerleau dustypomerleau changed the title Racket requires a nonexistant library version, causing macOS crashes Racket requires a nonexistent library version, causing macOS crashes Jun 30, 2020
@shhyou
Copy link
Collaborator

shhyou commented Jul 2, 2020

Racket's MacOS distribution (here) comes with libintl.9.dylib. Does it work?

/Volumes/Racket v7.7/Racket v7.7$ find . -iname '*libintl*'
./lib/libintl.9.dylib
/Volumes/Racket v7.7/Racket v7.7$

@dustypomerleau
Copy link
Author

Thanks for your reply @shhyou, and apologies for the delay on my end. I have determined that the issue is related to asdf. I am still not sure exactly where the offending code is, but essentially Magic Racket must be looking for a path to the libraries that is determined before my shell launches (and therefore before asdf.sh runs. Once that path is set, asdf inserts its shims during shell startup, and then Magic Racket can no longer 'see' the libraries. For the moment I have reverted to using Homebrew Racket.

@shhyou
Copy link
Collaborator

shhyou commented Jul 6, 2020

This documentation details how Racket looks for dynamic libraries, and this function computes the library search path for the installed Racket. I am not sure about the entire process, but a guess is that build-time configuration determines how Racket searches for libintl in the draw-lib.

@dqisme
Copy link

dqisme commented Apr 26, 2021

For the people who have the same issue here:

Please run the updating commands below AFTER installing by asdf. I tried them, and they can resolve this problem perfectly.

raco pkg update --auto racket-lib
raco pkg update --auto main-distribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants