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

dlopen() a Linux library on FreeBSD fails #23408

Closed
ko56 opened this issue Aug 23, 2017 · 1 comment
Closed

dlopen() a Linux library on FreeBSD fails #23408

ko56 opened this issue Aug 23, 2017 · 1 comment

Comments

@ko56
Copy link

ko56 commented Aug 23, 2017

cc @iblis17
cc @ararslan"

The following C program works fine:

// needs export LD_LIBRARY_PATH=/compat/linux/usr/lib64 in order to work!
#include <dlfcn.h>
#include <stdio.h>
int main() {
  void *lib = dlopen("/compat/linux/usr/lib64/libc.so.6", RTLD_LAZY);
  char *e = dlerror();
  if (e) {
    printf("Crap! %s\n", e);
   }
  else {
    printf("Ok!\n");
  }
  dlclose(lib);
}

However, trying to do the same thing in Julia doesn't seem to work:

[ko@kzin ~]$ julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.0 (2017-06-19 13:05 UTC)
 _/ |\__'_|_|_|\__'_|  |  
|__/                   |  amd64-unknown-freebsd11.1

julia> ENV["LD_LIBRARY_PATH"] = "/compat/linux/usr/lib64";
julia> Libdl.dlopen("/compat/linux/usr/lib64/libc.so.6", Libdl.RTLD_LAZY)
ERROR: could not load library "/compat/linux/usr/lib64/libc.so.6"
Shared object "ld-linux-x86-64.so.2" not found, required by "libc.so.6"
Stacktrace:
 [1] dlopen at ./libdl.jl:97

julia> 
@yuyichao
Copy link
Contributor

LD_LIBRARY_PATH usually cannot be set after program start (I can't say for FreeBSD for sure though). Please comment for reopen if that doesn't fix it.

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

2 participants