cygwin, g++ and boost? Do I need dll.a?

View: New views
6 Messages — Rating Filter:   Alert me  

cygwin, g++ and boost? Do I need dll.a?

by adam99 :: Rate this Message:

| View Threaded | Show Only this Message

I downloaded boost packages under cygwin (both boost and boost-devel). My first problem is unit test framework was not installed through this installation. I have tried to create it through bjam and created a library file at

/usr/src/boost-1.33.1-3/boost_1_33_1/bin/boost/libs/test/build/libboost_unit_tes
t_framework.a/gcc/boost_unit_test_framework/libboost_unit_test_framework-gcc-1_3
3_1.a

I copied it from there to my /lib directory. Then while trying to build quantlib I figured out that quantlib was not able to find any of the boost libraries. They are in my /lib directory as below.

After several trials with an hello world code an trying to link library, I realized that I can not link anything in /lib without dll.a extension

g++ -o hello -L/lib hello.cpp -llibcrypt
this works, since
ls /lib/libcrypt*
/lib/libcrypt.a  /lib/libcrypt.dll.a

g++ -o hello -L/lib hello.cpp -llibbfd
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -llibbfd
collect2: ld returned 1 exit status

fails as libbfd.dll.a does not exist;
 ls /lib/libbfd*
/lib/libbfd.a  /lib/libbfd.la

none of the libboost have dll.a file;
ls libboost*
libboost_date_time-gcc-mt-1_33_1.a          libboost_program_options-gcc-mt-s.a       libboost_signals-gcc-mt-s.a
libboost_date_time-gcc-mt-s-1_33_1.a        libboost_program_options-gcc-mt.a         libboost_signals-gcc-mt.a
libboost_date_time-gcc-mt-s.a               libboost_python-gcc-mt-1_33_1.a           libboost_thread-gcc-mt-1_33_1.a
libboost_date_time-gcc-mt.a                 libboost_python-gcc-mt.a                  libboost_thread-gcc-mt-s-1_33_1.a
libboost_filesystem-gcc-mt-1_33_1.a         libboost_regex-gcc-mt-1_33_1.a            libboost_thread-gcc-mt-s.a
libboost_filesystem-gcc-mt-s-1_33_1.a       libboost_regex-gcc-mt-s-1_33_1.a          libboost_thread-gcc-mt.a
libboost_filesystem-gcc-mt-s.a              libboost_regex-gcc-mt-s.a                 libboost_unit_test_framework-gcc-1_33_1.a
libboost_filesystem-gcc-mt.a                libboost_regex-gcc-mt.a                   libboost_unit_test_framework-gcc-mt.a
libboost_iostreams-gcc-mt-1_33_1.a          libboost_serialization-gcc-mt-1_33_1.a    libboost_wave-gcc-mt-1_33_1.a
libboost_iostreams-gcc-mt-s-1_33_1.a        libboost_serialization-gcc-mt-s-1_33_1.a  libboost_wave-gcc-mt-s-1_33_1.a
libboost_iostreams-gcc-mt-s.a               libboost_serialization-gcc-mt-s.a         libboost_wave-gcc-mt-s.a
libboost_iostreams-gcc-mt.a                 libboost_serialization-gcc-mt.a           libboost_wave-gcc-mt.a
libboost_program_options-gcc-mt-1_33_1.a    libboost_signals-gcc-mt-1_33_1.a
libboost_program_options-gcc-mt-s-1_33_1.a  libboost_signals-gcc-mt-s-1_33_1.a

Could you tell me why I need dll.a files? Also how can I generate them for the boost installation under cygwin

Thanks

RE: cygwin, g++ and boost? Do I need dll.a?

by Dave Korn :: Rate this Message:

| View Threaded | Show Only this Message

On 09 January 2008 04:57, adam99 wrote:

> After several trials with an hello world code an trying to link library, I
> realized that I can not link anything in /lib without dll.a extension
>
> g++ -o hello -L/lib hello.cpp -llibcrypt
> this works, since
> ls /lib/libcrypt*
> /lib/libcrypt.a  /lib/libcrypt.dll.a
>
> g++ -o hello -L/lib hello.cpp -llibbfd
> /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot
> find -llibbfd
> collect2: ld returned 1 exit status
>
> fails as libbfd.dll.a does not exist;
>  ls /lib/libbfd*
> /lib/libbfd.a  /lib/libbfd.la

  Wrong reasoning.  The actual problem is that you need to remove the 'lib'
