This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dladdr and Dl_info


Vincent R. schrieb:
I am trying to compile llvm on latest cygwin and I get an error about
missing
definitions for Dl_info and dladdr.

const llvm::sys::Path&  CIndexer::getClangPath() {
   // Did we already compute the path?
   if (!ClangPath.empty())
     return ClangPath;

   // Find the location where this library lives (libCIndex.dylib).
#ifdef LLVM_ON_WIN32
   ...
#else
   // This silly cast below avoids a C++ warning.
   Dl_info info;
   if (dladdr((void *)(uintptr_t)clang_createTranslationUnit,&info) == 0)
     assert(0&&  "Call to dladdr() failed");

llvm::sys::Path CIndexPath(info.dli_fname);

   // We now have the CIndex directory, locate clang relative to it.
   CIndexPath.eraseComponent();
   CIndexPath.eraseComponent();
   CIndexPath.appendComponent("bin");
   CIndexPath.appendComponent("clang");
#endif

   // Cache our result.
   ClangPath = CIndexPath;
   return ClangPath;
}

I have a working cygwin llvm and llvm-gcc, but had no time to produce a proper package yet. Attached are my cygport files and my local config. No patches were needed.

But I haven't bothered to build clang yet,
just the Clang llvmc plugin and llvm-gcc,
which I thought is harder to build and gives us more gcc compatibility.

> Could it be possible to provide an implementation ?

cygwin has only dlsym() not the SGI DL_info + dladdr() yet.
clang just needs it to get the path for the CIndex dll.
This should be possible with the code in the LLVM_ON_WIN32 section,
and convert then the path from win to posix with cygwin_conv_path().
--
Reini Urban
http://phpwiki.org/  http://murbreak.at/

Attachment: llvm-2.5-1.cygport
Description: Text document

Attachment: llvm-gcc4.2-2.5-1.cygport
Description: Text document

Attachment: vmkit-0.25-1.cygport
Description: Text document

Attachment: Makefile.config
Description: Text document

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]