Boost logo

Boost-Build :

From: Felix E. Klee (felix.klee.jamboost_at_[hidden])
Date: 2003-01-23 08:45:43


On Thursday 23 January 2003 12:15, Vladimir Prus wrote:
> > Here is something that works:
> > bc++ -v -q -L$QTDIR/lib -ebin/kylix/debug/main-target-hello/hello
> > bin/kylix/debug/main-target-hello/main.o
> > bin/kylix/debug/main-target-hello/hello_world_widget.o
> > bin/kylix/debug/main-target-hello/moc_hello_world_widget.o
> > libqt.so
> >
> > As you see, I didn't use "-lqt" because that doesn't work. According to
> > the bc++ documentation, "-l" does something else:
>
> Eh... does that exactly "libqt.so"? Is that library searched in -L path? Or
> it should be present in "."?

It finds the library in the -L path. BTW, Here's the corresponding line from
Boost Build v1:
actions kylix-Link-action
{
export PATH=$(BCC_TOOL_PATH):$PATH
"$(BCC_TOOL_PATH)bc++" -v -q $(LINKFLAGS) -L"$(LIBPATH)"
-L"$(STDLIBPATH)" -o"$(<[1])" "$(>)" lib$(FINDLIBS).so
}

Here again, the comlete file name is specified. One big problem that comes
into my mind is that such a link action will fail when only a static version
of a library is available. But that just seems to be the Kylix way: when one
wants to add a library in the IDE one has to specify the complete path name.
There seems to be no way to specify just the library base name and let Kylix
do the rest.

I just did a little static library test that consists of
- A static libary ~/projects/kylix-lib-test/bar.a created in the IDE.
- A console application ~/projects/kylix-test/foo created in the IDE.

Results:
1. The linker command line generated by the IDE, of course, works:
ilink [...] -L[...]/net/hubble/Users/felix/projects/kylix-lib-test \
borinit.o crt1.o foo.o, foo,, ../kylix-lib-test/bar.a libborcrtl.a \
libborstl.a libborunwind.a libc.so libm.so libdl.so, , foo.res
Note that bar.a is specified with a path relative to the current directory.
2. Removing the relative path doesn't work:
ilink [...] -L[...]:/net/hubble/Users/felix/projects/kylix-lib-test \
borinit.o crt1.o foo.o, foo,, bar.a libborcrtl.a \
libborstl.a libborunwind.a libc.so libm.so libdl.so, , foo.res
=>
Fatal: Unable to open file 'bar.a'
Hm, that's unlike to what's printed in the documentation. It seems to be
another ilink bug or a Kylix documentation bug. Weirdly though, ilink finds
libborstl.a, etc..
3. Specifying bar.so instead of bar.a doesn't work either:
ilink [...] -L[...]:/net/hubble/Users/felix/projects/kylix-lib-test \
borinit.o crt1.o foo.o, foo,, bar.so libborcrtl.a \
libborstl.a libborunwind.a libc.so libm.so libdl.so, , foo.res
=>
Fatal: Unable to open file 'bar.so'
That's unlike the bavior of ld where a static lib is used instead of the
corresponding shared lib if that can't be found. But at least this seemsto
be consistent with the documentation where I couldn't find the mentioning
of such a feature.

BTW, you might have noticed that the library is called "foo.a", not
"libfoo.a". This seems to be common in Kylix, eg. static libraries mentioned
in the documentation often don't have the lib prefix. But just to make sure
that this is not the cause of all the trouble, I repeated the above tests
with libbar.a (a symlink to bar.a) and got the same results.

Conclusion:
1. Static libraries created by the user or third party libraries need to be
specified with their complete path.
2. Shared libraries only need to be specified with their complete name if -L
is properly set, specifying the entire path is not neccessary.

> In either case, I've made the changes to get both "-L" and "libqt-mt.so"
> into bc++ command line. Could you please test again?

Yes, it works now. However, I had to change qt-mt into qt in new/qt.jam since
I didn't try to compile the multi threaded QT library for Kylix yet.
Shouldn't qt be the default and only be changed to qt-mt when <threading> is
set to multi?

> > -lx Pass option x to linker
> > -l-x Disable option x for linker
> > So, I don't know if there's a better way to specify libraries. Makefiles
> > generated by the Kylix IDE actually contain calls to ilink where the
> > libraries are also specified by their complete file name. As a reminder,
> > here's an excerpt from a Kylix generated Makefile that I send to you ina
> > previous email:
> > ilink
> > \ -Tpd -aa -D"" -x -Gn -v
> > \ -Ltmp:/Net/hubble/Users/felix/local/lib/kylix3//lib/obj
> > \ -L/Net/hubble/Users/felix/local/lib/kylix3//lib:/usr/lib:/lib
> > \ -L/usr/X11R6/lib:/Net/hubble/Users/felix/local/lib/kylix3//bin
> > \ borinitso.o foo.o, libfoo.so,,
> > \ libborcrtl.so libborstl.so libborunwind.so libc.so libm.so libdl.so,,
> > \ foo.res
>
> I don't really know what should be used. Borland/Kylix users should decide.

I plan to apply Boost Build v2 to a little project consisting of a couple of
libraries and an executable. If that works with bc++ as a link action, I guess
there is no reason to change it to ilink for now.

Felix

-- 
To contact me personally don't reply but send email to 
felix DOT klee AT inka DOT de
 

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk