Problems with iterator.h

Just finished the compiling llvm without llvm-gcc from svn.

Tried it out. Got

g++ -o hlvm.o -c -I/farhome/hendrik/dv/llvm/llvm/include -D_DEBUG -D_GNU_SOURCE
-D__STDC_LIMIT_MACROS -g -Woverloaded-virtual hlvm.cpp
In file included from /farhome/hendrik/dv/llvm/llvm/include/llvm/DerivedTypes.h:
21,
                 from hlvm.cpp:1:
/farhome/hendrik/dv/llvm/llvm/include/llvm/Type.h:19:31: error: llvm/ADT/iterato
r.h: No such file or directory

and other similar messages.

Looked in /farhome/hendrik/dv/llvm/llvm/include/llvm/ADT
and found two relevant-looking files:

  -rw-r--r-- 1 hendrik sbox 1328 2008-06-03 10:00 iterator
  -rw-r--r-- 1 hendrik sbox 2418 2008-06-03 10:00 iterator.h.in

(a) What should I do now?

(b) Is this a bug in the Makefiles? It looks as if something should have
    built iterator.h from iterator.h.in, but nothing did.

-- hendrik

I found it! In the OBJ-ROOT.
hendrik@lovesong:~/dv/llvm/obj$ ls ~/dv/llvm/obj/include/llvm/ADT
hash_map.h hash_set.h iterator.h
hendrik@lovesong:~/dv/llvm/obj$

I obtained the options from llvm-config --cxxflags. So the problem
seems to be that llvm-config didn't know about the include files in
the object root.

-- hendrik

Hi Hendrik,

  -rw-r--r-- 1 hendrik sbox 1328 2008-06-03 10:00 iterator
  -rw-r--r-- 1 hendrik sbox 2418 2008-06-03 10:00 iterator.h.in

Did you run AutoGen.sh (not sure about case). I think that's needed when
compiling from svn, and it should generate the makefiles for building
iterator.h. I think.

Gr.

Matthijs

I followed the instructions in
http://llvm.org/docs/GettingStarted.html#starting.

Since then I've found the include files under the object root.
Naturally, that's where generated files go. The problem is now that llvm-
config --cxxflags doesn't know about the include files under the object
root. Of course there's an easy workaround -- just specify an extra
include directory on my g++ line, but it should probably get fixed in the
SVN sources.

-- hendrik

Hi Hendrik,

-rw-r–r-- 1 hendrik sbox 1328 2008-06-03 10:00 iterator -rw-r–r–
1 hendrik sbox 2418 2008-06-03 10:00 iterator.h.in
Did you run AutoGen.sh (not sure about case). I think that’s needed when
compiling from svn, and it should generate the makefiles for building
iterator.h. I think.

I followed the instructions in
http://llvm.org/docs/GettingStarted.html#starting.

Since then I’ve found the include files under the object root.
Naturally, that’s where generated files go. The problem is now that llvm-
config --cxxflags doesn’t know about the include files under the object
root. Of course there’s an easy workaround – just specify an extra
include directory on my g++ line, but it should probably get fixed in the
SVN sources.

There is another way to resolve this, run make install, and then use the installed llvm-config, which will include a single directory containing both generated and regular header files. If that part doesn’t work, please respond or open a PR. I’ll be happy to prod llvm-config until it works correctly. However, I’m not sure trying to support all the bizarre ways ./configure and Make can build the generated files within llvm-config is a worthwhile investment of time.

-Chandler

I checked my installation diary (yes, I did make one) and indeed I did not
perform a make install. Xhwxking back, I was not instructed to in the
installation instructions in http://llvm.org/docs/GettingStarted.html.
"install" is mentioned as a useful make target.

Perhaps "gmake install" should be promoted to an actual installation step
in the instructions. That might be the simplest fix for the problem.

-- hendrik

There is another way to resolve this, run make install, and then use
the installed llvm-config, which will include a single directory
containing both generated and regular header files. If *that* part
doesn't work, please respond or open a PR. I'll be happy to prod
llvm-config until it works correctly. However, I'm not sure trying to
support all the bizarre ways ./configure and Make can build the
generated files within llvm-config is a worthwhile investment of time.

-Chandler

I checked my installation diary (yes, I did make one) and indeed I did
not perform a make install. Xhwxking back, I was not instructed to in
the installation instructions in
http://llvm.org/docs/GettingStarted.html. "install" is mentioned as a
useful make target.

Perhaps "gmake install" should be promoted to an actual installation
step in the instructions. That might be the simplest fix for the
problem.

Updated source from svn, rebuilt, and this time did
  make install
and llvm-config now seems to behave itself. It would definitely be good
to place make install in the getting started documentation.as a separate
installation step, after gmake -j2 and before the discussion of other
possible make targets. Yes, gmake install is mentioned in that
discussion, but not as an installation step. It would have helped
keeping me from going astray.

Incidentally, in the section "Local LLVM Configuration" you should
explicitly mention the "--prefix" option. Yes, I know it's mentioned in
the |Getting Started Quickly" section, but the whole thing ends up being
a bit like the two creation stories at the beginning of Genesis --
they're not the same. The naive reader will likely be following the more
detailed of the sets of instructions, and miss the option entirely.

-- hendrik