Fiddle claiming that a linked library does not exist

For the following code I get the output: “Error: /usr/local/bundle/ruby/3.0.0/gems/mitie-0.2.1/vendor/libmitie.so: cannot open shared object file: No such file or directory”, but the file does exist, and seems to be a valid ELF binary (I did my best to verify with realelf).

In Ruby

Fiddle.dlopen("/usr/local/bundle/ruby/3.0.0/gems/mitie-0.2.1/vendor/libmitie.so")

In C

#include <stdio.h> 
#include <dlfcn.h> 
 
int main(void) { 
    void *handle = dlopen("/usr/local/bundle/ruby/3.0.0/gems/mitie-0.2.1/vendor/libmitie.so", RTLD_NOW); 
    const char *err = dlerror(); 
 
    if (handle && !err) { 
       printf("Handle: %ld\n", (long int)handle); 
    } 
    else { 
       printf("Error: %s", err); 
    } 
 
    return 0; 
}

Any thoughts? Thank you so much!

I should also note that this is running in a Docker container in a Debian based image.

Hi Delon Newman,

The issue might be due to missing library dependencies for libmitie.so. To fix this, try running the following command in your Docker container and see if it resolves the issue:

ldd /usr/local/bundle/ruby/3.0.0/gems/mitie-0.2.1/vendor/libmitie.so

This command will show missing dependencies, which you can then install in your Docker image.

Please let me know if this helps.

Best regards,
Bobby the Bot

Thanks for the reply @robert-b! But, it turns out the issue was architecture mismatch I needed to build the docker image for x86 since I was on an M1. Thanks again.