[LLVMdev] llvm build not respecting DESTDIR?

Reid Spencer rspencer at reidspencer.com
Fri Dec 8 06:26:32 PST 2006

Hi Erick,

On Thu, 2006-12-07 at 23:31 -0800, Erick Tryzelaar wrote:
> Hello,
> I'm updating the macports build of llvm, and I'm running into an issue 
> trying to stage llvm into a temporary directory. It builds fine, but 
> when I try to install it into a temporary location, it insists on 
> installing into the final location.


>  The only reference I saw to the 
> standard gnu DESTDIR was in the llvm.spec file, but none of the 
> generated Makefiles have that value.

LLVM isn't strictly a GNU project. It has similarities, but this
obviously isn't one of them :)

>  Is there another way to do this? 


> Here's the commands I'm running:
>  > ./configure --prefix=/opt/local
>  > make ENABLED_OPTIMIZED=1 OPTIMIZE_OPTION='-O2' tools-only
>  > make install 
> DESTDIR=/opt/local/var/db/dports/build/_unencrypted_erickt_Projects_macports-trunk_dports_lang_llvm/work/destroot

DESTDIR isn't used by the makefiles so specifying a value for it isn't
going to accomplish what you want. The --prefix= configure option
controls where installation goes to.
> This is the output from make install. You can see that it's trying to 
> install into the final location, /opt/local:
> install: /opt/local/include/./llvm/Transforms/Utils/Local.h: No such 
> file or directory
> llvm[0]: Making install directory /opt/local/include/./llvm/Transforms/Utils
> mkdir: /opt/local/include/./llvm: Permission denied
> mkdir: /opt/local/include/./llvm: No such file or directory
> mkdir: /opt/local/include/./llvm/Transforms: No such file or directory
> ...

Yes, that's what I'd expect.

> I also tried "make install PREFIX=...", but that didn't work either. Are 
> there any suggestions on how to get this to work?

Yes, but its a bit verbose. The variables that control this are all
defined in the Makefile.config file. The variables are:

PROJ_prefix     := /proj/llvm/install-1
PROJ_bindir     := /proj/llvm/install-1/bin
PROJ_libdir     := /proj/llvm/install-1/lib
PROJ_datadir    := /proj/llvm/install-1/share
PROJ_docsdir    := /proj/llvm/install-1/docs/llvm
PROJ_etcdir     := /proj/llvm/install-1/etc/llvm
PROJ_includedir := /proj/llvm/install-1/include
PROJ_infodir    := /proj/llvm/install-1/info
PROJ_mandir     := /proj/llvm/install-1/man

The values are from my environment.  You can either override each of
these individually on the command line or replace their values in

> Also, some questions about llvm-gcc. If we're just installing the binary 
> version, does anything need to be done in order to let llvm find the 
> libraries, such as modifying the DLYD_LIBRARY_PATH, or are all the paths 
> relative? 

There aren't any shared libraries so the library path doesn't matter.
For llvm-gcc3, the path needs to be able to find gccas and gccld from
the LLVM build. For llvm-gcc4, everything is linked in statically so
after llvm-gcc4 is built, it doesn't matter where LLVM lives. 

> What about for the stuff compiled by llvm-gcc, does that need 
> paths to be set as well?

It shouldn't. llvm-gcc will pre-pend its library paths to the search
list. Wherever it installed the libraries it will search first.

> Finally, does llvm require llvm-gcc for it's runtime, as mentioned by 
> GettingStarted.html, or can it be used by itself? 

LLVM does not require llvm-gcc for its runtime. The runtime library is
only to support llvm-gcc3 and building it requires llvm-gcc3 to be
available. However, release 2.0 (current one we're working on) will drop
support for llvm-gcc3.  Its replacement, llvm-gcc4 will not require the
runtime library as it will use llvm-gcc's normal runtime (libgcc.a). 

LLVM can be used by itself but the only languages it can process are
LLVM assembly and Stacker. llvm-gcc4 just provides the C/C++/Obj-C/Obj-C
++ front end languages. Other front ends could be developed.

> If not, does it make 
> sense to package the two in the two packages? 
> Macports is a source-based 
> packaging system, so it would seem odd to have to temporarily install 
> llvm-gcc to build llvm, but then install llvm-gcc in a separate package.

That issue goes away with llvm-gcc4. You would simply build llvm and
then build llvm-gcc4. With llvm-gcc3, its a little more contorted:

1. build llvm tools only (don't build the runtime)
2. build llvm-gcc3
3. build the llvm runtime library

> Thanks for all your help!

You're welcome.

> -e
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list