building ldc with libs in usr/local

4 views
Skip to first unread message

k...@birchtreefarm.com

unread,
Apr 19, 2009, 4:42:00 PM4/19/09
to LDC - the LLVM D compiler
I am attempting to build ldc, but would like to keep the manually
built libraries under /usr/local.

I have followed the instructions as-is, with the exception that I did
not specify the prefix in this step:

"libconfig
* from source: use 'configure --prefix=/usr' to configure libconfig,
otherwise you will get the error 'can't find libconfig++.so.8' from
ldc"

I run ccmake, followed by make. All is well until I reach the link
portion of the make of ldc, when I get:

Linking CXX executable bin/ldc
CMakeFiles/ldc.dir/gen/configfile.cpp.o: In function
`ConfigFile::ConfigFile()':configfile.cpp:(.text+0x12a): undefined
reference to `libconfig::Config::Config()'

I've read a lot about cmake and have tried various things to point the
linker at the libraries in /usr/local/lib, but have been unsuccessful
so far. It seems that cmake can find any libraries that it has
created, but when they are created elsewhere, as is the case with
libconfig++, it is much harder.

I can't believe how hard it is to specify a library path for this. I
tried using /usr as the prefix for everything built (in a virtual
machine) and everything went fine. Can anyone help?
Thanks.

Christian Kamm

unread,
Apr 21, 2009, 2:27:34 PM4/21/09
to ldc...@googlegroups.com
On Sunday 19 April 2009 22:42 k...@birchtreefarm.com wrote:
> I am attempting to build ldc, but would like to keep the manually
> built libraries under /usr/local.
> ...

> I've read a lot about cmake and have tried various things to point the
> linker at the libraries in /usr/local/lib, but have been unsuccessful
> so far. It seems that cmake can find any libraries that it has
> created, but when they are created elsewhere, as is the case with
> libconfig++, it is much harder.
>
> I can't believe how hard it is to specify a library path for this. I
> tried using /usr as the prefix for everything built (in a virtual
> machine) and everything went fine. Can anyone help?

CMake uses pkg-config for finding the right libconfig++ flags, so if you can
get it to pick up your linker directory, you should be all set.

Alternatively, I think you can put linker options directly into the
target_link_libraries call.

I hope that helps,
Christian

signature.asc

Tomas Lindquist Olsen

unread,
Apr 21, 2009, 6:16:33 PM4/21/09
to ldc...@googlegroups.com

Setting the LIBCONFIG_LDFLAGS cmake variable as:

LIBCONFIG_LDFLAGS="-L/usr/local/lib -lconfig++" should do it.

-Tomas

k...@birchtreefarm.com

unread,
Apr 21, 2009, 6:59:24 PM4/21/09
to LDC - the LLVM D compiler
> On Tue, Apr 21, 2009 at 8:27 PM, Christian Kamm <k...@incasoftware.de> wrote:
> Setting the LIBCONFIG_LDFLAGS cmake variable as:
>
> LIBCONFIG_LDFLAGS="-L/usr/local/lib -lconfig++" should do it.
>
> -Tomas

That worked! I had gotten close to that, but I had incorrrectly
specified, "-llibconfig -L/usr/local/lib".

I'm curious about the "-l" option. Why is it "config++" and not
"libconfig++"? From a literal take of the ld man page, it seems that
"config++" is the name of the object file that is bundled in the
library. Yet, that file doesn't exist in the directory where I built
libconfig.

In case in helps others, I'll mention that the LIBCONFIG_LDFLAGS
setting is found by running ccmake and pressing "t" for advanced
options.

Thank you both for your help, it is very much appreciated.
-Ken

Tomas Lindquist Olsen

unread,
Apr 21, 2009, 7:14:55 PM4/21/09
to ldc...@googlegroups.com
On Wed, Apr 22, 2009 at 12:59 AM, <k...@birchtreefarm.com> wrote:
>
>> On Tue, Apr 21, 2009 at 8:27 PM, Christian Kamm <k...@incasoftware.de> wrote:
>> Setting the LIBCONFIG_LDFLAGS cmake variable as:
>>
>> LIBCONFIG_LDFLAGS="-L/usr/local/lib -lconfig++" should do it.
>>
>> -Tomas
>
> That worked!  I had gotten close to that, but I had incorrrectly
> specified, "-llibconfig -L/usr/local/lib".
>
> I'm curious about the "-l" option.  Why is it "config++" and not
> "libconfig++"?  From a literal take of the ld man page, it seems that
> "config++" is the name of the object file that is bundled in the
> library.  Yet, that file doesn't exist in the directory where I built
> libconfig.

the -l switch take the name of the library, without the 'lib' prefix
or file extension. so to link libconfig++.so you specify -lconfig++
Hope that helps.

>
> In case in helps others, I'll mention that the LIBCONFIG_LDFLAGS
> setting is found by running ccmake and pressing "t" for advanced
> options.

Hmm. to me 't' is not required to see it . odd.

>
> Thank you both for your help, it is very much appreciated.
> -Ken
>

You're welcome.

k...@birchtreefarm.com

unread,
Apr 21, 2009, 9:45:17 PM4/21/09
to LDC - the LLVM D compiler
> > In case in helps others, I'll mention that the LIBCONFIG_LDFLAGS
> > setting is found by running ccmake and pressing "t" for advanced
> > options.
>
> Hmm. to me 't' is not required to see it . odd.
You're right, I didn't find it at first and so went to searching in
'advanced'.
-Ken
Reply all
Reply to author
Forward
0 new messages