[CMake] MINGW and strip .dll.a files

Gregoire Aujay gaujay at movea.com
Thu Apr 25 08:13:41 EDT 2013


Hello,

I am just forwarding our discussion to the mailing list. We did not use reply to all.

Highligth:
So, I see no point in striping the .dll.a file. But, of course, I might be wrong. Please, anybody can check this?


Regards,
Gregoire

From: Daniel Franzini [mailto:daniel.franzini at gmail.com]
Sent: jeudi 25 avril 2013 13:30
To: Gregoire Aujay
Subject: Re: [CMake] MINGW and strip .dll.a files

The strip program just removes unused symbols from any object code.

This is Win32/Mingw specific stuff (MSVC have the same stuff but they use their own object format).

When you compile a DLL, you have two options:

1.) hand write your own LoadLibrary/FreeLibrary code and just distribute the DLL with your
exe (or other DLL)

2.) static-link your exe against the dll.a file which is generated by the linker and is win32 specific magic code that have stubs to the functions it will call from the DLL.

Either way you have to distribute the DLL with your exe.

The .dll.a (called import library) file is generated by the linker with appropriate options and it is reported to be buggy in the past. I'm not sure nowadays.

So, I see no point in striping the .dll.a file. But, of course, I might be wrong. Please, anybody can check this?
On Thu, Apr 25, 2013 at 4:42 AM, Gregoire Aujay <gaujay at movea.com<mailto:gaujay at movea.com>> wrote:
Hello ;

So you agree that CMake should not strip .dll.a files.

Currently that is what is done in the cmake_install.cmake files, e.g. I get (CMake 2.8.10.2):

IF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")
  FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/release/lib" TYPE STATIC_LIBRARY OPTIONAL FILES "XXXXXX/release/lib/libmyLib.dll.a")
  IF(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/release/lib/ libmyLib.dll.a" AND
     NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/release/lib/ libmyLib.dll.a")
    IF(CMAKE_INSTALL_DO_STRIP)
      EXECUTE_PROCESS(COMMAND "YYYYYY/bin/strip.exe" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/release/lib/ libmyLib.dll.a")
    ENDIF(CMAKE_INSTALL_DO_STRIP)
  ENDIF()
ENDIF(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "Unspecified")


Unless someone tells me it is done intentionally I will file a bug.


Regards,
Gregoire

From: Daniel Franzini [mailto:daniel.franzini at gmail.com<mailto:daniel.franzini at gmail.com>]
Sent: mercredi 24 avril 2013 19:52
To: Gregoire Aujay
Subject: Re: [CMake] MINGW and strip .dll.a files

AFAIK, the dll.a file is a import library

It contains code that magically calls the DLL functions without having you to write LoadLibrary/FreeLibrary code.

Why are you stripping it anyway? The import libray should be linked as-is with your binary and them strip the binary.

NOTE: it does not contain the actual DLL code. It only have stubs that calls DLL functions.
On Wed, Apr 24, 2013 at 10:58 AM, Gregoire Aujay <gaujay at movea.com<mailto:gaujay at movea.com>> wrote:
Hello,

I am trying to package a stripped library built with MINGW.

When I activate strip during install or pack, I get link error (unresolved symbols) when using this library.
When I strip using "-s" option, everything is fine.

The difference is that my .dll.a is smaller when I use CMake strip feature. Gcc does not seem to strip the .dll.a file.

Is it a good approach to strip the .dll.a file ?

Regards,
Gregoire

--

Powered by www.kitware.com<http://www.kitware.com>

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake



--
Daniel

"Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other." (http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And while I'm not good at painting, drawing, or music, I can write software." (Yukihiro Matsumoto, a.k.a. ``Matz'')



--
Daniel

"Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do." (Donald Knuth)

"Yes, technogeeks can be funny, even if only to each other." (http://www.boogieonline.com/revolution/science/humor/)"

"Man is driven to create; I know I really love to create things. And while I'm not good at painting, drawing, or music, I can write software." (Yukihiro Matsumoto, a.k.a. ``Matz'')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130425/72fd7e6f/attachment-0001.htm>


More information about the CMake mailing list