I have a mathematical Library (ADOL-C) that needs to link to an other library (ColPack) for some optional tasks.
I can compile them fine in Linux, and both ADOl-C or ColPack alone in windows, but when I try to compile ADOL-C with ColPack in windows (MinGW 32, ld 2.22) I have the following issue:
$ make
Making all in ADOL-C
make[1]: Entering directory `/c/tests/ADOL-C-2.3.0/ADOL-C'
[...]
CC int_reverse_s.lo
CC int_reverse_t.lo
CXXLD libadolc.la
*** Warning: This system can not link to static lib archive /usr/lib/libColPack.
la.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have.
Creating library file: .libs/libadolc.dll.a
sparse/.libs/libsparse.a(sparsedrivers.o): In function `generate_seed_jac':
c:\tests\ADOL-C-2.3.0\ADOL-C\src\sparse/sparsedrivers.cpp:119: undefined referen
ce to `ColPack::BipartiteGraphPartialColoringInterface::BipartiteGraphPartialCol
oringInterface(int, ...)'
[...]
collect2: ld returned 1 exit status
make[5]: *** [libadolc.la] Error 1
make[5]: Leaving directory `/c/tests/ADOL-C-2.3.0/ADOL-C/src'
make[4]: *** [all-recursive] Error 1
I can’t just provide the dynamic library as in MinGW, even if I configure ColPack with –enable-shared, I never got actually any shared library from its compilation, only libColPack.[a|la|lai] and ColPack.exe.
Any hint?
It took a little longer, until I solved the problem.
Download Colpack-1.0.8.tar.gz and tested it with the following environment
Msys / mingw 4.7.0.
As you said, you can not use it to create a shared lib.
After some time I have found a more complex solution. From this basis I’ve found a shorter way.
short solution:
open configure
line# __________ change ________________ to __
save and run
open libtool
line# __________ change ________________ to __
save and run
in the .lib directory should now be following files.
outtake from libColPack-0.dll
outtake from libColPack.la
Hope that helps !
NOTE:
Have not tested “make install” !
To have both static and dynamic:
Move libColPack.la, libColPack.lai and libColPack.dll.a to another folder. We need them and they will be overwritten. Delete the file libColPack.la, a directory-level higher.
Change libtool file back to its original state (the 2 lines) .
Run “make”
You will have a new libColPack.a
Move libColPack.dll.a back to .libs
Merging the content of the two previously moved files with the new libColPack.la (.lai).
Copy also the updated libColPack.la a directory-level higher.
The new mixdown file: libColPack.la
With this trick you have both static and dynamic libs.