Page MenuHomePhabricator

Avoid linking libdl unless needed

Authored by thieta on May 24 2020, 9:43 AM.



This fixes cross-compilation when targeting a platform not using libdl and mirrors libdl linking in other parts of the code.

Diff Detail

Event Timeline

thieta created this revision.May 24 2020, 9:43 AM
mstorsjo added a subscriber: beanz.

I think this is ok, but adding @beanz who knows the cmake conventions better than me.

beanz accepted this revision.May 27 2020, 8:55 AM

looks reasonable

This revision is now accepted and ready to land.May 27 2020, 8:55 AM

@mstorsjo mind landing this for me as well?

This revision was automatically updated to reflect the committed changes.

FYI as reported on IRC, this likely breaks standalone build of clang

<mceier> standalone builds of clang are still supported right ? commit 0073c293a401774ac96b4b3d27f05e13f379f98e seems to break them, since HAVE_LIBDL is not defined (it requires config-ix include from llvm) causing linking to fail with undefined reference to dladdr due to missing -ldl
<LebedevRI> assuming the versions match, sounds like a bug
<mceier> LebedevRI: by adding "-DHAVE_LIBDL -DCMAKE_DL_LIBS=dl" to cmake I was able to build standalone clang; so it is a bug

Would be good to either have a fix or a revert.

thieta added a comment.Jun 3 2020, 9:02 PM

Thanks - I'll look into a fix.