llvm-config --libs failed

Hi!
I’m trying to use the LLVMProject toolchain (according to this page: http://llvm.org/docs/Projects.html).
I created a project “test” with kaleidoscope example source code from: http://llvm.org/docs/tutorial/LangImpl3.html
It compiles successfully with: clang++ -g -O3 toy.cpp llvm-config --cppflags --ldflags --libs core -o toy

according to the project documentation, my Makefile inside the source of the project contains (it is in llvm/src/projects/test/tools/test/Makefile):

LEVEL=…/…
TOOLNAME=luna
LINK_COMPONENTS = all
include $(LEVEL)/Makefile.common

And while executing make in build directory I get error:

/home/[…]/dev/llvm/src/projects/test/build/…/Makefile.llvm.rules:963: *** llvm-config --libs failed. Stop.

[…] - I deleted this part

What is interesting, if I run llvm-config --libs in termial, I get:
-lLLVMAsmParser -lLLVMInstrumentation -lLLVMLinker -lLLVMArchive […] -lLLVMSupport (and a lot more)

What should I do to fix this issue?
Thank you!

Wojciech Daniło <wojtek.danilo.ml@gmail.com> writes:

Hi!
I'm trying to use the LLVMProject toolchain (according to this page:
http://llvm.org/docs/Projects.html).
I created a project "test" with kaleidoscope example source code from:
http://llvm.org/docs/tutorial/LangImpl3.html
It compiles successfully with: clang++ -g -O3 toy.cpp `llvm-config
--cppflags --ldflags --libs core` -o toy

according to the project documentation, my Makefile inside the source of
the project contains (it is in llvm/src/projects/test/tools/test/Makefile):

LEVEL=../..
TOOLNAME=luna
LINK_COMPONENTS = all
include $(LEVEL)/Makefile.common

And while executing make in build directory I get error:
/home/[...]/dev/llvm/src/projects/test/build/../Makefile.llvm.rules:963:
*** llvm-config --libs failed. Stop.

[...] - I deleted this part

What is interesting, if I run llvm-config --libs in termial, I get:
-lLLVMAsmParser -lLLVMInstrumentation -lLLVMLinker -lLLVMArchive [...]
-lLLVMSupport (and a lot more)

What should I do to fix this issue?

First of all, execute make like this:

make VERBOSE=1

to see the actual command that is being executed. Doing that will show
what's wrong with the command. If you can't figure out the problem,
post to this thread with the output of make VERBOSE=1

Thank you, now it is more clear whats going on. There is a line:
/bin/sh: /home/wdanilo/dev/llvm/src/projects/Debug+Asserts/bin/llvm-config: No such file or directory

but why it is searching for it in that directory? (all makefile configs, are default configs)
Below, there is full output of make:

make VERBOSE=1
for dir in lib tools; do
if ([ ! -f $dir/Makefile ] ||
command test $dir/Makefile -ot /home/username/dev/llvm/src/projects/test/$dir/Makefile ); then
/home/username/dev/llvm/src/projects/test/build/…/autoconf/mkinstalldirs $dir;
/usr/bin/cp /home/username/dev/llvm/src/projects/test/$dir/Makefile $dir/Makefile;
fi;
(make -C $dir all ) || exit 1;
done
make[1]: Entering directory /home/username/dev/llvm/src/projects/test/build/lib' for dir in sample; do \ if ([ ! -f $dir/Makefile ] || \ command test $dir/Makefile -ot /home/username/dev/llvm/src/projects/test/lib/$dir/Makefile ); then \ /home/username/dev/llvm/src/projects/test/build/../autoconf/mkinstalldirs $dir; \ /usr/bin/cp /home/username/dev/llvm/src/projects/test/lib/$dir/Makefile $dir/Makefile; \ fi; \ (make -C $dir all ) || exit 1; \ done make[2]: Entering directory /home/username/dev/llvm/src/projects/test/build/lib/sample’
make[2]: Nothing to be done for all'. make[2]: Leaving directory /home/username/dev/llvm/src/projects/test/build/lib/sample’
make[1]: Leaving directory /home/username/dev/llvm/src/projects/test/build/lib' make[1]: Entering directory /home/username/dev/llvm/src/projects/test/build/tools’
for dir in luna; do
if ([ ! -f $dir/Makefile ] ||
command test $dir/Makefile -ot /home/username/dev/llvm/src/projects/test/tools/$dir/Makefile ); then
/home/username/dev/llvm/src/projects/test/build/…/autoconf/mkinstalldirs $dir;
/usr/bin/cp /home/username/dev/llvm/src/projects/test/tools/$dir/Makefile $dir/Makefile;
fi;
(make -C $dir all ) || exit 1;
done
/bin/sh: /home/username/dev/llvm/src/projects/Debug+Asserts/bin/llvm-config: No such file or directory
make[2]: Entering directory /home/username/dev/llvm/src/projects/test/build/tools/luna' /home/username/dev/llvm/src/projects/test/build/../Makefile.llvm.rules:963: *** llvm-config --libs failed. Stop. make[2]: Leaving directory /home/username/dev/llvm/src/projects/test/build/tools/luna’
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/username/dev/llvm/src/projects/test/build/tools’
make: *** [all] Error 1

2012/11/8 Óscar Fuentes <ofv@wanadoo.es>

Does anybody have Idea why I get such error? The LLVM is compiled from source - is is the newest version (3.1) from http://llvm.org/releases/ (from 22 may 2012)
I created project in llvmsrc/projects/test (as copy of sample project) and I get these errors while attaching LLVM lbraries :frowning:

2012/11/8 Wojciech Daniło <wojtek.danilo.ml@gmail.com>

I have noticed that I was installing LLVM according to: http://llvm.org/docs/GettingStarted.html#getting-started
so it was no the 3.1 but the 3.2 version from svn (trunk 167573).
Maybe in the svn, not stable version, there is a bug?

2012/11/9 Wojciech Daniło <wojtek.danilo.ml@gmail.com>

If anyone is interested in this topic, I filled a bug here: http://llvm.org/bugs/post_bug.cgi

2012/11/9 Wojciech Daniło <wojtek.danilo.ml@gmail.com>

I’m sorry, the correct link is: http://llvm.org/bugs/show_bug.cgi?id=14313

2012/11/10 Wojciech Daniło <wojtek.danilo.ml@gmail.com>