This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: weirdness with bz2


Did you read /usr/doc/Cygwin/bzip2-1.0.1.README?

The header file defines things so that you can link to libbz2.dll.a (the
dll import lib) by default.  ld/gcc will cooperate with that if you
specify '-lbz2' on the link line: it searches for "lib<foo>.dll.a"
BEFORE searching for "lib<foo>.a".  If you use the header file but
specify '/usr/lib/libbz2.a' as an explicit link dependency (rather than
-lbz2) then you'll get symbol mismatch.

To link with the static lib, do this:

1) when compiling, put '-DBZLIB_STATIC' on the compile line
2) when linking, use the '-static' option and specify '-lbz2'.  -static
will force the linker to ignore lib<foo>.dll.a and link with lib<foo>.a.

To link with the dll, do this:

1) no special -D defines necessary
2) no special link options necessary, just specify '-lbz2' on the link
line and let the linker do the work.

--Chuck


"Stephen C. Biggs" wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I am trying to link something with libbz2.a and am getting the
> following errors:
> undefined reference to `_imp__BZ2_bzopen'
> undefined reference to `_imp__BZ2_bzdopen'
> undefined reference to `_imp__BZ2_bzflush'
> undefined reference to `_imp__BZ2_bzread'
> undefined reference to `_imp__BZ2_bzerror'
> undefined reference to `_imp__BZ2_bzwrite'
> undefined reference to `_imp__BZ2_bzclose'
> 
> ...basically the entire library.  what am I doing wrong?  The library is
> there and so are the references (I dumped to to
> make sure).
> 
> -----BEGIN PGP SIGNATURE-----
> Version: PGP 6.5.8 -- QDPGP 2.61c
> 
> iQA/AwUBOjNsR7rbYfqpOoVxEQLpogCgyL4o04qFMc9LASSewrG2BZl99nsAn3CJ
> FJrliJ3JYQwXTQ88+f4bpkQS
> =Avp7
> -----END PGP SIGNATURE-----
> 
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]