[LLVMdev] Linking shared library

Mariusz Grad mariusz.grad at gmail.com
Thu Sep 16 07:08:56 PDT 2010


Hi,

I have conventional directory structure for a pass taken from project examples.
I want to build a tool which makes usage of a shared library which is included in the project.

This means that I have library here:
# lib/foo/*.cc
and after compilation the library is placed here 
# Debug/lib/libfoo.so

My tool is located here:
# tool/test_foo

# cat tool/Makefile
LEVEL = ../
TOOLNAME=test_foo
LIBS += -lfoo

When I build the tool:
# (cd tool && make)
llvm[0]: Compiling test_foo.cc for Debug build
llvm[0]: Linking Debug executable test_foo
... undefined reference ...
collect2: ld returned 1 exit status

Which means that the libfoo.so is not picked up from the Debug/lib directory.
In other words linker does not look into Debug/lib folder.

I can fix this with LDFLAGS but I believe the intention is different?

Greetings, Mariusz.
-- 
Mariusz Grad







More information about the llvm-dev mailing list