prefix when supplying a library name:

> g++ -o hello -L/lib hello.cpp -lcrypt
> g++ -o hello -L/lib hello.cpp -lbfd

  Ordinary .a files are for static linking, .dll.a files are for runtime
linking against dlls, gcc selects the right one for you by using one of the
-shared or -static flags.

> none of the libboost have dll.a file;

  Yep, they are static libraries, there is no boost DLL.  Get your -l option
right and everything should be ok.

> Could you tell me why I need dll.a files?

  The dll.a file is what is known as an import library.  A standard .a file
has all the library functions in it, and they are physically merged into your
final program executable.  An import library doesn't have the actual functions
in it, just stubs that call at runtime to the DLL that actually implements a
library.

> Also how can I generate them for
> the boost installation under cygwin

  You don't; the boost package links statically.  (And 99% of it isn't linked
at all; most of it works just by including the headers to get the templates
and classes they define inline).

    cheers,
      DaveK
--
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: cygwin, g++ and boost? Do I need dll.a?

by Charles Wilson-2 :: Rate this Message:

| View Threaded | Show Only this Message

Dave Korn wrote:
>   Wrong reasoning.  The actual problem is that you need to remove the 'lib'
> prefix when supplying a library name:
>
>> g++ -o hello -L/lib hello.cpp -lcrypt
>> g++ -o hello -L/lib hello.cpp -lbfd
>
>   Ordinary .a files are for static linking, .dll.a files are for runtime
> linking against dlls, gcc selects the right one for you by using one of the
> -shared or -static flags.

Err, no.  gcc (by default) will use .dll.a files in preference to .a
files -- more completely, the search pattern for -lxxx is, in each
directory:

           libxxx.dll.a
           xxx.dll.a
           libxxx.a
           xxx.lib
           cygxxx.dll
           libxxx.dll
           xxx.dll
           libxxx.a (again, for architectural reasons)
           xxx      (this is so that stuff like -lmyspecific.o will
                     work as expected).

      before moving on to the next directory in the search path.

With -static, -lxxx only looks for:

           libxxx.a
           xxx

Note that, oddly, in -static mode a MS-style library name "xxx.lib" will
be ignored, while in (normal) mode it will be used if found (and the
other patterns ahead of it are not found).  Just an odd little quirk.

-shared is something competely different.  It means: make the output
file a DLL instead of an executable.

--
Chuck

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: cygwin, g++ and boost? Do I need dll.a?

by Václav Haisman :: Rate this Message:

| View Threaded | Show Only this Message



adam99 wrote, On 9.1.2008 5:57:
> I downloaded boost packages under cygwin (both boost and boost-devel). My
> first problem is unit test framework was not installed through this
> installation. I have tried to create it through bjam and created a library
> file at
I was about to reply that the Boost.Test library is there but then I noticed
the version of the package on mirrors is only -3. I have built updated
package with Boost.Test enabled some moths ago but I forgot to actually have
it uploaded. I will release the -4 package ASAP.

[...]

--
VH




signature.asc (258 bytes) Download Attachment

Parent Message unknown Re: cygwin, g++ and boost? Do I need dll.a?

by Danny Smith :: Rate this Message:

| View Threaded | Show Only this Message

At http://www.cygwin.com/ml/cygwin/2008-01/msg00158.html
Charles Wilson said:

> With -static, -lxxx only looks for:
>
>          libxxx.a
>          xxx
>
>
> Note that, oddly, in -static mode a MS-style library name "xxx.lib"
> will be ignored, while in (normal) mode it will be used if found (and
> the other patterns ahead of it are not found). Just an odd little
quirk.


That's not right. In -static mode, the binutils/ld/emultempl/pe.em
function: gld_${EMULATION_NAME}_find_potential_libraries will (failing
to find lib*.a) find *.lib as static archives

To test, just rename libkernel32.a to kernel32.lib (import libs are just
special static archives) and build a simple 'hello_world.c' testcase
with
-static

Danny




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Re: cygwin, g++ and boost? Do I need dll.a?

by Václav Haisman :: Rate this Message:

| View Threaded | Show Only this Message

adam99 wrote:
> I downloaded boost packages under cygwin (both boost and boost-devel). My
> first problem is unit test framework was not installed through this
> installation. I have tried to create it through bjam and created a library
> file at
[...]

If you have not noticed yet, I have updated the Boost package, now built
with Boost.Test library enabled. Try that.

--
VH



signature.asc (258 bytes) Download Attachment