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

_rt_loadLibrary symbol not found #3331

Closed
jda-iocom opened this issue Feb 19, 2020 · 5 comments
Closed

_rt_loadLibrary symbol not found #3331

jda-iocom opened this issue Feb 19, 2020 · 5 comments

Comments

@jda-iocom
Copy link

I'm trying to compile a small test program:

module MacOS.tf;

import std.stdio;
import core.runtime;

void main() {
  void* vhandle = Runtime.loadLibrary("igvideo");
}

on Mac OSX Catalina, and I am getting the following error:

(ldc-1.20.0) ldc2 tf.d
Undefined symbols for architecture x86_64:
  "_rt_loadLibrary", referenced from:
      __D4core7runtime7Runtime__T11loadLibraryZQoFMxAaZPv in tf.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: /usr/bin/cc failed with status: 1
@dnadlinger
Copy link
Member

Are you linking against the shared version of druntime?

@jda-iocom
Copy link
Author

No idea! That's all I'm typing in - ldc2 tf.d

@kinke
Copy link
Member

kinke commented Feb 20, 2020

Then try with -link-defaultlib-shared.

@jda-iocom
Copy link
Author

Nice! That fixed it. Should I leave this bug opened though?

@kinke
Copy link
Member

kinke commented Feb 20, 2020

There's an upstream issue wrt. this. It doesn't apply to LDC, as we use the same proper shared-libs mechanism for Mac as on Linux.

According to the comment for Runtime.loadLibrary(), I wouldn't assume that the function is only available in the shared libs though (on Linux too), and especially wouldn't expect an ugly linker error when using static druntime. So that might be worth another issue, upstream though as not really LDC-specific.

@kinke kinke closed this as completed Feb 20, 2020
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