[LLVMdev] Problems loading passes on Mac OS X

Chris Lattner sabre at nondot.org
Sat Jun 19 15:57:02 PDT 2004


On Sat, 19 Jun 2004, Michael McCracken wrote:

> Hi, I can't get opt to list (in -help) passes that I load using -load.
> I see in the list archives that a similar problem has been brought up
> before but I didn't see whether it was resolved. Also, this is on Mac
> OS X, and the previous question was about Linux.

The problem is that this has not been implemented yet on Mac OSX.  If
you're familiar with the OS/X interfaces for loading .so files, it should
be pretty easy.  Take a look at lib/Support/DynamicLinker.cpp.  I think
that OS/X doesn't have windows.h :), and it also doesn't have dlopen.  If
you can provide the necessary magic for your platform, it should just
work.

-Chris




> This problem happens with the Hello pass, so I'll use that to
> illustrate. I'm using LLVM 1.2.
> The plugin loads with no complaints, so dlopen() is returning success,
> and OS X's dlcompat probably isn't the problem.
> However, it never gets registered. I've included a transcript below.
>
> I also included some info about the compiler versions, etc. - It's OS X
> 10.3.4.
> Note that on OS X, 'libtool' isn't gnu libtool - that's called
> 'glibtool', if that matters.
>
> Does anyone have some hints on how to get this working? Thanks.
>
> transcript:
>
> % cd llvm/lib/Transforms/Hello/
> % make
> Compiling Hello.cpp
> Linking hello dynamic debug library
> ----------------------------------------------------------------------
> Libraries have been installed in:
>     /Users/mike/Documents/hpcl/LLVM/llvm/lib/Debug
>
> If you ever happen to want to link against installed libraries
> in a given directory, LIBDIR, you must either use libtool, and
> specify the full pathname of the library, or use the `-LLIBDIR'
> flag during linking and do at least one of the following:
>     - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
>       during execution
>
> See any operating system documentation about shared libraries for
> more information, such as the ld(1) and ld.so(8) manual pages.
> ----------------------------------------------------------------------
> ======= Finished building hello dynamic debug library =======
> Linking hello.o
>
> % opt -load ../../Debug/libhello.dylib -hello
> Unknown command line argument '-hello'.  Try: 'opt --help'
>
> % g++ -v
> Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs
> Thread model: posix
> gcc version 3.3 20030304 (Apple Computer, Inc. build 1495)
>
> % glibtool --version
> ltmain.sh (GNU libtool) 1.5 (1.1220 2003/04/05 19:32:58)
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list