Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Link to libdl on non-BSD POSIX systems. #941

Closed
wants to merge 2 commits into from

6 participants

@complexmath

The alternative would be to put this linker command in dmd.conf for Linux and OSX.

@alexrp

It wouldn't work (I did try that). This has to be passed here or linking will fail (which is the reason those other libraries (libm, libpthread, librt, etc) are also added to the command line in the function I modified).

@MartinNowak MartinNowak commented on the diff
src/link.c
@@ -384,6 +384,12 @@ int runLINK()
// argv.push((void *)"-ldruntime");
argv.push((char *)"-lpthread");
argv.push((char *)"-lm");
+
+#if !__FreeBSD__ && !__OpenBSD__
@MartinNowak Collaborator

Please make it a positive list
#if linux || __sun&&__SVR4.

@alexrp
alexrp added a note

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@MartinNowak
Collaborator

This is indeed needed when libdl functions are used from druntime/phobos.
So I think we should merge it when the issue is fixed.

@alexrp

I'm closing this for now, since it won't be relevant until we have a proper shared runtime.

@alexrp alexrp closed this
@MartinNowak
Collaborator

I think we should merge it now. It's a correct change even though the issue only arises with the unfinished Runtime.loadLibrary.

@alexrp

Somewhat delayed, but reopening this in case we do want to merge it.

@alexrp alexrp reopened this
@alexrp

Poking this to make the auto tester run it on OS X machines.

@andralex
Owner

ping on this?

@alexrp

Up to @dawgfoto if we merge this now or later, I guess.

@llucax

I think it would be best to fix this issue in a more general way (as being discussed in #497) instead of adding more hardcoded linker options in the compiler sources.

@alexrp alexrp closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 19, 2012
  1. @braddr

    Merge pull request #1088 from 9rnsr/test_diagnostic_bugs

    braddr authored
    Add feature for testing diagnostic bugs
  2. @alexrp

    Link to libdl on non-BSD POSIX systems.

    alexrp authored alexrp committed
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/link.c
View
6 src/link.c
@@ -385,6 +385,12 @@ int runLINK()
// argv.push((void *)"-ldruntime");
argv.push((char *)"-lpthread");
argv.push((char *)"-lm");
+
+#if !__FreeBSD__ && !__OpenBSD__
@MartinNowak Collaborator

Please make it a positive list
#if linux || __sun&&__SVR4.

@alexrp
alexrp added a note

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ // BSDs includes dlopen and friends in their libc.
+ argv.push((char *)"-ldl");
+#endif
+
#if linux && DMDV2
// Changes in ld for Ubuntu 11.10 require this to appear after phobos2
argv.push((char *)"-lrt");
Something went wrong with that request. Please try again.