Why am I getting an encoding error when requiring a shared object compiled from Rust on 32-bit Linux?

Viewed 97

Background: I am using Helix to write a native extension for Ruby, written in Rust. On my 64bit MacBook Pro, everything works fine, I am experiencing this problem on a 32bit Linux machine (i686-unknown-linux-gnu). The problem occurs regardless of the code in the Rust source.

The shared object compiles fine, but if I try to require it, I invariably get an error like the following:

`require': invalid symbol in encoding US-ASCII :"(}\xC3\xBFtO\xEE\xB7\xE0\xEBi\x01\xAC|\xC3\xBF\x18.\x8D\xB5\xC6\xC0\x89\xB5\xFD\xF1\x8B\xB5\x80\x8B\x91\x01\x18.\x8D\xB5\xB7\xC0\x89\xB5\xE0|\xC3\xBF\xFA\x8Ck" (EncodingError)

On different invocations of Ruby, when I require the file, the binary string in the error message is different, which further perplexes me.

Steps to reproduce (required: Helix, Rust, Ruby, Bundler):

Note: I am using

  • Helix 0.7.5
  • cargo 1.30.0 (a1a4ad372 2018-11-02)
  • rustc 1.30.1 (1433507eb 2018-11-07)
  • ruby 2.6.0p0 (2018-12-25 revision 66547) [i686-linux]
  • Bundler version 1.17.2

But the same problem exists with the recommended versions from the Helix README, albeit compiled for 32 bit rather than 64 bit

  • Helix 0.7.5
  • cargo 0.18.0 (fe7b0cdcf 2017-04-24)
  • rustc 1.17.0 (56124baa9 2017-04-24)
  • ruby 2.4.1p111 (2017-03-22 revision 58053) [i686-linux]
  • Bundler version 1.14.6
mkdir repro
cd repro/
bundle init
echo 'gem "helix-rails"' > Gemfile
bundle
helix bootstrap example
cd example
bundle exec rake build
bundle exec ruby lib/example.rb

I've also opened issue 163 on the tildeio/helix repo.

0 Answers
Related