#2 Making ATLAS dlls with MinGW

developer
open
5
2009-11-13
2008-10-11
No

With the default -shared configure option and ATLAS 3.9.4, "make shared" does not work under Mingw. This is because the option "-lc" is passed to the linker, and that library does not exist under MinGW.

The easiest way to work around this problem is to let gcc figure out the libs, object files and other options to pass to the linker to generate a correct dll.

The following work for me with a 4.3.2 Mingw gcc (like the one found at http://www.tdragon.net/recentgcc/\):

gcc -shared -o libatlas.dll -Wl,--whole-archive libatlas.a -Wl,--no-whole-archive,--output-def,libatlas.def,--out-implib,libatlas_gcc.lib
gcc -shared -o libf77blas_atlas.dll -Wl,--whole-archive libf77blas.a -Wl,--no-whole-archive libatlas.a -lgfortran -Wl,--output-def,libf77blas_atlas.def,--out-implib,libf77blas_atlas_gcc.lib
gcc -shared -o libcblas_atlas.dll -Wl,--whole-archive libcblas.a -Wl,--no-whole-archive libatlas.a -Wl,--output-def,libcblas_atlas.def,--out-implib,libcblas_atlas_gcc.lib
gcc -shared -o liblapack_atlas.dll -Wl,--whole-archive liblapack.a libf77blas.a libcblas.a -Wl,--no-whole-archive libatlas.a -lgfortran -Wl,--output-def,liblapack_atlas.def,--out-implib,liblapack_atlas_gcc.lib
gcc -shared -o libptf77blas_atlas.dll -Wl,--whole-archive libptf77blas.a -Wl,--no-whole-archive libatlas.a -lgfortran -lpthread -Wl,--output-def,libptf77blas_atlas.def,--out-implib,libptf77blas_atlas_gcc.lib
gcc -shared -o libptcblas_atlas.dll -Wl,--whole-archive libptcblas.a -Wl,--no-whole-archive libatlas.a -lpthread -Wl,--output-def,libptcblas_atlas.def,--out-implib,libptcblas_atlas_gcc.lib
gcc -shared -o libptlapack_atlas.dll -Wl,--whole-archive liblapack.a libptf77blas.a libptcblas.a -Wl,--no-whole-archive libatlas.a -lgfortran -lpthread -Wl,--output-def,libptlapack_atlas.def,--out-implib,libptlapack_atlas_gcc.lib

the above commands also work for other win32 configs with minor changes:
- for a cygwin gcc, -lpthreads must be removed
- for a 3.x gcc, libgfortran must be replaced by libg2c

The import libs generated allow for easy use of the generated dlss from gcc; the .def files can be used by the Microsoft LIB tool to generate import libs for use with the Microsoft toolchain.

The above is probably a more portable way to generate these shared libs than the current method that directly invokes the linker.

Discussion

    • assigned_to: nobody --> rwhaley
     
    • labels: 360153 --> Problems with linking
    • milestone: 148063 -->
     
  • Moved this over to the window support tracker (new). I will comment as soon as I can get things working on windows again.

     
    • milestone: --> developer
     
  • Please not that I included the above instructions, updated to remove the dependency on pthread, in the forum "ATLAS on windows", under the topic "Installing ATLAS in a mixed cygwin/MinGW env".

     
  • dbFAlF <a href="http://pqplqzicnyls.com/">pqplqzicnyls</a>, [url=http://vebnijoooztr.com/]vebnijoooztr[/url], [link=http://fdrvicobvpaj.com/]fdrvicobvpaj[/link], http://lhaptehcaegq.com/

     
  • YzTCBS <a href="http://pwyvfnpotdqj.com/">pwyvfnpotdqj</a>, [url=http://bbnwiemtdmet.com/]bbnwiemtdmet[/url], [link=http://cjxcjhvfyrne.com/]cjxcjhvfyrne[/link], http://deycpudiyuzq.com/